Skip to content

Commit

Permalink
chore: use hatch dev (#32)
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored Apr 20, 2024
1 parent 3c2ef1e commit 9a1e94c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 38 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Setup uv
uses: yezz123/setup-uv@v4
- name: Install Hatch
run: pip install hatch
run:
uv pip install --system
git+https://github.com/pypa/hatch@d615fef0961393c32e14016a7fee162699c08aaf
- name: Run bump script
run: |
hatch run sync
hatch run tools/sync.py
git status
git diff
- uses: peter-evans/create-pull-request@v6
Expand Down
28 changes: 11 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,29 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.12"]
runs-on: [ubuntu-latest, macos-latest, windows-latest]

include:
- python-version: pypy-3.10
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
python-version: |
3.8
3.9
3.10
3.11
3.12
- name: Setup uv
uses: yezz123/setup-uv@v4
with:
uv-venv: ".venv"

- name: Install package
run: uv pip install -e .[test]
- name: Install Hatch
run:
uv pip install --system
git+https://github.com/pypa/hatch@d615fef0961393c32e14016a7fee162699c08aaf

- name: Test package
run: >-
python -m pytest -ra --cov --cov-report=xml --cov-report=term
--durations=20
- name: Upload coverage report
uses: codecov/[email protected]
run: hatch test -ca
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ pre-commit automatically.
## Developing
This project uses `hatch`. You can run the sync script on Python 3.11+ by
running:
This project uses `hatch`. You can run the sync script by running:

```bash
hatch run sync
hatch run tools/sync.py
```

<!-- prettier-ignore-start -->
Expand Down
19 changes: 5 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,18 @@ pyright = "validate_pyproject_schema_store.schema:get_schema"
validate-pyproject-schema-store = "validate_pyproject.cli:main"

[tool.hatch.envs.default]
path = ".venv"
uv = true

[tool.hatch.envs.hatch-test]
features = ["test"]
dependencies = ["aiohttp", "tomlkit"]
scripts.test = "pytest {args}"
scripts.sync = "python tools/sync.py {args}"

[tool.hatch.envs.docs]
features = ["docs"]
dependencies = ["sphinx-autobuild"]
scripts.linkcheck = "sphinx-build -b linkcheck docs docs/_build/linkcheck {args}"
scripts.build = "sphinx-build --keep-going -n -T -b=html docs docs/_build/html {args}"
scripts.serve = "sphinx-autobuild -n -T -b=html docs docs/_build/html {args}"
scripts.build-api-docs = "sphinx-apidoc -o docs/api/ --module-first --no-toc --force src/validate_pyproject_schema_store {args}"

[tool.hatch.envs.lint]
requirements = ["pre-commit"]
dependencies = ["pre-commit"]
skip-install = true
scripts.lint = "pre-commit run --all-files --show-diff-on-failures {args}"

[tool.hatch.envs.pylint]
requirements = ["pylint"]
dependencies = ["pylint"]
scripts.lint = "pylint validate_pyproject_schema_store {args}"


Expand Down
6 changes: 4 additions & 2 deletions tools/sync.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# /// pyproject
# run.dependencies = [ "aiohttp", "tomlkit" ]
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.11"
# dependencies = [ "aiohttp", "tomlkit" ]
# ///


Expand Down

0 comments on commit 9a1e94c

Please sign in to comment.