Skip to content

Commit

Permalink
refactor: switch to uv (#35)
Browse files Browse the repository at this point in the history
* refactor: switch to uv

* fix: fix ci testing
  • Loading branch information
ReinderVosDeWael authored Dec 18, 2024
1 parent aa5cd92 commit 8487525
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 812 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ jobs:
python-version-file: pyproject.toml
- name: Install dependencies
run: |
python -m pip install poetry
poetry install --with docs
uv sync
- name: Build docs
run: |
APP_MODULE_NAME=$(ls src -U | head -1) # Get the first module name in the src directory
poetry run pdoc src/"$APP_MODULE_NAME" -o docs_build -t docs/pdoc-theme --docformat google
uv run pdoc src/"$APP_MODULE_NAME" -o docs_build -t docs/pdoc-theme --docformat google
touch docs_build/.nojekyll
- uses: JamesIves/github-pages-deploy-action@v4
with:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Install uv
run: pipx install uv
- uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
cache: poetry
cache: pip
- name: Install dependencies
run: poetry install
run: uv sync

- name: build release distributions
run: poetry build
run: uv build

- name: upload distribution
uses: actions/upload-artifact@v4
Expand Down
32 changes: 20 additions & 12 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,36 @@ on:

jobs:
unit:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python_version: ['3.10', '3.11', '3.12', '3.13']
resolution: [lowest-direct, highest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Install uv
run: pipx install uv
- uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
cache: poetry
python-version: ${{ matrix.python_version }}
cache: pip
- name: Install dependencies
run: |
poetry install
uv sync --resolution=${{ matrix.resolution }}
shell: bash
- name: Run tests
id: run-tests
run: >
poetry run pytest \
uv run pytest \
--junitxml=pytest.xml \
--cov-report=term-missing:skip-covered \
--cov-report=xml:coverage.xml \
--cov=src tests \
--log-level=DEBUG \
--verbose
shell: bash
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
Expand All @@ -46,12 +54,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Install uv
run: pipx install uv
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: poetry
cache: pip
- run: |
poetry install
poetry run mypy .
uv sync
uv run mypy .
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
uv.lock
.python-version
local
.ruff_cache
.DS_Store
Expand Down
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
fail_fast: false

repos:
- repo: https://github.com/python-poetry/poetry
rev: 1.8.0
hooks:
- id: poetry-check

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.3
hooks:
Expand Down
763 changes: 0 additions & 763 deletions poetry.lock

This file was deleted.

48 changes: 24 additions & 24 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
[tool.poetry]
name = "cmi_docx"
version = "0.3.5"
description = ".docx utilities"
authors = ["Reinder Vos de Wael <[email protected]>"]
license = "LGPL-2.1"
readme = "README.md"
packages = [{include = "cmi_docx", from = "src"}]

[tool.poetry.dependencies]
python = ">=3.10"
python-docx = "^1.1.2"

[tool.poetry.group.dev.dependencies]
pytest = "^8.1.1"
mypy = "^1.9.0"
pre-commit = ">=3.7,<5.0"
pytest-cov = ">=5,<7"
ruff = ">=0.3.4,<0.8.0"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.poetry.group.docs.dependencies]
pdoc = ">=14.4,<16.0"
[tool.hatch.build.targets.wheel]
packages = ["src/cmi_docx"]

[tool.pytest.ini_options]
pythonpath = [
Expand Down Expand Up @@ -83,6 +67,22 @@ indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"

[build-system]
requires = ["poetry-core>=1.2.0"]
build-backend = "poetry.core.masonry.api"
[tool.uv]
dev-dependencies = [
"mypy>=1.13.0",
"pre-commit>=4.0.1",
"pytest>=8.3.4",
"pytest-cov>=6.0.0",
"ruff>=0.8.3",
"pdoc>=15.0.1"
]

[project]
name = "cmi-docx"
version = "0.3.5"
description = "Additional tooling for Python-docx."
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"python-docx>=1.1.2"
]

0 comments on commit 8487525

Please sign in to comment.