Skip to content

Commit ec31d04

Browse files
authored
Migrate Poetry to UV (#13)
1 parent 75b2d18 commit ec31d04

3 files changed

Lines changed: 98 additions & 52 deletions

File tree

.github/workflows/CI.yml

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,46 +8,39 @@ on:
88

99
jobs:
1010
build:
11-
name: 'Build and test fjsplib using ${{ matrix.python-version }}'
11+
name: Test fjsplib using Python ${{ matrix.python-version }}
1212
runs-on: ubuntu-latest
1313
strategy:
1414
fail-fast: true
1515
matrix:
16-
python-version: ['3.9', '3.12']
16+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.12']
1717
steps:
1818
- uses: actions/checkout@v4
19-
- uses: actions/setup-python@v5
20-
with:
21-
python-version: ${{ matrix.python-version }}
22-
- name: Update pip and poetry
23-
run: |
24-
python -m pip install --upgrade pip
25-
pip install poetry
26-
- name: Cache Python dependencies
27-
uses: actions/cache@v4
28-
id: cache-python
19+
20+
- name: Install the latest version of uv
21+
uses: astral-sh/setup-uv@v3
2922
with:
30-
path: ~/.cache/pypoetry
31-
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
32-
- name: Install Python dependencies
33-
if: steps.cache-python.outputs.cache-hit != 'true'
34-
run: poetry install
23+
version: "0.4.27"
24+
25+
- name: Install Python version
26+
run: uv python install ${{ matrix.python-version }}
27+
28+
- name: Install the project
29+
run: uv sync
30+
3531
- name: Cache pre-commit
36-
uses: actions/cache@v4
32+
uses: actions/cache@v3
3733
id: cache-pre-commit
3834
with:
3935
path: ~/.cache/pre-commit/
40-
key: pre-commit-${{ env.pythonLocation }}-${{ hashFiles('.pre-commit-config.yaml') }}
36+
key: pre-commit-${{ matrix.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
37+
4138
- name: Install pre-commit
4239
if: steps.cache-pre-commit.outputs.cache-hit != 'true'
43-
run: poetry run pre-commit install --install-hooks
40+
run: uv run pre-commit install --install-hooks
41+
4442
- name: Run pre-commit
45-
run: poetry run pre-commit run --all-files
43+
run: uv run pre-commit run --all-files
44+
4645
- name: Run tests
47-
run: poetry run pytest
48-
- if: matrix.python-version == '3.9'
49-
name: Upload coverage reports to Codecov
50-
uses: codecov/codecov-action@v4.0.1
51-
env:
52-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
53-
slug: leonlan/FJSPLIB
46+
run: uv run pytest

.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.4.27"
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 }}

pyproject.toml

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,79 @@
1-
[tool.poetry]
1+
[project]
22
name = "fjsplib"
33
version = "0.0.1"
44
description = "Python package to read and write FJSP instances."
5-
authors = ["Leon Lan <leon.lanyidong@gmail.com>"]
6-
license = "MIT"
5+
authors = [
6+
{ name = "Leon Lan", email = "l.lan@vu.nl"},
7+
]
8+
license = { text = "MIT License" }
79
readme = "README.md"
8-
repository = "https://github.com/leonlan/FJSPLIB"
10+
keywords = [
11+
"scheduling",
12+
"flexible job shop scheduling",
13+
"fjsp",
14+
]
15+
classifiers = [
16+
"Intended Audience :: Developers",
17+
"Intended Audience :: Science/Research",
18+
"Development Status :: 5 - Production/Stable",
19+
"Topic :: Software Development",
20+
"Topic :: Scientific/Engineering",
21+
"License :: OSI Approved :: MIT License",
22+
"Programming Language :: Python :: 3",
23+
]
24+
requires-python = ">=3.9"
25+
dependencies = [
26+
"numpy>=1.26.0",
27+
]
928

10-
[tool.poetry.dependencies]
11-
python = "^3.9"
12-
numpy = "^1.26.4"
1329

14-
[tool.poetry.group.dev.dependencies]
15-
pre-commit = "^2.19.0"
16-
pytest = "^7.1.2"
17-
pytest-cov = ">=2.6.1"
30+
[project.urls]
31+
Repository = "https://github.com/PyJobShop/FJSPLIB"
1832

1933

20-
[tool.black]
21-
line-length = 79
34+
[dependency-groups]
35+
dev = [
36+
"pre-commit>=3.8.0",
37+
"pytest>=8.3.2",
38+
]
39+
40+
41+
[tool.uv]
42+
default-groups = ["dev"]
2243

2344

2445
[tool.mypy]
2546
ignore_missing_imports = true
2647

2748

49+
[tool.black]
50+
line-length = 79
51+
52+
2853
[tool.ruff]
2954
line-length = 79
55+
extend-include = ["*.ipynb"]
56+
3057

3158
[tool.ruff.lint]
32-
ignore-init-module-imports = true
3359
select = [
34-
"E", "F", "I", "NPY", "PYI", "Q", "RET", "RSE", "RUF", "SLF", "SIM", "TCH"
60+
"E", # pycodestyle errors
61+
"W", # pycodestyle warnings
62+
"F", # pyflakes
63+
"I", # isort
64+
"C", # flake8-comprehensions
65+
"B", # flake8-bugbear
66+
]
67+
ignore = [
68+
"E741", # ambiguous variable name, needed for indexing
69+
"C901", # too complex
3570
]
36-
37-
[tool.ruff.lint.isort]
38-
case-sensitive = true
39-
known-first-party = ["fjsplib", "tests"]
4071

4172

42-
[tool.pytest.ini_options]
43-
addopts = "--cov=. --cov-report=xml --cov-report=term"
44-
testpaths = "tests"
73+
[tool.ruff.lint.per-file-ignores]
74+
"__init__.py" = ["F401"] # ignore unused module imports
4575

4676

4777
[build-system]
48-
requires = ["poetry-core"]
49-
build-backend = "poetry.core.masonry.api"
78+
requires = ["hatchling"]
79+
build-backend = "hatchling.build"

0 commit comments

Comments
 (0)