diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 551c1f2..40f5e5a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,7 +3,7 @@ version: 2 updates: - # Monitor pip dependencies (Poetry uses pip under the hood) + # Monitor pip dependencies (uv uses pip under the hood) - package-ecosystem: "pip" directory: "/" schedule: diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 8b399b3..3110b2a 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -7,30 +7,26 @@ jobs: fail-fast: false matrix: python-version: ["3.11", "3.12", "3.13"] - poetry-version: ["2.3.1"] os: ["ubuntu-latest", "macos-latest", "windows-latest"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v6 - - uses: actions/setup-python@v6 + - name: Install uv + uses: astral-sh/setup-uv@v6 with: python-version: ${{ matrix.python-version }} - - name: Install poetry - run: pip install poetry==${{ matrix.poetry-version }} - - name: View poetry --help - run: poetry --help - - name: Run poetry install - run: poetry install + - name: Install dependencies + run: uv sync - name: lint - run: poetry run ruff check . + run: uv run ruff check . - name: format check - run: poetry run black --check . + run: uv run black --check . - name: sort-check - run: poetry run isort --check-only . + run: uv run isort --check-only . - name: typecheck - run: poetry run mypy l9format + run: uv run mypy l9format - name: test - run: poetry run pytest + run: uv run pytest - name: security-audit - run: poetry run pip-audit + run: uv run pip-audit diff --git a/.gitignore b/.gitignore index eb2ac10..d6fce37 100644 --- a/.gitignore +++ b/.gitignore @@ -129,4 +129,4 @@ dmypy.json .pyre/ .idea -poetry.lock \ No newline at end of file +uv.lock \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 49e7973..57bc309 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ and this project adheres to - Bump ruff dev dependency from `^0.14.14` to `>=0.14.14,<0.16.0` ([ac8a1db], [#50]) - Bump isort dev dependency from `^7.0.0` to `>=7,<9` to allow isort 8.x ([4464bfd], [#51]) +- Migrate from Poetry to uv: update `pyproject.toml` to PEP 621 format with + `hatchling` build backend, replace `poetry run` with `uv run` in Makefile, + and switch CI to `astral-sh/setup-uv` ([5f4fc51], [#56]) ## [1.4.0] - 2026-02-09 @@ -161,6 +164,7 @@ and this project adheres to [6c9eecd]: https://github.com/LeakIX/l9format-python/commit/6c9eecd +[5f4fc51]: https://github.com/LeakIX/l9format-python/commit/5f4fc51 [ac8a1db]: https://github.com/LeakIX/l9format-python/commit/ac8a1db [4464bfd]: https://github.com/LeakIX/l9format-python/commit/4464bfd [ac4744e]: https://github.com/LeakIX/l9format-python/commit/ac4744e @@ -248,5 +252,6 @@ and this project adheres to [#32]: https://github.com/LeakIX/l9format-python/issues/32 [#49]: https://github.com/LeakIX/l9format-python/pull/49 [#50]: https://github.com/LeakIX/l9format-python/pull/50 -[#43]: https://github.com/LeakIX/l9format-python/issues/43 [#51]: https://github.com/LeakIX/l9format-python/pull/51 +[#56]: https://github.com/LeakIX/l9format-python/pull/56 +[#43]: https://github.com/LeakIX/l9format-python/issues/43 diff --git a/Makefile b/Makefile index 9206603..67263c1 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Makefile for l9format-python project -VERSION := $(shell poetry version -s) +VERSION := $(shell python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Darwin) @@ -24,31 +24,31 @@ all: format sort lint typecheck test security-check ## Run all quality checks .PHONY: test test: ## Run tests using pytest - poetry run pytest + uv run pytest .PHONY: format format: ## Format code using black - poetry run black . + uv run black . .PHONY: check-format check-format: ## Check code formatting with black - poetry run black --check . + uv run black --check . .PHONY: sort sort: ## Sort imports using isort - poetry run isort . + uv run isort . .PHONY: check-sort check-sort: ## Check import sorting with isort - poetry run isort --check-only . + uv run isort --check-only . .PHONY: lint lint: ## Lint code using ruff - poetry run ruff check . + uv run ruff check . .PHONY: lint-fix lint-fix: ## Lint and fix code using ruff - poetry run ruff check --fix . + uv run ruff check --fix . .PHONY: lint-shell lint-shell: ## Lint shell scripts using shellcheck @@ -56,11 +56,11 @@ lint-shell: ## Lint shell scripts using shellcheck .PHONY: typecheck typecheck: ## Run mypy type checker - poetry run mypy l9format + uv run mypy l9format .PHONY: security-check security-check: ## Check for vulnerable dependencies using pip-audit - poetry run pip-audit + uv run pip-audit .PHONY: fix-trailing-whitespace fix-trailing-whitespace: ## Remove trailing whitespaces from all files @@ -97,12 +97,12 @@ check-trailing-whitespace: ## Check for trailing whitespaces in source files fi .PHONY: install -install: ## Install dependencies with Poetry - poetry install +install: ## Install dependencies with uv + uv sync .PHONY: build build: clean-dist ## Build package for distribution - poetry build + uv build .PHONY: publish-dry-run publish-dry-run: build ## Dry-run: show what would be published @@ -111,11 +111,11 @@ publish-dry-run: build ## Dry-run: show what would be published @echo "Would create GitHub release: v$(VERSION)" @echo "Package contents:" @ls -lh dist/ - poetry publish --dry-run + uv publish --dry-run .PHONY: publish publish: build ## Publish to PyPI, tag and create GitHub release - poetry publish + uv publish git tag -a "v$(VERSION)" -m "Release v$(VERSION)" git push origin "v$(VERSION)" gh release create "v$(VERSION)" dist/* \ diff --git a/pyproject.toml b/pyproject.toml index 3f58127..85f3cb6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,34 +1,36 @@ -[tool.poetry] +[project] name = "l9format" version = "1.4.0" -license = "MIT" +license = {text = "MIT"} description = "l9format is a schema declaration targeted at interoperability between network recon tools used at LeakIX" -authors = ["Danny Willems "] -maintainers = ["Danny Willems "] +authors = [{name = "Danny Willems", email = "danny@leakix.net"}] +maintainers = [{name = "Danny Willems", email = "danny@leakix.net"}] readme = "README.md" -homepage = "https://github.com/leakix/l9format-python" -repository = "https://github.com/leakix/l9format-python" -documentation = "https://github.com/leakix/l9format-python" - -[tool.poetry.dependencies] -python = "^3.11" -serde = "^0.9.0" - -[tool.poetry.group.dev.dependencies] -black = "^26.1.0" -fire = "^0.7.1" -isort = ">=7,<9" -mypy = "^1.19.0" -pip-audit = "^2.10.0" -pytest = "^9.0.2" -ruff = ">=0.14.14,<0.16.0" +requires-python = ">=3.11" +dependencies = [ + "serde>=0.9.0", +] + +[project.urls] +Homepage = "https://github.com/leakix/l9format-python" +Repository = "https://github.com/leakix/l9format-python" +Documentation = "https://github.com/leakix/l9format-python" +"Bug Tracker" = "https://github.com/leakix/l9format-python/issues" -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" +[dependency-groups] +dev = [ + "black>=26.1.0", + "fire>=0.7.1", + "isort>=7,<9", + "mypy>=1.19.0", + "pip-audit>=2.10.0", + "pytest>=9.0.2", + "ruff>=0.14.14,<0.16.0", +] -[tool.poetry.urls] -"Bug Tracker" = "https://github.com/leakix/l9format-python/issues" +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" [tool.ruff] line-length = 80