Skip to content

Commit

Permalink
replace poetry with uv (#872)
Browse files Browse the repository at this point in the history
* add log message

* move to uv

* update lint sections

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update urls

* update tests to use uv

* updates

* add h5py

* build documentation test in CI

* update rtd to use uv

* add `dvc-s3`

* add sphinx

* add furo

* add docs packages

* install pandoc

* use sudo

* add publish action

* add missing sections

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
PythonFZ and pre-commit-ci[bot] authored Jan 28, 2025
1 parent 44e484c commit a96b871
Show file tree
Hide file tree
Showing 9 changed files with 4,156 additions and 6,880 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Release
on:
release:
types:
- created

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
uv build
uv publish --token $PYPI_TOKEN
72 changes: 33 additions & 39 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.13"
- "3.12"
- "3.11"
- "3.10"
- 3.9
os:
- ubuntu-latest

Expand Down Expand Up @@ -49,31 +49,24 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install package
run: |
poetry run pip install aim
poetry install --no-interaction
- name: Install the project
run: uv sync --all-extras --dev
- name: Setup git user
run: |
git config --global user.name "John Doe"
git config --global user.email [email protected]
git config --global init.defaultBranch "main"
- name: Pytest
run: |
poetry run python --version
poetry run coverage run -m pytest --benchmark-autosave -vv
poetry run coverage xml
poetry run coverage lcov
poetry run py.test-benchmark compare --csv=export.csv
uv run python --version
uv run coverage run -m pytest --benchmark-autosave -vv
uv run coverage xml
uv run coverage lcov
uv run py.test-benchmark compare --csv=export.csv
- name: Coveralls
uses: coverallsapp/github-action@master
with:
Expand Down Expand Up @@ -110,25 +103,26 @@ jobs:
# run: |
# poetry run pytest --nbmake ./examples

# doctest:
# runs-on: ubuntu-latest
# needs: [ pytest, nbtest ]
# steps:
# - uses: actions/checkout@v2
# - name: Set up Python 3.11
# uses: actions/setup-python@v4
# with:
# python-version: "3.11"
# - name: Install Poetry
# uses: snok/install-poetry@v1
# with:
# virtualenvs-create: true
# virtualenvs-in-project: true
# - name: Install package
# run: |
# sudo apt install pandoc
# poetry install --with=docs
# - name: Build documentation
# run: |
# cd ./docs
# poetry run make html
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: "3.12"
- name: Install the project
run: uv sync --all-extras --dev
- name: Install pandoc
run: |
sudo apt update
sudo apt install pandoc
- name: Setup git user
run: |
git config --global user.name "John Doe"
git config --global user.email [email protected]
git config --global init.defaultBranch "main"
- name: Build documentation
run: |
cd docs
uv run make html
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
12 changes: 3 additions & 9 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,10 @@ build:
tools:
python: "3.11"
jobs:
post_create_environment:
# Install poetry
# https://python-poetry.org/docs/#installing-manually
- pip install poetry
post_install:
# Install dependencies with 'docs' dependency group
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
# VIRTUAL_ENV needs to be set manually for now.
# See https://github.com/readthedocs/readthedocs.org/pull/11152/
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs
# see https://github.com/astral-sh/uv/issues/10074
- pip install uv
- UV_PROJECT_ENVIRONMENT=$READTHEDOCS_VIRTUALENV_PATH uv sync --all-extras --group docs --link-mode=copy

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
6,779 changes: 0 additions & 6,779 deletions poetry.lock

This file was deleted.

91 changes: 40 additions & 51 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,64 +1,53 @@
[tool.poetry]
[project]
name = "zntrack"
version = "0.8.2"
description = "Create, Run and Benchmark DVC Pipelines in Python"
authors = ["zincwarecode <[email protected]>"]
authors = [
{ name = "Fabian Zills", email = "[email protected]" },
]
license = "Apache-2.0"
keywords=["data-science", "data-version-control", "machine-learning", "reproducibility", "collaboration"]
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"dvc>=3.59.0",
"pandas>=2.2.3",
"pyyaml>=6.0.2",
"tqdm>=4.67.1",
"typer>=0.15.1",
"znfields>=0.1.2",
"znflow>=0.2.4",
"znjson>=0.2.6",
]

[project.scripts]
zntrack = 'zntrack.cli:app'

[project.urls]
Repository = "https://github.com/zincware/zntrack"
Releases = "https://github.com/zincware/zntrack/releases"
Documentation = "https://zntrack.readthedocs.io"

[dependency-groups]
dev = [
"coverage>=7.6.10",
"dvc-s3>=3.2.0",
"furo>=2024.8.6",
"h5py>=3.12.1",
"mlflow>=2.20.0",
"nbsphinx>=0.9.6",
"nbsphinx-link>=1.3.1",
"pytest>=8.3.4",
"pytest-benchmark>=5.1.0",
"sphinx>=8.1.3",
"sphinx-copybutton>=0.5.2",
]

[tool.poetry.dependencies]
python = ">=3.10,<4"
dvc = "^3.50"
pyyaml = "^6"
tqdm = "^4"

znjson = "^0.2"
znflow = "^0.2.3"
typer = "^0.13"
znfields = "^0.1.2"
pandas = "^2"


[tool.poetry.urls]
documentation = "https://zntrack.readthedocs.io"
repository = "https://github.com/zincware/ZnTrack"


[tool.poetry.scripts]
zntrack = "zntrack.cli:app"

[tool.poetry.group.dev.dependencies]
pytest-benchmark = "^3"
pytest = "^7"
numpy = "^1"
matplotlib = "^3"
ase = "^3"
pre-commit = "^2"
coverage = "^6"
pytest-xdist = "^2"
optuna = "^3"
scikit-learn = "^1"
nbmake = "^1"
mlflow = "^2.16"
dvc-s3 = "^3.2.0"
h5py = "^3"

[tool.poetry.group.notebook.dependencies]
jupyterlab = "^3"

[tool.poetry.group.docs.dependencies]
furo = "^2022"
sphinx-copybutton = "^0.5"
sphinx = "^6"
nbsphinx = "^0.8"
nbsphinx-link = "^1"

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

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.black]
line-length = 90
Expand Down
Loading

0 comments on commit a96b871

Please sign in to comment.