Skip to content

Commit b8a5c50

Browse files
committed
Migrate to uv
1 parent 8d6e015 commit b8a5c50

File tree

2 files changed

+72
-74
lines changed

2 files changed

+72
-74
lines changed

.github/workflows/vrplib.yml

Lines changed: 30 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,68 +5,52 @@ on:
55
branches: [ main ]
66
pull_request:
77
branches: [ main ]
8-
release:
9-
types: [created]
10-
118

129
jobs:
1310
build:
1411
runs-on: ubuntu-latest
1512
strategy:
1613
matrix:
17-
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
14+
python-version: [ '3.10', '3.11', '3.12', '3.13' ]
15+
steps:
1816
steps:
1917
- uses: actions/checkout@v4
20-
- name: Set up Python
21-
uses: actions/setup-python@v5
18+
19+
- name: Install the latest version of uv
20+
uses: astral-sh/setup-uv@v6
2221
with:
23-
python-version: ${{ matrix.python-version }}
24-
- name: Update pip and poetry
22+
version: "0.7.5"
23+
enable-cache: true
24+
25+
- name: Install Python version
26+
run: uv python install ${{ matrix.python-version }}
27+
28+
- name: Install the project
2529
run: |
26-
python -m pip install --upgrade pip
27-
pip install poetry
28-
- name: Cache Python dependencies
29-
uses: actions/cache@v4
30-
id: cache-python
31-
with:
32-
path: ~/.cache/pypoetry
33-
key: python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
34-
- name: Install Python dependencies
35-
if: steps.cache-python.outputs.cache-hit != 'true'
36-
run: poetry install
30+
if [ "${{ matrix.python-version }}" != "3.13" ]; then
31+
uv sync --all-extras
32+
else
33+
uv sync
34+
fi
35+
3736
- name: Cache pre-commit
38-
uses: actions/cache@v4
37+
uses: actions/cache@v3
3938
id: cache-pre-commit
4039
with:
4140
path: ~/.cache/pre-commit/
42-
key: pre-commit-${{ env.pythonLocation }}-${{ hashFiles('.pre-commit-config.yaml') }}
41+
key: pre-commit-${{ matrix.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
42+
4343
- name: Install pre-commit
4444
if: steps.cache-pre-commit.outputs.cache-hit != 'true'
45-
run: poetry run pre-commit install --install-hooks
45+
run: uv run pre-commit install --install-hooks
46+
4647
- name: Run pre-commit
47-
run: poetry run pre-commit run --all-files
48-
- name: Run pytest
49-
run: poetry run pytest
50-
- uses: codecov/codecov-action@v3
48+
run: uv run pre-commit run --all-files
49+
50+
- name: Run tests
51+
run: uv run pytest
52+
53+
- name: Upload coverage reports to Codecov
54+
uses: codecov/codecov-action@v3
5155
env:
5256
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
53-
54-
deploy:
55-
needs: build
56-
if: github.event_name == 'release' && github.event.action == 'created'
57-
runs-on: ubuntu-latest
58-
steps:
59-
- uses: actions/checkout@v4
60-
- name: Set up Python
61-
uses: actions/setup-python@v5
62-
with:
63-
python-version: 3.9
64-
- name: Install dependencies
65-
run: |
66-
python -m pip install --upgrade pip
67-
pip install poetry
68-
- name: Deploy to PyPI
69-
run: |
70-
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
71-
poetry build
72-
poetry publish

pyproject.toml

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,66 @@
1-
[tool.poetry]
1+
[project]
22
name = "vrplib"
33
version = "1.5.1"
44
description = "Python library for reading and writing VRP instances."
5-
authors = ["Leon Lan <[email protected]>"]
5+
authors = [
6+
{ name = "Leon Lan", email = "[email protected]" },
7+
]
68
license = "MIT"
9+
license-files = ["LICENSE.md"]
10+
keywords = [
11+
"vehicle routing problem",
12+
"benchmarking",
13+
]
14+
classifiers = [
15+
"Intended Audience :: Developers",
16+
"Intended Audience :: Science/Research",
17+
"Development Status :: 5 - Production/Stable",
18+
"Topic :: Software Development",
19+
"Topic :: Scientific/Engineering",
20+
"Programming Language :: Python :: 3",
21+
]
22+
requires-python = ">=3.9"
23+
dependencies = [
24+
"numpy>=1.19.3; python_version < '3.12'",
25+
"numpy>=1.26.0; python_version >= '3.12'",
26+
]
727
readme = "README.md"
828
repository = "https://github.com/PyVRP/VRPLIB"
929

10-
[tool.poetry.dependencies]
11-
python = "^3.9"
12-
numpy = ">=1.19.3"
1330

14-
[tool.poetry.group.dev.dependencies]
15-
pytest = "^7.1.2"
16-
codecov = "^2.1.13"
17-
pytest-cov = "^4.0.0"
18-
pre-commit = "^2.19.0"
31+
[project.urls]
32+
source = "https://github.com/PyVRP/VRPLIB"
33+
issues = "https://github.com/PyVRP/VRPLIB/issues"
1934

20-
[build-system]
21-
requires = ["poetry-core>=1.0.0"]
22-
build-backend = "poetry.core.masonry.api"
2335

24-
[tool.black]
25-
line-length = 79
36+
[dependency-groups]
37+
dev = [
38+
"pre-commit>=2.20.0",
39+
"pytest>=7.1.2",
40+
"pytest-cov>=6.1.1",
41+
"codecov",
42+
]
2643

27-
[tool.mypy]
28-
ignore_missing_imports = true
2944

3045
[tool.ruff]
46+
line-length = 79
47+
48+
49+
[tool.ruff.lint]
3150
select = [
32-
"E", # pycodestyle errors
33-
"W", # pycodestyle warnings
34-
"F", # pyflakes
35-
"I", # isort
36-
"C", # flake8-comprehensions
37-
]
38-
ignore = [
39-
"E501", # line too long, handled by black
40-
"C901", # too complex
51+
"E", "F", "I", "NPY", "PYI", "Q", "RET", "RSE", "RUF", "SLF", "SIM", "TC"
4152
]
4253

43-
[tool.ruff.per-file-ignores]
44-
"__init__.py" = ["F401"]
54+
55+
[tool.mypy]
56+
ignore_missing_imports = true
57+
4558

4659
[tool.pytest.ini_options]
4760
addopts = "--cov=. --cov-report=xml"
4861
pythonpath = [".", "vrplib"]
4962

63+
5064
[tool.coverage.run]
5165
omit = [
5266
"tests/*",

0 commit comments

Comments
 (0)