Skip to content

Commit

Permalink
Switch to uv for project management
Browse files Browse the repository at this point in the history
  • Loading branch information
gerlero committed Oct 16, 2024
1 parent c9f0a5b commit a3dd64d
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@
# Cython debug symbols
**/cython_debug/

# uv
**/uv.lock

# macOS
**/.DS_Store

Expand Down
27 changes: 19 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install linting dependencies
run: |
pip install .[typing]
python-version-file: pyproject.toml
- name: Check types with mypy
run: |
mypy
uv run --extra typing mypy
test:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -70,11 +69,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Set up OpenFOAM
uses: gerlero/setup-openfoam@v1
with:
Expand All @@ -84,10 +84,10 @@ jobs:
uses: koesterlab/setup-slurm-action@v1
- name: Install test dependencies
run: |
python -m pip install .[test]
uv sync --extra test --dev
- name: Test with pytest
run: |
pytest --cov=foamlib
uv run pytest --cov=foamlib
env:
OMPI_MCA_rmaps_base_oversubscribe: 1
OMPI_ALLOW_RUN_AS_ROOT: 1
Expand All @@ -96,3 +96,14 @@ jobs:
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Check package build
run: |
uv build
23 changes: 4 additions & 19 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install needed packages
run: |
pip install --upgrade setuptools build
- name: Check version number
run: |
TAG="${GITHUB_REF#refs/tags/}"
VERSION_FROM_TAG="${TAG#v}"
PACKAGE_VERSION=$(python -c 'import setuptools; setuptools.setup()' --version)
if [ "$PACKAGE_VERSION" != "$VERSION_FROM_TAG" ]; then
echo "::error title=Version mismatch::$PACKAGE_VERSION (package version) != $VERSION_FROM_TAG (version from tag)"
exit
fi
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Build
run: |
python -m build
run: uv build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
run: uv publish
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ dmypy.json
# Cython debug symbols
cython_debug/

# uv
uv.lock

# macOS
.DS_Store

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[![Codecov](https://codecov.io/gh/gerlero/foamlib/branch/main/graph/badge.svg)](https://codecov.io/gh/gerlero/foamlib)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
[![PyPI](https://img.shields.io/pypi/v/foamlib)](https://pypi.org/project/foamlib/)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/foamlib)](https://anaconda.org/conda-forge/foamlib)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/foamlib)](https://pypi.org/project/foamlib/)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ typing = [
]
docs = [
"foamlib[numpy]",
"sphinx>=7,<9",
"sphinx>=5,<9",
"sphinx_rtd_theme",
]
dev = [
Expand Down

0 comments on commit a3dd64d

Please sign in to comment.