Skip to content

Commit

Permalink
MIgrate to uv (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
ciscorn authored Dec 5, 2024
1 parent 954c61a commit 4bc688d
Show file tree
Hide file tree
Showing 8 changed files with 280 additions and 301 deletions.
31 changes: 7 additions & 24 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,20 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
- name: Setup uv
uses: astral-sh/setup-uv@v4
with:
python-version: 3.8

- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config virtualenvs.in-project true
- name: Set up cache
uses: actions/cache@v4
id: cache
with:
path: .venv
key: venv-lint-${{ hashFiles('**/poetry.lock') }}

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
version: "latest"
enable-cache: true

- name: Install dependencies
run: poetry install

- name: Check poetry.lock
run: poetry lock --check
run: uv sync

# - name: pyright
# run: poetry run pyright .

- name: ruff-format
run: poetry run ruff format --check .
run: uv run ruff format --check .

- name: ruff
run: poetry run ruff check --output-format github .
run: uv run ruff check --output-format github .
9 changes: 7 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ jobs:
- name: Pull QGIS image
run: docker pull qgis/qgis:${{ matrix.qgis_image_tag }}

- name: Setup uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
enable-cache: true

- name: Export requirements.txt
run: |
pip3 install poetry
poetry export --with dev -f requirements.txt -o requirements.txt
uv export --extra dev > requirements.txt
- name: Run tests
run: >
Expand Down
21 changes: 0 additions & 21 deletions .pre-commit-config.yaml

This file was deleted.

14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ help:

init: ## Startup project
ifeq ($(OS),Windows_NT)
$(QGIS_PYTHON) -m pip install poetry
$(QGIS_PYTHON) -m poetry config --local virtualenvs.in-project true
$(QGIS_PYTHON) -m poetry install
$(QGIS_PYTHON) -m pip install uv
$(QGIS_PYTHON) -m uv venv --python $(QGIS_PYTHON) --system-site-packages
$(QGIS_PYTHON) -m uv sync
$(QGIS_PYTHON) -c "import pathlib;import qgis;open('.venv/Lib/site-packages/qgis.pth', 'w').write(str((pathlib.Path(qgis.__file__)/'../..').resolve()) + '\n' + str((pathlib.Path(qgis.__file__)/'../../plugins').resolve()))"
else
poetry env use $(QGIS_PYTHON)
poetry install
uv venv --python $(QGIS_PYTHON) --system-site-packages
uv sync
echo $(QGIS_STD_PLUGINS) > .venv/lib/python3.9/site-packages/qgis_std_plugins.pth
endif

Expand All @@ -52,9 +52,9 @@ package: ## Build zip package

test: ## Test
ifeq ($(OS),Windows_NT)
$(QGIS_PYTHON) -m poetry run python -c "import os; os.add_dll_directory(r'${QGIS_DLL}'); import pytest; pytest.main('-v --cov --cov-report=term'.split())"
$(QGIS_PYTHON) -m uv run python -c "import os; os.add_dll_directory(r'${QGIS_DLL}'); import pytest; pytest.main('-v --cov --cov-report=term'.split())"
else
poetry run pytest -v --cov --cov-report=term
uv run pytest -v --cov --cov-report=term
endif

update-deps: ## Update mojxml library
Expand Down
226 changes: 0 additions & 226 deletions poetry.lock

This file was deleted.

4 changes: 0 additions & 4 deletions poetry.toml

This file was deleted.

29 changes: 12 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
[tool.poetry]
[project]
name = "qgis-mojxml-plugin"
version = "0.0.0"
description = "A QGIS plugin for converting Japanese “MOJ Map XML” (land registration polygons in Japan) into geospatial formats."
authors = [
"MIERUNE Inc. <[email protected]>",
"Taku Fukada <[email protected]>",
{ name = "Taku Fukada", email = "[email protected]" },
{ name = "MIERUNE Inc.", email = "[email protected]" },
]
description = "A QGIS plugin to load Japanese “MOJ Map XML” (land registration polygons in Japan)."
readme = "README.md"
packages = [{ include = "mojxml_plugin" }]
requires-python = ">=3.9"

[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"

[tool.poetry.group.dev.dependencies]
pytest = "^8.2.2"
pytest-cov = "^5.0.0"
pyqt5-stubs = "^5.15.6.0"
ruff = "^0.4.9"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[dependency-groups]
dev = [
"pyqt5-stubs>=5.15.6.0",
"pytest-cov>=6.0.0",
"pytest>=8.3.4",
"ruff>=0.8.1",
]

[tool.pytest.ini_options]
pythonpath = "."
Expand Down
Loading

0 comments on commit 4bc688d

Please sign in to comment.