Skip to content

Commit 705c3a4

Browse files
committed
Migrate to uv and upgrade min Python to 3.10
Closes #1.
1 parent 5e5cf35 commit 705c3a4

23 files changed

+2072
-189
lines changed

.github/workflows/python-docs.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ jobs:
1313
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1414
steps:
1515
- uses: actions/checkout@v4
16-
- uses: actions/setup-python@v5
16+
- name: Set up Python and uv
17+
uses: astral-sh/setup-uv@v7
1718
with:
18-
python-version: "3.x"
19+
version: "0.9.26"
20+
python-version: "3.12"
1921
- name: Install dependencies
20-
run: |
21-
python -m pip install --upgrade pip
22-
python -m pip install -r requirements.txt
23-
python -m pip install sphinx sphinx_rtd_theme typing_extensions
22+
run: uv sync --locked
2423
- name: Build docs
2524
run: |
2625
cd docs

.github/workflows/python-package.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,20 @@ jobs:
99
strategy:
1010
fail-fast: false
1111
matrix:
12-
python-version: ["3.9", "3.10", "3.11", "3.12"]
12+
python-version: ["3.10", "3.11", "3.12"]
1313
steps:
1414
- uses: actions/checkout@v4
15-
- name: Set up Python ${{ matrix.python-version }}
16-
uses: actions/setup-python@v5
15+
- name: Set up Python ${{ matrix.python-version }} and uv
16+
uses: astral-sh/setup-uv@v7
1717
with:
18+
version: "0.9.26"
1819
python-version: ${{ matrix.python-version }}
19-
cache: "pip"
2020
- name: Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
python -m pip install -r requirements-test.txt
24-
- name: Lint with Ruff
25-
run: ruff check --output-format=github .
26-
- run: |
27-
mypy metafold
28-
mypy --check-untyped-defs tests/test_func.py
21+
run: uv sync --locked
22+
- run: uvx ruff check --output-format=github .
23+
- run: uv run mypy ./metafold
2924
- name: Test with pytest
30-
run: pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml
25+
run: uv run pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml ./tests
3126
- name: Upload pytest test results
3227
uses: actions/upload-artifact@v4
3328
with:

.github/workflows/python-publish.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13-
- uses: actions/setup-python@v4
13+
- name: Set up Python and uv
14+
uses: astral-sh/setup-uv@v7
1415
with:
15-
# Use latest stable version
16-
python-version: "3.x"
17-
- name: Install build dependencies
18-
run: python -m pip install --upgrade pip build
16+
version: "0.9.26"
17+
python-version: "3.12"
1918
- name: Build package
20-
run: python -m build
19+
run: uv build
2120
- uses: actions/upload-artifact@v4
2221
with:
2322
name: python-dist

.gitlab-ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
stages:
3+
- test
4+
5+
default:
6+
image: ghcr.io/astral-sh/uv:python3.12-alpine
7+
8+
lint:
9+
stage: test
10+
script:
11+
- uvx ruff check --output-format gitlab . > gl-code-quality-report.json
12+
artifacts:
13+
reports:
14+
codequality: gl-code-quality-report.json
15+
16+
type check:
17+
stage: test
18+
script:
19+
- uv run --locked mypy ./metafold
20+
21+
test:
22+
stage: test
23+
script:
24+
- uv run --locked pytest --junitxml=pytest.xml ./tests
25+
artifacts:
26+
when: always
27+
paths:
28+
- pytest.xml
29+
reports:
30+
junit: pytest.xml
31+
...

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# You can set these variables from the command line, and also
55
# from the environment for the first two.
66
SPHINXOPTS ?=
7-
SPHINXBUILD ?= sphinx-build
7+
SPHINXBUILD ?= uv run sphinx-build
88
SOURCEDIR = .
99
BUILDDIR = _build
1010

docs/make.bat

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
@ECHO OFF
2-
3-
pushd %~dp0
4-
5-
REM Command file for Sphinx documentation
6-
7-
if "%SPHINXBUILD%" == "" (
8-
set SPHINXBUILD=sphinx-build
9-
)
10-
set SOURCEDIR=.
11-
set BUILDDIR=_build
12-
13-
%SPHINXBUILD% >NUL 2>NUL
14-
if errorlevel 9009 (
15-
echo.
16-
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17-
echo.installed, then set the SPHINXBUILD environment variable to point
18-
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19-
echo.may add the Sphinx directory to PATH.
20-
echo.
21-
echo.If you don't have Sphinx installed, grab it from
22-
echo.https://www.sphinx-doc.org/
23-
exit /b 1
24-
)
25-
26-
if "%1" == "" goto help
27-
28-
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29-
goto end
30-
31-
:help
32-
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33-
34-
:end
35-
popd
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set "SPHINXBUILD=uv run sphinx-build"
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=_build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/metafold.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ metafold.jobs module
3333
:show-inheritance:
3434

3535
metafold.workflows module
36-
--------------------
36+
-------------------------
3737

3838
.. automodule:: metafold.workflows
3939
:members:

examples/lattice_infill.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import os
1515
import sys
1616

17-
Vec3: TypeAlias = [float, float, float]
17+
Vec3: TypeAlias = list[float]
1818

1919

2020
class Patch(TypedDict):

examples/run_workflow.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from multiprocessing import Pool
55
from pathlib import Path
66
from pprint import pprint
7-
from typing import Optional
87
import json
98
import os
109
import sys
@@ -13,8 +12,8 @@
1312
def run_workflow(
1413
m: MetafoldClient,
1514
definition: str,
16-
assets: Optional[dict[str, str]] = None,
17-
params: Optional[dict[str, str]] = None,
15+
assets: dict[str, str] | None = None,
16+
params: dict[str, str] | None = None,
1817
timeout: int = 5 * 60):
1918
print("Running workflow…")
2019
w = m.workflows.run(definition, assets=assets, parameters=params, timeout=timeout)

metafold/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from metafold.jobs import JobsEndpoint
55
from metafold.workflows import WorkflowsEndpoint
66
from metafold.auth import AuthProvider
7-
from typing import Optional
87

98

109
class MetafoldClient(Client):
@@ -22,10 +21,10 @@ class MetafoldClient(Client):
2221

2322
def __init__(
2423
self,
25-
access_token: Optional[str] = None,
26-
project_id: Optional[str] = None,
27-
client_id: Optional[str] = None,
28-
client_secret: Optional[str] = None,
24+
access_token: str | None = None,
25+
project_id: str | None = None,
26+
client_id: str | None = None,
27+
client_secret: str | None = None,
2928
auth_domain: str = "metafold3d.us.auth0.com",
3029
base_url: str = "https://api.metafold3d.com/",
3130
) -> None:

0 commit comments

Comments
 (0)