Skip to content

Commit 19da028

Browse files
committed
fix: Convert to uv.
1 parent 9a78ea0 commit 19da028

16 files changed

Lines changed: 3862 additions & 2567 deletions

File tree

.github/workflows/ci.yml

Lines changed: 30 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -7,96 +7,68 @@ on:
77
- main
88

99
jobs:
10-
validate:
10+
ruff:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
1414

15-
- uses: actions/setup-python@v4
15+
- uses: astral-sh/setup-uv@v5
1616
with:
17-
python-version: "3.8"
17+
python-version: "3.12"
1818

19-
- name: Install Pre-Commit
20-
run: python -m pip install pre-commit && pre-commit install
19+
- name: Install dependencies
20+
run: uv sync --group lint
2121

22-
- name: Load cached Pre-Commit Dependencies
23-
id: cached-pre-commit-dependencies
24-
uses: actions/cache@v3
25-
with:
26-
path: ~/.cache/pre-commit/
27-
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
22+
- name: Run ruff check
23+
run: uv run ruff check .
2824

29-
- name: Execute Pre-Commit
30-
run: pre-commit run --show-diff-on-failure --color=always --all-files
25+
- name: Run ruff format
26+
run: uv run ruff format --check .
3127

3228
mypy:
3329
runs-on: ubuntu-latest
3430
steps:
3531
- uses: actions/checkout@v4
3632

37-
- uses: actions/setup-python@v5
38-
with:
39-
python-version: "3.8"
40-
41-
- uses: pdm-project/setup-pdm@v4
42-
name: Set up PDM
33+
- uses: astral-sh/setup-uv@v5
4334
with:
44-
python-version: "3.8"
45-
cache: true
46-
cache-dependency-path: |
47-
./pdm.lock
35+
python-version: "3.12"
4836

4937
- name: Install dependencies
50-
run: pdm install -G:all
38+
run: uv sync --group lint --group test
5139

5240
- name: Run mypy
53-
run: pdm run mypy
41+
run: uv run mypy
5442

5543
pyright:
5644
runs-on: ubuntu-latest
5745
steps:
5846
- uses: actions/checkout@v4
5947

60-
- uses: actions/setup-python@v5
61-
with:
62-
python-version: "3.8"
63-
64-
- uses: pdm-project/setup-pdm@v4
65-
name: Set up PDM
48+
- uses: astral-sh/setup-uv@v5
6649
with:
67-
python-version: "3.8"
68-
cache: true
69-
cache-dependency-path: |
70-
./pdm.lock
50+
python-version: "3.12"
7151

7252
- name: Install dependencies
73-
run: pdm install -G:all
53+
run: uv sync --group lint --group test
7454

7555
- name: Run pyright
76-
run: pdm run pyright
56+
run: uv run pyright
7757

7858
slotscheck:
7959
runs-on: ubuntu-latest
8060
steps:
8161
- uses: actions/checkout@v4
8262

83-
- uses: actions/setup-python@v5
63+
- uses: astral-sh/setup-uv@v5
8464
with:
85-
python-version: "3.8"
86-
87-
- uses: pdm-project/setup-pdm@v4
88-
name: Set up PDM
89-
with:
90-
python-version: "3.8"
91-
cache: true
92-
cache-dependency-path: |
93-
./pdm.lock
65+
python-version: "3.12"
9466

9567
- name: Install dependencies
96-
run: pdm install -G:all
68+
run: uv sync --group lint
9769

9870
- name: Run slotscheck
99-
run: pdm run slotscheck type_lens
71+
run: uv run slotscheck type_lens
10072

10173
test:
10274
runs-on: ubuntu-latest
@@ -105,55 +77,37 @@ jobs:
10577
matrix:
10678
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
10779
timeout-minutes: 30
108-
defaults:
109-
run:
110-
shell: bash
11180
steps:
112-
- name: Check out repository
113-
uses: actions/checkout@v4
81+
- uses: actions/checkout@v4
11482

115-
- uses: pdm-project/setup-pdm@v3
116-
name: Set up PDM
83+
- uses: astral-sh/setup-uv@v5
11784
with:
118-
allow-python-prereleases: true
11985
python-version: ${{ matrix.python-version }}
120-
cache: true
12186

12287
- name: Install dependencies
123-
run: pdm install
88+
run: uv sync --group test
12489

12590
- name: Test
126-
run: pdm run pytest -m ""
91+
run: uv run pytest
12792

12893
build-docs:
129-
needs:
130-
- validate
13194
if: github.event_name == 'pull_request'
13295
runs-on: ubuntu-latest
13396
steps:
134-
- name: Check out repository
135-
uses: actions/checkout@v4
136-
137-
- name: Set up Python
138-
uses: actions/setup-python@v4
139-
with:
140-
python-version: "3.12"
97+
- uses: actions/checkout@v4
14198

142-
- uses: pdm-project/setup-pdm@v3
143-
name: Set up PDM
99+
- uses: astral-sh/setup-uv@v5
144100
with:
145101
python-version: "3.12"
146-
cache: true
147102

148103
- name: Install dependencies
149-
run: pdm install -G:docs
104+
run: uv sync --group docs
150105

151106
- name: Build docs
152-
run: pdm run make docs
107+
run: uv run make docs
153108

154109
- name: Save PR number
155-
run: |
156-
echo "${{ github.event.number }}" > .pr_number
110+
run: echo "${{ github.event.number }}" > .pr_number
157111

158112
- name: Upload artifact
159113
uses: actions/upload-artifact@v4

.github/workflows/publish.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,12 @@ jobs:
1717
- name: Check out repository
1818
uses: actions/checkout@v4
1919

20-
- uses: actions/setup-python@v4
20+
- uses: astral-sh/setup-uv@v5
2121
with:
2222
python-version: "3.12"
2323

24-
- uses: pdm-project/setup-pdm@v3
25-
name: Set up PDM
26-
with:
27-
python-version: "3.12"
28-
cache: true
29-
3024
- name: Build package
31-
run: pdm build
25+
run: uv build
3226

3327
- name: Publish package distributions to PyPI
3428
uses: pypa/gh-action-pypi-publish@release/v1

CONTRIBUTING.rst

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ Contribution guide
44
Setting up the environment
55
--------------------------
66

7-
1. Install `Pizza Delivery Man <https://pdm.fming.dev/latest/>`_
8-
2. Run ``pdm install -G:all`` to create a `virtual environment <https://docs.python.org/3/tutorial/venv.html>`_ and install
7+
1. Install `uv <https://docs.astral.sh/uv/getting-started/installation/>`_
8+
2. Run ``make install`` to create a `virtual environment <https://docs.python.org/3/tutorial/venv.html>`_ and install
99
the dependencies
10-
3. If you're working on the documentation and need to build it locally, install the extra dependencies with ``pdm install -G:docs``
11-
4. Install `pre-commit <https://pre-commit.com/>`_
12-
5. Run ``pre-commit install`` to install pre-commit hooks
1310

1411
Code contributions
1512
------------------
@@ -21,8 +18,7 @@ Workflow
2118
2. Clone your fork locally with git
2219
3. `Set up the environment <#setting-up-the-environment>`_
2320
4. Make your changes
24-
5. (Optional) Run ``pre-commit run --all-files`` to run linters and formatters. This step is optional and will be executed
25-
automatically by git before you make a commit, but you may want to run it manually in order to apply fixes
21+
5. (Optional) Run ``make lint`` to run linters and type checkers, or ``make format`` to auto-format
2622
6. Commit your changes to git
2723
7. Push the changes to your fork
2824
8. Open a `pull request <https://docs.github.com/en/pull-requests>`_. Give the pull request a descriptive title
@@ -37,14 +33,18 @@ Guidelines for writing code
3733
----------------------------
3834

3935
- All code should be fully `typed <https://peps.python.org/pep-0484/>`_. This is enforced via
40-
`mypy <https://mypy.readthedocs.io/en/stable/>`_.
36+
`mypy <https://mypy.readthedocs.io/en/stable/>`_ and `pyright <https://github.com/microsoft/pyright>`_.
4137
- All code should be tested. This is enforced via `pytest <https://docs.pytest.org/en/stable/>`_.
42-
- All code should be properly formatted. This is enforced via `black <https://black.readthedocs.io/en/stable/>`_ and `Ruff <https://beta.ruff.rs/docs/>`_.
38+
- All code should be properly formatted. This is enforced via `Ruff <https://docs.astral.sh/ruff/>`_.
4339

4440
Writing and running tests
4541
+++++++++++++++++++++++++
4642

47-
.. todo:: Write this section
43+
Run the test suite with:
44+
45+
.. code-block:: shell
46+
47+
make test
4848
4949
Project documentation
5050
---------------------
@@ -57,11 +57,7 @@ The documentation is located in the ``/docs`` directory and is `ReST <https://do
5757
Running the docs locally
5858
++++++++++++++++++++++++
5959

60-
To run or build the docs locally, you need to first install the required dependencies:
61-
62-
``pdm install -G:docs``
63-
64-
Then you can serve the documentation with ``make docs-serve``, or build them with ``make docs``.
60+
You can serve the documentation with ``make docs-serve``, or build them with ``make docs``.
6561

6662
Creating a new release
6763
----------------------

0 commit comments

Comments
 (0)