From 0fc4217d39bcedbf2cd1f85a55bd7e474dc83a05 Mon Sep 17 00:00:00 2001 From: Leon Lan Date: Wed, 6 Nov 2024 09:57:22 +0100 Subject: [PATCH 1/3] Update pyproject.toml --- pyproject.toml | 78 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 54 insertions(+), 24 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7f24a57..70ada9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,49 +1,79 @@ -[tool.poetry] +[project] name = "fjsplib" version = "0.0.1" description = "Python package to read and write FJSP instances." -authors = ["Leon Lan "] -license = "MIT" +authors = [ + { name = "Leon Lan", email = "l.lan@vu.nl"}, +] +license = { text = "MIT License" } readme = "README.md" -repository = "https://github.com/leonlan/FJSPLIB" +keywords = [ + "scheduling", + "flexible job shop scheduling", + "fjsp", +] +classifiers = [ + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Development Status :: 5 - Production/Stable", + "Topic :: Software Development", + "Topic :: Scientific/Engineering", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", +] +requires-python = ">=3.9" +dependencies = [ + "numpy>=1.26.0", +] -[tool.poetry.dependencies] -python = "^3.9" -numpy = "^1.26.4" -[tool.poetry.group.dev.dependencies] -pre-commit = "^2.19.0" -pytest = "^7.1.2" -pytest-cov = ">=2.6.1" +[project.urls] +Repository = "https://github.com/PyJobShop/FJSPLIB" -[tool.black] -line-length = 79 +[dependency-groups] +dev = [ + "pre-commit>=3.8.0", + "pytest>=8.3.2", +] + + +[tool.uv] +default-groups = ["dev"] [tool.mypy] ignore_missing_imports = true +[tool.black] +line-length = 79 + + [tool.ruff] line-length = 79 +extend-include = ["*.ipynb"] + [tool.ruff.lint] -ignore-init-module-imports = true select = [ - "E", "F", "I", "NPY", "PYI", "Q", "RET", "RSE", "RUF", "SLF", "SIM", "TCH" + "E", # pycodestyle errors + "W", # pycodestyle warnings + "F", # pyflakes + "I", # isort + "C", # flake8-comprehensions + "B", # flake8-bugbear +] +ignore = [ + "E741", # ambiguous variable name, needed for indexing + "C901", # too complex ] - -[tool.ruff.lint.isort] -case-sensitive = true -known-first-party = ["fjsplib", "tests"] -[tool.pytest.ini_options] -addopts = "--cov=. --cov-report=xml --cov-report=term" -testpaths = "tests" +[tool.ruff.lint.per-file-ignores] +"__init__.py" = ["F401"] # ignore unused module imports [build-system] -requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" +requires = ["setuptools >= 61.0"] +build-backend = "setuptools.build_meta" From a000d200001be06ee0fe911732eb81d95a04a078 Mon Sep 17 00:00:00 2001 From: Leon Lan Date: Wed, 6 Nov 2024 09:57:29 +0100 Subject: [PATCH 2/3] Update workflows --- .github/workflows/CI.yml | 49 +++++++++++++++-------------------- .github/workflows/publish.yml | 23 ++++++++++++++++ 2 files changed, 44 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ef34f6a..0c959f4 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -8,46 +8,39 @@ on: jobs: build: - name: 'Build and test fjsplib using ${{ matrix.python-version }}' + name: Test fjsplib using Python ${{ matrix.python-version }} runs-on: ubuntu-latest strategy: fail-fast: true matrix: - python-version: ['3.9', '3.12'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.12'] steps: - uses: actions/checkout@v4 - - 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@v3 with: - path: ~/.cache/pypoetry - key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }} - - name: Install Python dependencies - if: steps.cache-python.outputs.cache-hit != 'true' - run: poetry install + version: "0.4.27" + + - 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 + uses: actions/cache@v3 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 + run: uv run pre-commit run --all-files + - name: Run tests - run: poetry run pytest - - if: matrix.python-version == '3.9' - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4.0.1 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - slug: leonlan/FJSPLIB + run: uv run pytest diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..6526d7a --- /dev/null +++ b/.github/workflows/publish.yml @@ -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.4.27" + + - run: uv python install 3.12 + - run: uv build + - run: uv publish + env: + UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }} From ba522f4c1e564033c4a78c18b925d6d666c1e022 Mon Sep 17 00:00:00 2001 From: Leon Lan Date: Wed, 6 Nov 2024 09:59:09 +0100 Subject: [PATCH 3/3] Use hatchling instead --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 70ada9c..b59c482 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,5 +75,5 @@ ignore = [ [build-system] -requires = ["setuptools >= 61.0"] -build-backend = "setuptools.build_meta" +requires = ["hatchling"] +build-backend = "hatchling.build"