Skip to content

Use uv with flit-core backend #970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
- package-ecosystem: "uv" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: 3.x

# TODO uv (uv sync --locked --no-dev --group docs)
- run: pip install flit
- run: flit install --only-deps --deps develop
- run: mkdocs gh-deploy --force
2 changes: 2 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

# TODO uv
- name: Set up Python
uses: actions/setup-python@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/run-codspeed-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
- name: Check out repository code
uses: actions/checkout@v3

# TODO uv
- name: Install dependencies
run: |
apt update
Expand Down
35 changes: 26 additions & 9 deletions .github/workflows/run-linting-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,34 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2

- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
# It is considered best practice to pin to a specific uv version.
version: "0.7.13"
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flit
flit install --deps develop --symlink

- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Check with mypy
run: |
mypy .
run: uv run mypy .

# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.python-version }}
#
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install flit
# flit install --deps develop --symlink
#
# - name: Check with mypy
# run: |
# mypy .

- name: Run remaining pre-commit hooks
uses: pre-commit/action@v3.0.1
47 changes: 33 additions & 14 deletions .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
python-version: ['3.11', '3.12', '3.13']
postgres-version: ['15', '16', '17']
fail-fast: false
container: python:${{ matrix.python-version }}-slim
# container: python:${{ matrix.python-version }}-slim
services:
postgres:
image: postgres:${{ matrix.postgres-version }}-alpine
Expand All @@ -38,28 +38,47 @@ jobs:
--health-timeout 5s
--health-retries 5
steps:
# Downloads a copy of the code in your repository before running CI tests
- name: Check out repository code
uses: actions/checkout@v3

- name: Install dependencies
run: |
apt update
apt install curl git build-essential libpq-dev libffi-dev -y
python -m pip install --upgrade pip
pip install flit
flit install --deps develop --symlink
echo "GIT_COMMIT_HASH=\"test\"" > orchestrator/version.py
env:
FLIT_ROOT_INSTALL: 1
- name: Run Unit tests
run: CACHE_URI=redis://redis DATABASE_URI=postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB pytest --cov-branch --cov=orchestrator --cov-report=xml --ignore=test --ignore=orchestrator/devtools --ignore=examples --ignore=docs --ignore=orchestrator/vendor
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
# It is considered best practice to pin to a specific uv version.
version: "0.7.13"
python-version: ${{ matrix.python-version }}

- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Run tests
run: CACHE_URI=redis://redis DATABASE_URI=postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB uv run pytest --cov-branch --cov=orchestrator --cov-report=xml --ignore=test --ignore=orchestrator/devtools --ignore=examples --ignore=docs
env:
POSTGRES_DB: orchestrator-core-test
POSTGRES_USER: nwa
POSTGRES_PASSWORD: nwa
POSTGRES_HOST: postgres
ENVIRONMENT: TESTING

# - name: Install dependencies
# run: |
# apt update
# apt install curl git build-essential libpq-dev libffi-dev -y
# python -m pip install --upgrade pip
# pip install flit
# flit install --deps develop --symlink
# echo "GIT_COMMIT_HASH=\"test\"" > orchestrator/version.py
# env:
# FLIT_ROOT_INSTALL: 1

# - name: Run Unit tests
# run: CACHE_URI=redis://redis DATABASE_URI=postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB pytest --cov-branch --cov=orchestrator --cov-report=xml --ignore=test --ignore=orchestrator/devtools --ignore=examples --ignore=docs --ignore=orchestrator/vendor
# env:
# POSTGRES_DB: orchestrator-core-test
# POSTGRES_USER: nwa
# POSTGRES_PASSWORD: nwa
# POSTGRES_HOST: postgres
# ENVIRONMENT: TESTING
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v3
with:
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends git build-essential \
&& rm -rf /var/lib/apt/lists/*
COPY . .
# TODO uv
RUN pip install --upgrade pip --no-cache-dir
RUN pip install build --no-cache-dir
RUN python -m build --wheel --outdir dist
Expand Down
179 changes: 89 additions & 90 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,143 +1,142 @@
# See: https://stackoverflow.com/questions/69711606/how-to-install-a-package-using-pip-in-editable-mode-with-pyproject-toml
[build-system]
build-backend = "flit_core.buildapi"
requires = ["flit_core >=3.2,<4"]

[project]
name = "orchestrator-core"
dynamic = ['version', 'description']
author = "SURF"
author-email = "automation-beheer@surf.nl"
home-page = "https://github.com/workfloworchestrator/orchestrator-core"
dynamic = ["version", "description"]
readme = "README.md"
license = "Apache-2.0"
license-files = ["LICENSE"]
authors = [
{ name = "SURF", email = "automation-beheer@surf.nl" }
]
requires-python = ">=3.11,<3.14"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: AsyncIO",
"Framework :: FastAPI",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"Intended Audience :: Telecommunications Industry",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development",
"Typing :: Typed",
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: AsyncIO",
"Framework :: FastAPI",
"Intended Audience :: Developers",
"Intended Audience :: Telecommunications Industry",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.11",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Internet :: WWW/HTTP",
]
dependencies = [
"alembic==1.16.1",
"anyio>=3.7.0",
"click==8.*",
"deprecated",
"deepmerge==2.0",
"deprecated>=1.2.18",
"fastapi~=0.115.2",
"fastapi-etag==0.4.0",
"itsdangerous>=2.2.0",
"jinja2==3.1.6",
"more-itertools~=10.7.0",
"itsdangerous",
"Jinja2==3.1.6",
"nwa-stdlib~=1.9.0",
"oauth2-lib~=2.4.0",
"orjson==3.10.18",
"prometheus-client==0.22.0",
"psycopg2-binary==2.9.10",
"pydantic[email]~=2.8.2",
"pydantic-forms>=1.4.0,<=2.1.0",
"pydantic-settings~=2.9.1",
"pydantic[email]~=2.8.2",
"python-dateutil==2.8.2",
"python-rapidjson>=1.18,<1.21",
"pytz==2025.2",
"redis==5.1.1",
"schedule==1.1.0",
"semver==3.0.4",
"sentry-sdk[fastapi]~=2.29.1",
"SQLAlchemy==2.0.41",
"SQLAlchemy-Utils==0.41.2",
"structlog",
"sqlalchemy==2.0.41",
"sqlalchemy-utils==0.41.2",
"strawberry-graphql>=0.246.2",
"structlog>=25.4.0",
"tabulate==0.9.0",
"typer==0.15.4",
"uvicorn[standard]~=0.34.0",
"nwa-stdlib~=1.9.0",
"oauth2-lib~=2.4.0",
"tabulate==0.9.0",
"strawberry-graphql>=0.246.2",
"pydantic-forms>=1.4.0, <=2.1.0",
]

description-file = "README.md"
requires-python = ">=3.11,<3.14"

[project.urls]
Documentation = "https://workfloworchestrator.org/orchestrator-core/"
Documentation = "https://workfloworchestrator.org/orchestrator-core"
Homepage = "https://workfloworchestrator.org/orchestrator-core"
Source = "https://github.com/workfloworchestrator/orchestrator-core"

# Published optional dependencies, or "extras"
[project.optional-dependencies]
celery = [
"celery~=5.5.1"
"celery~=5.5.1",
]

test = [
"apache-license-check",
"black",
"blinker",
"deepdiff",
"dirty-equals",
"jsonref",
# Local dependencies for development
[dependency-groups]
docs = [
"mkdocs>=1.6.1",
"mkdocs-embed-external-markdown>=3.0.2",
"mkdocs-include-markdown-plugin>=7.1.6",
"mkdocs-macros-plugin>=1.3.7",
"mkdocs-material[imaging]>=9.6.14",
"mkdocs-open-in-new-tab>=1.0.8",
"mkdocs-render-swagger-plugin>=0.1.2",
"mkdocstrings[python]>=0.29.1",
]
dev = [
"apache-license-check>=1.0.0",
"black>=25.1.0",
"blinker>=1.9.0",
"deepdiff>=8.5.0",
"dirty-equals>=0.9.0",
"jsonref>=1.1.0",
"mypy==1.9",
"pyinstrument",
"mypy-extensions>=1.1.0",
"pre-commit>=4.2.0",
"pydocstyle>=6.3.0",
"pyinstrument>=5.0.2",
"pytest==8.3.5",
"pytest-asyncio==0.21.2",
"pytest-codspeed",
"pytest-cov",
"pytest-httpx",
"pytest-xdist",
"requests-mock",
"ruff",
"sqlalchemy[mypy]",
"urllib3-mock",
"types-Deprecated",
"types-Jinja2",
"types-aiofiles",
"types-certifi",
"types-click",
"types-itsdangerous",
"types-orjson",
"types-python-dateutil",
"types-pytz",
"types-redis",
"types-requests",
"types-setuptools",
"types-tabulate",
"types-toml",
"types-ujson",
"types-PyYAML",
]
doc = [
"mkdocs",
"mkdocs-material[imaging]",
"mkdocs-render-swagger-plugin",
"mkdocs-include-markdown-plugin",
"mkdocstrings[python]",
"mkdocs-open-in-new-tab",
"mkdocs-macros-plugin",
"mkdocs-embed-external-markdown"
]
dev = [
"toml",
"bumpversion",
"mypy_extensions",
"pre-commit",
"pydocstyle",
"python-dotenv",
"watchdog",
"pytest-codspeed>=3.2.0",
"pytest-cov>=6.2.1",
"pytest-httpx>=0.29.0",
"pytest-xdist>=3.7.0",
"requests-mock>=1.12.1",
"ruff>=0.12.0",
"sqlalchemy[mypy]>=2.0.41",
"toml>=0.10.2",
"types-aiofiles>=24.1.0.20250606",
"types-certifi>=2021.10.8.3",
"types-click>=7.1.8",
"types-deprecated>=1.2.15.20250304",
"types-itsdangerous>=1.1.6",
"types-jinja2>=2.11.9",
"types-orjson>=3.6.2",
"types-python-dateutil>=2.9.0.20250516",
"types-pytz>=2025.2.0.20250516",
"types-pyyaml>=6.0.12.20250516",
"types-redis>=4.6.0.20241004",
"types-requests>=2.32.4.20250611",
"types-setuptools>=80.9.0.20250529",
"types-tabulate>=0.9.0.20241207",
"types-toml>=0.10.8.20240310",
"types-ujson>=5.10.0.20250326",
"urllib3-mock>=0.3.3",
"watchdog>=6.0.0",
]

[build-system]
requires = ["flit_core>=3.2,<4"]
build-backend = "flit_core.buildapi"

[tool.flit.module]
name = "orchestrator"

Expand Down
Loading
Loading