Skip to content

Commit 442c486

Browse files
authored
Migrate to uv, drop Python 3.9, remove download functionality (#129)
1 parent 8d6e015 commit 442c486

34 files changed

+162
-1962
lines changed

.github/workflows/publish.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [ created ]
6+
7+
jobs:
8+
run:
9+
name: "Build and publish release"
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Install uv
15+
uses: astral-sh/setup-uv@v3
16+
with:
17+
version: "0.8.10"
18+
19+
- run: uv python install 3.12
20+
- run: uv build
21+
- run: uv publish
22+
env:
23+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/vrplib.yml

Lines changed: 24 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,68 +5,46 @@ 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' ]
1815
steps:
1916
- uses: actions/checkout@v4
20-
- name: Set up Python
21-
uses: actions/setup-python@v5
22-
with:
23-
python-version: ${{ matrix.python-version }}
24-
- name: Update pip and poetry
25-
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
17+
18+
- name: Install the latest version of uv
19+
uses: astral-sh/setup-uv@v6
3120
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
21+
version: "0.8.10"
22+
enable-cache: true
23+
24+
- name: Install Python version
25+
run: uv python install ${{ matrix.python-version }}
26+
27+
- name: Install the project
28+
run: uv sync
29+
3730
- name: Cache pre-commit
3831
uses: actions/cache@v4
3932
id: cache-pre-commit
4033
with:
4134
path: ~/.cache/pre-commit/
42-
key: pre-commit-${{ env.pythonLocation }}-${{ hashFiles('.pre-commit-config.yaml') }}
35+
key: pre-commit-${{ matrix.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
36+
4337
- name: Install pre-commit
4438
if: steps.cache-pre-commit.outputs.cache-hit != 'true'
45-
run: poetry run pre-commit install --install-hooks
39+
run: uv run pre-commit install --install-hooks
40+
4641
- 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
42+
run: uv run pre-commit run --all-files
43+
44+
- name: Run tests
45+
run: uv run pytest
46+
47+
- name: Upload coverage reports to Codecov
48+
uses: codecov/codecov-action@v3
5149
env:
5250
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

.pre-commit-config.yaml

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
fail_fast: true
22

33
repos:
4-
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.4.0
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v6.0.0
66
hooks:
7-
- id: debug-statements
8-
id: trailing-whitespace
9-
id: end-of-file-fixer
7+
- id: debug-statements
8+
- id: end-of-file-fixer
109

11-
- repo: https://github.com/psf/black
12-
rev: 23.3.0
10+
- repo: https://github.com/charliermarsh/ruff-pre-commit
11+
rev: v0.12.8
1312
hooks:
14-
- id: black
13+
- id: ruff
14+
args: [--fix, --exit-non-zero-on-fix]
15+
- id: ruff-format
1516

16-
- repo: https://github.com/charliermarsh/ruff-pre-commit
17-
rev: 'v0.0.261'
17+
- repo: https://github.com/pre-commit/mirrors-mypy
18+
rev: v1.17.1
1819
hooks:
19-
- id: ruff
20-
args: [--fix]
21-
22-
- repo: https://github.com/pre-commit/mirrors-mypy
23-
rev: v1.2.0
24-
hooks:
25-
- id: mypy
20+
- id: mypy

README.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -108,25 +108,6 @@ Vehicle types: [1, 2, 3]
108108
```
109109

110110

111-
### Downloading from CVRPLIB
112-
113-
> [!WARNING]
114-
> This functionality is deprecated and will be removed in the next major version.
115-
116-
``` python
117-
import vrplib
118-
119-
# Download an instance and a solution file
120-
vrplib.download_instance("X-n101-k25", "/path/to/instances/")
121-
vrplib.download_solution("X-n101-k25", "/path/to/solutions/")
122-
123-
# List all instance names that can be downloaded
124-
vrplib.list_names() # All instance names
125-
vrplib.list_names(low=100, high=200) # Instances with between [100, 200] customers
126-
vrplib.list_names(vrp_type="cvrp") # Only CVRP instances
127-
vrplib.list_names(vrp_type="vrptw") # Only VRPTW instances
128-
```
129-
130111

131112
## Documentation
132113
- [VRPLIB instance format](#vrplib-instance-format)
@@ -246,6 +227,5 @@ Reading the above example solution returns the following dictionary:
246227
```
247228

248229
### Other remarks
249-
- The `XML100` benchmark set is not listed in `list_names` and cannot be downloaded through this package. You can download these instances directly from [CVRPLIB](http://vrp.atd-lab.inf.puc-rio.br/index.php/en/).
250230
- In the literature, some instances use rounding conventions different from what is specified in the instance. For example, X instance set proposed by [Uchoa et al. (2017)](http://vrp.atd-lab.inf.puc-rio.br/index.php/en/new-instances) assumes that the distances are rounded to the nearest integer. When you use the `vrplib` package to read this instance, it will return non-rounded Euclidean distances because the instance specifies the `EUC_2D` edge weight type which implies no rounding. To adhere to the convention used in the literature, you can manually round the distances matrix.
251231
- For large instances (>5000 customers) it's recommended to set the `compute_edge_weights` argument to `False` in `read_instance`.

0 commit comments

Comments
 (0)