Skip to content

Commit

Permalink
tweak stuff (#45)
Browse files Browse the repository at this point in the history
* tweak stuff

* Update coverage.yml

* Update CI.yml

* Update test.yml

* Update test.yml

* Update test.yml
  • Loading branch information
diceroll123 authored Nov 29, 2024
1 parent 1168387 commit 7a0d711
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 24 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,7 @@ jobs:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: "Install uv"
uses: astral-sh/setup-uv@v3
with:
version: "0.5.1"
uses: astral-sh/setup-uv@v4
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@ jobs:
token: ${{ github.token }}

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.5.1"
uses: astral-sh/setup-uv@v4

- name: Run tests
shell: bash
run: |
uv sync
uv run coverage run -m pytest
uv run --frozen coverage run -m pytest
- name: Coverage comment
id: coverage_comment
Expand Down
33 changes: 22 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version:
- "3.11"
- "3.12"
- "3.13"
python-version: ["3.11", "3.12", "3.13"]

name: pytest ${{ matrix.python-version }}
steps:
Expand All @@ -25,15 +22,29 @@ jobs:
token: ${{ github.token }}

- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: "0.5.1"

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
python-version: ${{ matrix.python-version }}

- name: Run tests
shell: bash
run: |
uv sync
uv run pytest
uv run --frozen pytest
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ github.token }}

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Install deps
shell: bash
run: |
uv sync --frozen --only-dev
- uses: pre-commit/action@v3.0.1
36 changes: 35 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,42 @@
repos:
- repo: "https://github.com/pre-commit/pre-commit-hooks"
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: check-merge-conflict
- id: check-case-conflict
- id: check-yaml
- id: check-ast
- id: debug-statements
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.6.8
rev: v0.8.0
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.389
hooks:
- id: pyright
- repo: https://gitlab.com/vojko.pribudic.foss/pre-commit-update
rev: v0.6.0post1
hooks:
- id: pre-commit-update
args: []

- repo: local
hooks:
- id: cargo-clippy
name: Run cargo clippy
entry: cargo clippy --fix --allow-staged
language: system
types: [rust]
pass_filenames: false

- id: cargo-fmt
name: cargo fmt
entry: cargo fmt --
language: system
types: [rust]
pass_filenames: false
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name = "neofoodclub"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.23.0", features = ["extension-module", "abi3-py311", "chrono", "chrono-tz"] }
pyo3 = { version = "0.23.2", features = ["extension-module", "abi3-py311", "chrono", "chrono-tz"] }
neofoodclub = { path = "./neofoodclub_rs" }
chrono = "0.4.38"
chrono-tz = "0.10.0"
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ reportUnnecessaryTypeIgnoreComment = "warning"
reportUnusedImport = "error"
pythonVersion = "3.11"
typeCheckingMode = "basic"
venvPath = "."
venv = ".venv"

[tool.ruff]
show-fixes = true
Expand All @@ -49,7 +51,7 @@ target-version = "py311"
extend-select = [
"C4",
"SIM",
"TCH",
"TC",
"UP",
"ANN201",
"ANN202",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_neofoodclub.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def test_removed_timestamp(nfc: NeoFoodClub) -> None:

def test_timestamp(nfc: NeoFoodClub) -> None:
assert nfc.timestamp == datetime.datetime(
2021, 2, 16, 23, 47, 37, tzinfo=datetime.timezone.utc
2021, 2, 16, 23, 47, 37, tzinfo=datetime.UTC
)


Expand All @@ -193,7 +193,7 @@ def test_outdated_lock(nfc: NeoFoodClub) -> None:


def test_outdated_lock_false(nfc: NeoFoodClub) -> None:
now = datetime.datetime.now(datetime.timezone.utc)
now = datetime.datetime.now(datetime.UTC)
data = json.loads(nfc.to_json())
data["start"] = now.isoformat()
new_nfc = NeoFoodClub(json.dumps(data))
Expand Down

0 comments on commit 7a0d711

Please sign in to comment.