Skip to content

Commit b98e42f

Browse files
committed
Simplify the project management using uv
1 parent 8849c95 commit b98e42f

23 files changed

+934
-2370
lines changed

.github/workflows/python-package.yml

+39-17
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
python-version: ["3.8", "3.11", "pypy3.10"]
15-
minizinc-version: ["2.8.0", "2.6.0"]
15+
minizinc-version: ["2.8.7", "2.6.0"]
1616

1717
env:
1818
MINIZINC_URL: https://github.com/MiniZinc/MiniZincIDE/releases/download/${{ matrix.minizinc-version }}/MiniZincIDE-${{ matrix.minizinc-version }}-x86_64.AppImage
@@ -40,34 +40,56 @@ jobs:
4040
sudo curl -o ${{ github.workspace }}/bin/minizinc -L $MINIZINC_URL
4141
sudo chmod +x ${{ github.workspace }}/bin/minizinc
4242
minizinc --version
43+
- name: Install uv
44+
uses: astral-sh/setup-uv@v4
4345
- name: Set up Python ${{ matrix.python-version }}
4446
uses: actions/setup-python@v5
4547
with:
4648
python-version: ${{ matrix.python-version }}
47-
- name: Install Python dependencies
48-
run: |
49-
python -m pip install --upgrade pip
50-
pip install poetry
51-
poetry install --with ci
52-
- name: Test with tox
53-
run: poetry run tox
49+
- name: Install the project
50+
run: uv sync --dev
51+
- name: Run Pytest
52+
run: uv run pytest
53+
- name: Install numpy
54+
run: uv pip install numpy
55+
- name: Run Pytest with numpy
56+
run: uv run pytest
5457

55-
docs:
58+
lints:
5659
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v4
62+
- name: Install uv
63+
uses: astral-sh/setup-uv@v4
64+
- name: Set up Python
65+
uses: actions/setup-python@v5
66+
with:
67+
python-version-file: ".python-version"
68+
- name: Install the project
69+
run: uv sync --dev
70+
- name: Check Ruff linter
71+
run: uv run ruff check
72+
- name: Check Ruff formatter
73+
run: uv run ruff format --check
74+
- name: Check MyPy type checker
75+
run: uv run mypy .
5776

77+
docs:
78+
runs-on: ubuntu-latest
5879
steps:
5980
- uses: actions/checkout@v4
81+
- name: Install uv
82+
uses: astral-sh/setup-uv@v4
6083
- name: Set up Python ${{ matrix.python-version }}
6184
uses: actions/setup-python@v5
6285
with:
63-
python-version: "3.x"
64-
- name: Install Python dependencies
65-
run: |
66-
python -m pip install --upgrade pip
67-
pip install poetry
68-
poetry install --with ci
69-
- name: Test with tox
70-
run: poetry run tox -e docs
86+
python-version-file: ".python-version"
87+
- name: Install the project
88+
run: uv sync --group docs
89+
- name: Generate the documentation
90+
run: uv run sphinx-build -b html docs dist/docs
91+
- name: Check the documentation doesn't have broken links
92+
run: uv run sphinx-build -b linkcheck docs dist/docs
7193
- uses: actions/upload-artifact@v4
7294
with:
7395
name: documentation

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ profile_default/
7979
ipython_config.py
8080

8181
# pyenv
82-
.python-version
82+
#.python-version
8383

8484
# celery beat schedule file
8585
celerybeat-schedule

.python-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

README.md

+29-16
Original file line numberDiff line numberDiff line change
@@ -101,22 +101,35 @@ _For more examples, please refer to the
101101
<!-- TESTING INSTRUCTIONS -->
102102
## Testing
103103

104-
MiniZinc Python uses [Tox](https://pypi.org/project/tox/) environments to test
105-
its coding style and functionality. The code style tests are executed using
106-
[Black](https://pypi.org/project/black/),
107-
[Flake8](https://pypi.org/project/flake8/), and
108-
[isort](https://pypi.org/project/isort/). The functionality tests are
109-
constructed using the [PyTest](https://pypi.org/project/pytest/) unit testing framework.
110-
111-
* To install test-suite dependencies, run `poetry install --with dev` (requires installation of [Poetry](https://python-poetry.org))
112-
* To run all tests, simply execute `poetry run tox` in the repository directory.
113-
* Individual environments can be triggered using the `-e` flag.
114-
* To test the coding style of the repository run `poetry run tox -e check`
115-
* The `py3x` environments are used to test a specific Python version; for
116-
example, to test using Python version 3.7 run `poetry run tox -e py37`
117-
118-
Tox can also be used to generate the documentation, `poetry run tox -e docs`, and to
119-
typeset the Python code, `poetry run tox -e format`.
104+
MiniZinc Python uses [uv](https://docs.astral.sh/uv/) to manage its
105+
dependencies. To install the development dependencies run `uv sync --dev`.
106+
107+
Although continuous integration will test any code, it can be convenient to run
108+
the tests locally. The following commands can be used to test the MiniZinc
109+
Python package.
110+
111+
- We use [PyTest](https://docs.pytest.org/en/stable/) to run a suite of unit
112+
tests. You can run these tests by executing:
113+
```bash
114+
uv run pytest
115+
```
116+
- We use [Ruff](https://docs.astral.sh/ruff/) to test against a range of Python
117+
style and performance guidelines. You can run the general linting using:
118+
```bash
119+
uv run ruff check
120+
```
121+
You can format the codebase to be compatible using:
122+
```bash
123+
uv run ruff format
124+
```
125+
(The continous integration will test that the code is correctly formatted using
126+
the `--check` flag.)
127+
- We use [Mypy](https://mypy.readthedocs.io/en/stable/) to check the type
128+
correctness of the codebase (for as far as possible). You can run the type
129+
checking using:
130+
```bash
131+
uv run mypy .
132+
```
120133

121134
<!-- ROADMAP -->
122135
## Roadmap

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,4 @@
194194
# -- Options for intersphinx extension ---------------------------------------
195195

196196
# Example configuration for intersphinx: refer to the Python standard library.
197-
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
197+
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}

flake.lock

-175
This file was deleted.

flake.nix

-35
This file was deleted.

0 commit comments

Comments
 (0)