diff --git a/.envrc b/.envrc index 84fc8e5..d26b62d 100644 --- a/.envrc +++ b/.envrc @@ -2,6 +2,7 @@ # directory via our direnv integration: eval "$(devbox generate direnv --print-envrc)" +unset UV_PYTHON # check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/ # for more details diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index 5bded49..feebc56 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -58,9 +58,52 @@ jobs: with: python-version: ${{ matrix.python-version }} allow-prereleases: true + - name: Install hatch uses: pypa/hatch@install - - name: Smoke test installation - run: pip install . + - name: Test run: hatch test --cover --python ${{ matrix.python-version }} + + - name: Disambiguate coverage filename + run: mv .coverage ".coverage.${{ matrix.os }}.${{ matrix.python-version }}" + + - name: Upload coverage data + uses: actions/upload-artifact@v4 + with: + include-hidden-files: true + name: coverage-${{ matrix.os }}-${{ matrix.python-version }} + path: .coverage* + + coverage: + runs-on: ubuntu-latest + name: Report coverage + needs: + - test + steps: + - uses: actions/checkout@v4 + - name: Install Hatch + uses: pypa/hatch@install + + - name: Download coverage data + uses: actions/download-artifact@v4 + with: + pattern: coverage-* + merge-multiple: true + + - name: Combine coverage data + run: hatch run coverage:combine + + - name: Export coverage reports + run: hatch run coverage:xml + + - uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + + package: + name: Build & verify package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: hynek/build-and-inspect-python-package@v2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b7c4f9c..0f14840 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,15 +1,15 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.7 + rev: v0.6.9 hooks: - id: ruff - id: ruff-format - repo: https://github.com/pycqa/doc8 - rev: v1.1.1 + rev: v1.1.2 hooks: - id: doc8 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.10.0 + rev: v1.11.2 hooks: - id: mypy additional_dependencies: diff --git a/devbox.json b/devbox.json index 2fd8598..e074cdc 100644 --- a/devbox.json +++ b/devbox.json @@ -1,14 +1,12 @@ { - "packages": [ - "python@3.12" - ], + "packages": ["python@3.12"], "shell": { "init_hook": "test $FISH_VERSION && . $VENV_DIR/bin/activate.fish || . $VENV_DIR/bin/activate", "scripts": { "setup": [ - "pip install hatch==1.9.0 pre-commit==3.7.0", + "pip install hatch==1.12.0 pre-commit==4.0.1", "pre-commit install" ] } } -} \ No newline at end of file +} diff --git a/devbox.lock b/devbox.lock index 90c8d93..ea88361 100644 --- a/devbox.lock +++ b/devbox.lock @@ -3,7 +3,7 @@ "packages": { "python@3.12": { "last_modified": "2024-05-12T16:19:40Z", - "plugin_version": "0.0.3", + "plugin_version": "0.0.4", "resolved": "github:NixOS/nixpkgs/3281bec7174f679eabf584591e75979a258d8c40#python312", "source": "devbox-search", "version": "3.12.3", diff --git a/hatch.toml b/hatch.toml index 77141da..5366205 100644 --- a/hatch.toml +++ b/hatch.toml @@ -1,19 +1,35 @@ +[envs.default] +installer = "uv" +features = ["pydantic"] + +[envs.hatch-static-analysis] +dependencies = ["ruff==0.6.*"] +config-path = ".ruff_defaults.toml" + [envs.hatch-test] extra-dependencies = [ "freezegun==1.5.*", ] features = ["pydantic"] -[envs.hatch-static-analysis] -config-path = ".ruff_defaults.toml" +[envs.coverage] +detached = true +dependencies = [ + "coverage[toml]>=6.2", + "lxml", +] + +[envs.coverage.scripts] +combine = "coverage combine {args}" +xml = "coverage xml" [envs.types] extra-dependencies = [ - "mypy==1.10.*", + "mypy==1.11.*", "pytest==8.2.*", ] features = ["pydantic"] -scripts = { check = "mypy --install-types --non-interactive {args:schwifty tests}" } +scripts = { check = "mypy {args:schwifty tests}" } [envs.docs] extra-dependencies = [