Skip to content

Commit

Permalink
migrate to uv (#164)
Browse files Browse the repository at this point in the history
* migrate to `uv`

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

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

* move actions to uv

* bump version

---------

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 Feb 7, 2025
1 parent ed78db8 commit 229ad9e
Show file tree
Hide file tree
Showing 9 changed files with 1,393 additions and 1,867 deletions.
17 changes: 5 additions & 12 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
- uses: actions/setup-node@v1
with:
node-version: '16'
- uses: iterative/setup-cml@v1
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install package
run: |
poetry install --no-interaction
uv sync --all-extras --dev
- name: Run pytest
run: |
poetry run python --version
poetry run pytest --benchmark-histogram benchmark -m benchmark
uv run python --version
uv run pytest --benchmark-histogram benchmark -m benchmark
- name: Create report
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: build frontend
run: |
npm install -g bun
cd app && bun install && bun vite build && cd ..
- name: Publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build
uv build
uv publish --token $PYPI_TOKEN
18 changes: 7 additions & 11 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.13"
- "3.12"
- "3.11"
- "3.10"
Expand All @@ -23,23 +24,18 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- 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 install --no-interaction
uv sync --all-extras --dev
- name: Run pytest
run: |
poetry run python --version
poetry run coverage run -m pytest
poetry run coverage lcov
uv run python --version
uv run coverage run -m pytest
uv run coverage lcov
- name: Coveralls
uses: coverallsapp/github-action@master
with:
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
1,799 changes: 0 additions & 1,799 deletions poetry.lock

This file was deleted.

70 changes: 37 additions & 33 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,42 +1,31 @@
[tool.poetry]
[project]
name = "znh5md"
version = "0.4.3"
version = "0.4.4"
description = "ASE Interface for the H5MD format."
authors = ["zincwarecode <[email protected]>"]
authors = [
{ name = "Fabian Zills", email = "[email protected]" },
]
license = "Apache-2.0"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"ase>=3.24.0",
"h5py>=3.12.1",
"tqdm>=4.67.1",
"typer>=0.15.1",
]

[tool.poetry.dependencies]
python = "^3.10"
h5py = "^3"
ase = "^3.23"
tqdm = "^4"
typer = {extras = ["all"], version = "^0"}

[tool.poetry.group.dev.dependencies]
pytest = "^7.2.0"
pre-commit = "^2.20.0"
ruff = "^0.4"
mdanalysis = "^2.8"
coverage = "^7.5.3"
pyh5md = "^1.0.0"
pytest-benchmark = {extras = ["histogram"], version = "^4.0.0"}
networkx = "^3.3"
rdkit2ase = "^0.1.4"


[tool.poetry.group.benchmark.dependencies]
pandas = "^2.2.2"
chemfiles = "^0.10.4"
mdtraj = "^1.10.0"

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

[tool.poetry.scripts]
znh5md = 'znh5md.cli:app'
[project.scripts]
znh5md = "znh5md.cli:app"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[project.urls]
Repository = "https://github.com/zincware/ZnH5MD"
Releases = "https://github.com/zincware/ZnH5MD/releases"
Discord = "https://discord.gg/7ncfwhsnm4"

[tool.ruff.lint]
select = ["E", "F", "N", "C", "I"]
Expand All @@ -50,5 +39,20 @@ skip = "poetry.lock,*.ipynb"
[tool.pytest.ini_options]
addopts = "-m 'not benchmark'"

[tool.poetry.plugins."ase.ioformats"]
[dependency-groups]
dev = [
"chemfiles>=0.10.4",
"coverage>=7.6.10",
"mdanalysis>=2.8.0",
"mdtraj>=1.10.2",
"networkx>=3.4.2",
"numpy<2",
"pandas>=2.2.3",
"pyh5md>=1.0.0",
"pytest>=8.3.4",
"pytest-benchmark[histogram]>=5.1.0",
"rdkit2ase>=0.1.4",
]

[project.entry-points."ase.ioformats"]
znh5md = "znh5md.ase_plugin:znh5md_format"
9 changes: 5 additions & 4 deletions tests/test_timestep.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import warnings

import ase.build
import pytest

import znh5md

Expand Down Expand Up @@ -69,7 +70,7 @@ def test_no_warn_correct(tmp_path):
atoms = ase.build.molecule("H2O")

# Ensure no warning is issued
with pytest.warns(None) as record:
# https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests
with warnings.catch_warnings():
warnings.simplefilter("error")
io.append(atoms)

assert len(record) == 0
2 changes: 1 addition & 1 deletion tests/test_znh5md.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


def test_version():
assert znh5md.__version__ == "0.4.3"
assert znh5md.__version__ == "0.4.4"


def test_creator(tmp_path):
Expand Down
Loading

0 comments on commit 229ad9e

Please sign in to comment.