Skip to content

Commit

Permalink
Spruce up, especially with uv
Browse files Browse the repository at this point in the history
  • Loading branch information
t-mart committed Jan 19, 2025
1 parent 677e28d commit fc50ccd
Show file tree
Hide file tree
Showing 15 changed files with 1,209 additions and 1,963 deletions.
18 changes: 8 additions & 10 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,18 @@ jobs:
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install poetry
run: pipx install poetry # already installed on runner
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'poetry'
- name: Poetry install
run: poetry install
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
run: uv python install
- name: Install the project
run: uv sync --all-extras --dev
- name: Build docs
run: poetry run mkdocs build
run: uv run mkdocs build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './site'
path: "./site"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
81 changes: 29 additions & 52 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,26 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install Poetry
run: |
pipx install poetry
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "poetry"
- name: Set up Python
run: uv python install

- name: Install dependencies
run: |
poetry install
- name: Install the project
run: uv sync --all-extras --dev

- name: ruff check
run: |
poetry run ruff check src tests docs
- name: Ruff Format Check
run: uv run ruff format --check

- name: Ruff Check
run: uv run ruff check --diff

- name: Check twine
shell: bash
# TODO: Renable the dist/* line. Currently failing to check the whl
run: |
poetry build
# poetry run twine check dist/*
poetry run twine check dist/*.tar.gz
uv build
uv run twine check dist/*.tar.gz
test:
name: Test
Expand All @@ -57,23 +52,17 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install Poetry
run: |
pipx install poetry
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "poetry"
- name: Set up Python
run: uv python install

- name: Install dependencies
run: |
poetry install
- name: Install the project
run: uv sync --all-extras --dev

- name: Run tests
run: |
poetry run pytest
- name: Test
run: uv run pytest

publish:
name: Publish
Expand All @@ -85,33 +74,21 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install Poetry
run: |
pipx install poetry
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "poetry"
- name: Set up Python
run: uv python install

- name: Install dependencies
run: |
poetry install
- name: Install the project
run: uv sync --all-extras --dev

- name: Build
run: |
poetry build
- name: Configure PyPI
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi "$PYPI_TOKEN"
run: uv build

- name: Publish to PyPI
run: |
poetry publish
uv publish --token $PYPI_TOKEN
# I suppose this is kinda useful to have, but, really, its just so that the mkdocs scraper
# can determine the latest version number in its github section.
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
25 changes: 8 additions & 17 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,19 @@
A few nuggets of information about the project:

- This is a [Python](https://www.python.org/downloads/) project.
- Depenedencies are managed with [poetry](https://python-poetry.org/). Install the project with
`poetry install`.
- Tests can be run with `python -m pytest`.
- Docs can be built with `mkdocs build` (or, rebuilt continuously with a development server with
- Depenedencies are managed with [uv](https://docs.astral.sh/uv/). Install the project with
`uv sync`.
- Tests can be run with `uv run pytest`.
- Docs can be built with `uv run mkdocs build` (or, rebuilt continuously with a development server with
`mkdocs serve`).
- Formatting should be done with [black](https://github.com/psf/black) and
[isort](https://github.com/PyCQA/isort). There's a Makefile target to do both with `make format`.
- Code should yield no [mypy](https://mypy.readthedocs.io/en/stable/) or
[flake8](https://flake8.pycqa.org/en/latest/) errors. Run `make check` to check for that.
- You can run [pre-commit](https://pre-commit.com/) checks by install the hook with `pre-commit
install`.
- Linting and formatting should be done with
[ruff](https://docs.astral.sh/ruff/). That is, `uv run ruff check` and `uv run
ruff format`, respectively.


## Releasing

1. Bump the version in the `pyproject.toml`. It can be done manually or with Poetry's `version`
command:

```bash
# for example, to bump the patch part...
poetry version patch
```
1. Bump the version in the `pyproject.toml`.

2. Create a git tag for that version, **prefixing the version with a `v` character**:

Expand Down
Loading

0 comments on commit fc50ccd

Please sign in to comment.