Skip to content

Commit

Permalink
Use uv (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasturcani authored Nov 14, 2024
1 parent ed73045 commit 5f8768c
Show file tree
Hide file tree
Showing 6 changed files with 802 additions and 42 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/publish_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@ jobs:
VERSION: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- run: pip install -e '.[dev]'
- run: python -m build
- run:
twine upload
-u __token__
-p ${{ secrets.PYPI_API_TOKEN }}
dist/*
python-version-file: "pyproject.toml"
- run: uv publish
60 changes: 36 additions & 24 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,55 @@ jobs:
ruff:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
with:
python-version: "3.11"
cache: "pip"
- run: "pip install -e '.[dev]'"
- run: ruff check src/ tests/
enable-cache: true
cache-dependency-glob: "uv.lock"
- uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- run: uv sync --all-extras --dev
- run: uv run ruff check src/ tests/

mypy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- run: "pip install -e '.[dev]'"
- run: mypy src/ tests/
python-version-file: "pyproject.toml"
- run: uv sync --all-extras --dev
- run: uv run mypy src/ tests/

ruff-format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
with:
python-version: "3.11"
cache: "pip"
- run: "pip install -e '.[dev]'"
- run: ruff format --check src/ tests/
enable-cache: true
cache-dependency-glob: "uv.lock"
- uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- run: uv sync --all-extras --dev
- run: uv run ruff format --check src/ tests/

examples:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- run: "pip install -e '.[dev]'"
- run: make -C tests html
python-version-file: "pyproject.toml"
- run: uv sync --all-extras --dev
- run: uv run make -C tests html
10 changes: 5 additions & 5 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ default:

# Do a dev install.
dev:
pip install -e '.[dev]'
uv sync --all-extras --dev

# Run code checks.
check:
Expand All @@ -14,19 +14,19 @@ check:
trap error=1 ERR

echo
(set -x; ruff check src/ tests/ )
(set -x; uv run ruff check src/ tests/ )
test $? = 0

echo
( set -x; ruff format --check src/ tests/ )
( set -x; uv run ruff format --check src/ tests/ )
test $? = 0

echo
( set -x; mypy src/ tests/ )
( set -x; uv run mypy src/ tests/ )
test $? = 0

echo
( set -x; make -C tests html )
( set -x; uv run make -C tests html )
test $? = 0

test $error = 0
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ maintainers = [
dependencies = [
"sphinx",
]
requires-python = ">=3.10"
requires-python = ">=3.12"
dynamic = ["version"]
readme = "README.rst"
description = "Make better chemistry documentation!"

[project.optional-dependencies]
[dependency-groups]
dev = [
"ruff",
"mypy",
Expand Down
3 changes: 1 addition & 2 deletions src/moldoc/_internal/molecule.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from collections.abc import Iterable
from typing import TypeAlias


class Color:
Expand Down Expand Up @@ -162,7 +161,7 @@ def get_flat_shading(self) -> bool | None:
return self._flat_shading


Material: TypeAlias = (
type Material = (
MeshLambertMaterial
| MeshNormalMaterial
| MeshPhongMaterial
Expand Down
Loading

0 comments on commit 5f8768c

Please sign in to comment.