Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish

on:
release:
types: [ created ]

jobs:
run:
name: "Build and publish release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.8.10"

- run: uv python install 3.12
- run: uv build
- run: uv publish
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
70 changes: 24 additions & 46 deletions .github/workflows/vrplib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,68 +5,46 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [created]


jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
python-version: [ '3.10', '3.11', '3.12', '3.13' ]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Update pip and poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Cache Python dependencies
uses: actions/cache@v4
id: cache-python

- name: Install the latest version of uv
uses: astral-sh/setup-uv@v6
with:
path: ~/.cache/pypoetry
key: python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: Install Python dependencies
if: steps.cache-python.outputs.cache-hit != 'true'
run: poetry install
version: "0.8.10"
enable-cache: true

- name: Install Python version
run: uv python install ${{ matrix.python-version }}

- name: Install the project
run: uv sync

- name: Cache pre-commit
uses: actions/cache@v4
id: cache-pre-commit
with:
path: ~/.cache/pre-commit/
key: pre-commit-${{ env.pythonLocation }}-${{ hashFiles('.pre-commit-config.yaml') }}
key: pre-commit-${{ matrix.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Install pre-commit
if: steps.cache-pre-commit.outputs.cache-hit != 'true'
run: poetry run pre-commit install --install-hooks
run: uv run pre-commit install --install-hooks

- name: Run pre-commit
run: poetry run pre-commit run --all-files
- name: Run pytest
run: poetry run pytest
- uses: codecov/codecov-action@v3
run: uv run pre-commit run --all-files

- name: Run tests
run: uv run pytest

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

deploy:
needs: build
if: github.event_name == 'release' && github.event.action == 'created'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Deploy to PyPI
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry build
poetry publish
29 changes: 12 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
fail_fast: true

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: debug-statements
id: trailing-whitespace
id: end-of-file-fixer
- id: debug-statements
- id: end-of-file-fixer

- repo: https://github.com/psf/black
rev: 23.3.0
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.12.8
hooks:
- id: black
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.261'
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.17.1
hooks:
- id: ruff
args: [--fix]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.2.0
hooks:
- id: mypy
- id: mypy
20 changes: 0 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,25 +108,6 @@ Vehicle types: [1, 2, 3]
```


### Downloading from CVRPLIB

> [!WARNING]
> This functionality is deprecated and will be removed in the next major version.

``` python
import vrplib

# Download an instance and a solution file
vrplib.download_instance("X-n101-k25", "/path/to/instances/")
vrplib.download_solution("X-n101-k25", "/path/to/solutions/")

# List all instance names that can be downloaded
vrplib.list_names() # All instance names
vrplib.list_names(low=100, high=200) # Instances with between [100, 200] customers
vrplib.list_names(vrp_type="cvrp") # Only CVRP instances
vrplib.list_names(vrp_type="vrptw") # Only VRPTW instances
```


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

### Other remarks
- 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/).
- 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.
- For large instances (>5000 customers) it's recommended to set the `compute_edge_weights` argument to `False` in `read_instance`.
Loading