diff --git a/.github/workflows/python-code-style.yml b/.github/workflows/python-code-style.yml
index 39769a7..a8efd85 100644
--- a/.github/workflows/python-code-style.yml
+++ b/.github/workflows/python-code-style.yml
@@ -21,11 +21,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.13"
+ - name: Install uv
+ uses: astral-sh/setup-uv@v6
- name: Install dependencies
run: |
- python -m pip install --upgrade pip
- python -m pip install poetry tox
- make poetry-export
+ make dev-dependencies
- name: Check code style with black
run: |
make format
diff --git a/.github/workflows/python-lint.yml b/.github/workflows/python-lint.yml
index a00e294..1770883 100644
--- a/.github/workflows/python-lint.yml
+++ b/.github/workflows/python-lint.yml
@@ -21,10 +21,10 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.13"
+ - name: Install uv
+ uses: astral-sh/setup-uv@v6
- name: Install dependencies
run: |
- python -m pip install --upgrade pip
- python -m pip install poetry tox
- make poetry-export
+ make dev-dependencies
- name: Lint with ruff
run: make lint
diff --git a/.github/workflows/python-quality.yml b/.github/workflows/python-quality.yml
index fcc57e4..f14222f 100644
--- a/.github/workflows/python-quality.yml
+++ b/.github/workflows/python-quality.yml
@@ -21,12 +21,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.13"
+ - name: Install uv
+ uses: astral-sh/setup-uv@v6
- name: Install dependencies
run: |
- python -m pip install --upgrade pip
- python -m pip install poetry
- poetry config virtualenvs.create false
- poetry install --no-root --with dev
+ make dev-dependencies
- name: Test & publish code coverage
uses: paambaati/codeclimate-action@v9.0.0
env:
diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml
index 8335564..f91c663 100644
--- a/.github/workflows/python-tests.yml
+++ b/.github/workflows/python-tests.yml
@@ -28,12 +28,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.version }}"
+ - name: Install uv
+ uses: astral-sh/setup-uv@v6
- name: Install dependencies
run: |
- python -m pip install --upgrade pip
- python -m pip install poetry
- poetry config virtualenvs.create false
- poetry install --no-root --with dev
+ make dev-dependencies
- name: Test with pytest
id: citest
run: |
@@ -68,7 +67,7 @@ jobs:
--body "$BODY")
if [[ $PINNED == true ]]; then
gh issue pin "$new_issue_url"
- fi
+ fi
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/python-typing.yml b/.github/workflows/python-typing.yml
index d92e04e..4090f5c 100644
--- a/.github/workflows/python-typing.yml
+++ b/.github/workflows/python-typing.yml
@@ -21,10 +21,10 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.13"
+ - name: Install uv
+ uses: astral-sh/setup-uv@v6
- name: Install dependencies
run: |
- python -m pip install --upgrade pip
- python -m pip install poetry tox
- make poetry-export
+ make dev-dependencies
- name: Check typing
run: make typing
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 2812e19..e346987 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -22,14 +22,15 @@ jobs:
with:
python-version: "3.13"
+ - name: Install uv
+ uses: astral-sh/setup-uv@v6
- name: Install dependencies
run: |
- python -m pip install --upgrade pip
- python -m pip install poetry poetry-dynamic-versioning
+ make dev-dependencies
- name: Build package
run: |
- poetry build
+ uv build
- name: Archive the dist folder
uses: actions/upload-artifact@v4
diff --git a/.github/workflows/reusable-github-pages.yml b/.github/workflows/reusable-github-pages.yml
index 26794b3..22fdf56 100644
--- a/.github/workflows/reusable-github-pages.yml
+++ b/.github/workflows/reusable-github-pages.yml
@@ -46,12 +46,11 @@ jobs:
# Here we want to install the current package in editable mode,
# in case mkdocs needs the package (i.e. we are building a mkdocs plugin).
+ - name: Install uv
+ uses: astral-sh/setup-uv@v6
- name: Install dependencies
run: |
- python -m pip install --upgrade pip
- python -m pip install poetry
- poetry config virtualenvs.create false
- poetry install --with dev
+ make dev-dependencies
- name: Configure Git user
run: |
@@ -64,12 +63,12 @@ jobs:
- name: Build and deploy static pages
run: |
- mike deploy ${{ inputs.site-version }} ${{ inputs.version-alias }} --update-aliases --push --branch ${{ inputs.branch }}
+ uv run mike deploy ${{ inputs.site-version }} ${{ inputs.version-alias }} --update-aliases --push --branch ${{ inputs.branch }}
- name: Set default site version
if: ${{ inputs.set-default }}
run: |
- mike set-default ${{ inputs.site-version }} --push --branch ${{ inputs.branch }}
+ uv run mike set-default ${{ inputs.site-version }} --push --branch ${{ inputs.branch }}
# `mike` is specifically built to be used together with GitHub pages.
# To upload the website to another service (i.e. AWS S3) uncomment
diff --git a/.gitignore b/.gitignore
index 4b14d04..5f825d9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -282,4 +282,5 @@ dmypy.json
# Cython debug symbols
cython_debug/
-poetry.lock
+uv.lock
+version.py
diff --git a/.idea/bootstrap-python-package.iml b/.idea/bootstrap-python-package.iml
index 53b24a8..9f1eb92 100644
--- a/.idea/bootstrap-python-package.iml
+++ b/.idea/bootstrap-python-package.iml
@@ -4,8 +4,9 @@
+
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 692a896..83d9b9a 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -4,5 +4,5 @@
-
+
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ae11d1a..f518506 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -8,8 +8,9 @@ Please note that this project is released with a Contributor Code of Conduct. By
## Submitting a pull request
+Before running any commands, [install `uv`](https://docs.astral.sh/uv/getting-started/installation/):
+
0. Fork and clone the repository
-0. Install poetry: `pip install -g poetry`
0. Configure and install the dependencies: `make dev-dependencies`
0. Make sure the tests pass on your machine: `make check`
0. Create a new branch: `git checkout -b my-branch-name`
diff --git a/Makefile b/Makefile
index 9ee8046..78b78d0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,49 +1,41 @@
-.PHONY: dev-dependencies update-dependencies test docs fix check typing lint format ci-test ci-coverage poetry-export
+.PHONY: dev-dependencies update-dependencies test docs fix check typing lint format ci-test ci-coverage
#########################
###### dev commands #####
#########################
dev-dependencies:
- poetry install --with dev --no-root
-
-update-dependencies:
- poetry update --with dev
+ uv lock --upgrade
+ uv sync --all-groups --frozen
test:
- poetry run pytest -n auto --cov
+ uv run pytest -n auto --cov
docs:
- poetry run mkdocs serve
+ uv run mkdocs serve
fix:
- poetry run ruff check . --fix
- poetry run ruff format .
-
-check: poetry-export
- tox
-
-typing: poetry-export
- tox -e typing
+ uv run ruff format .
+ uv run ruff check . --fix
+ uv run ruff format .
-lint: poetry-export
- tox -e lint
+check:
+ uv run tox
-format: poetry-export
- tox -e format
+typing:
+ uv run tox -e typing
+lint:
+ uv run tox -e lint
-#########################
-#### Helper commands ####
-#########################
-poetry-export:
- poetry export -f requirements.txt --output /tmp/requirements.txt --with dev
+format:
+ uv run tox -e format
#########################
###### CI commands ######
#########################
ci-test:
- poetry run pytest
+ uv run pytest
ci-coverage:
- poetry run pytest --cov --cov-report lcov
+ uv run pytest --cov --cov-report lcov
diff --git a/README.md b/README.md
index 14e4e24..320606c 100644
--- a/README.md
+++ b/README.md
@@ -43,12 +43,12 @@ It is configured with all the following features:
* Update the PyCharm Copyright profile in the IDE settings: Editor | Copyright | Copyright Profiles (if you want to use it)
* Setup local development:
* Clone the repository
- * Install poetry `pip install poetry`
+ * [Install uv](https://docs.astral.sh/uv/getting-started/installation/)
* Install dev dependencies with `make dev-dependencies`
* (optional) It is strongly recommended to install [pre-commit](https://pre-commit.com/#installation)
and run `pre-commit install` so that formatting and linting are automatically executed during `git commit`.
* Setup GitHub pages (this need local development setup):
- * Initialise documentation branch `poetry run mike deploy dev latest --update-aliases --push`
+ * Initialise documentation branch `uv run mike deploy dev latest --update-aliases --push`
* Configure GitHub Pages to deploy from the `gh-pages` branch (at URL `https://github.com/GITHUB_NAME_OR_ORGANIZATION/GITHUB_REPOSITORY/settings/pages`)
* Add the `main` branch and the `v*.*.*` tag rules to the "deployment branches and tags" list in the `gh-pages` environment (at URL `https://github.com/GITHUB_NAME_OR_ORGANIZATION/GITHUB_REPOSITORY/settings/environments`)
@@ -59,7 +59,7 @@ and remove the marked lines in `workflows/release.yml`.
## Package release
-This setup uses [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning).
+This setup uses [uv-dynamic-versioning](https://github.com/ninoseki/uv-dynamic-versioning/tree/main).
This means it's not necessary to commit the version in the code but the CI pipeline
will infer it from the git tag.
@@ -72,14 +72,13 @@ To release a new version, just create a new release and tag in the GitHub reposi
the convention `vX.X.X` (semantic versioning preceded by lowercase `v`). It will publish
the correct version on Pypi, omitting the `v` (ie. `v1.0.0` will publish `1.0.0`).
-This format can be customized, refer to [poetry-dynamic-versioning docs](https://github.com/mtkennerly/poetry-dynamic-versioning)
+This format can be customized, refer to [uv-dynamic-versioning docs](https://github.com/ninoseki/uv-dynamic-versioning/tree/main).
## Commands for development
All the common commands used during development can be run using make targets:
* `make dev-dependencies`: Install dev requirements
-* `make update-dependencies`: Update dev requirements
* `make fix`: Run code style and lint automatic fixes (where possible)
* `make test`: Run test suite against system python version
* `make check`: Run tests against all available python versions, code style and lint checks
diff --git a/bootstrap_python_package/__init__.py b/bootstrap_python_package/__init__.py
index 715bbf3..9971de9 100644
--- a/bootstrap_python_package/__init__.py
+++ b/bootstrap_python_package/__init__.py
@@ -1,5 +1,5 @@
# ==============================================================================
-# Copyright (c) 2024 Federico Busetti =
+# Copyright (c) 2025 Federico Busetti =
# <729029+febus982@users.noreply.github.com> =
# =
# Permission is hereby granted, free of charge, to any person obtaining a =
@@ -21,9 +21,6 @@
# DEALINGS IN THE SOFTWARE. =
# ==============================================================================
-__version__ = "0.0.0"
-__version_tuple__ = (0, 0, 0)
-
def some_function() -> str:
"""
diff --git a/pyproject.toml b/pyproject.toml
index fecb142..a8ab171 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,14 +1,11 @@
-[tool.poetry]
+[project]
name = "bootstrap-python-package"
-version = "0.0.0"
-description = "A manager to easily handle multiple SQLAlchemy configurations"
-license = "MIT"
-authors = ["Federico Busetti <729029+febus982@users.noreply.github.com>"]
-repository = "https://github.com/febus982/bootstrap-python-package"
-homepage = "https://febus982.github.io/bootstrap-python-package"
+dynamic = ["version"]
+description = "A nice package meant to achieve world domination!"
+authors = [{ name = "Federico Busetti", email = "729029+febus982@users.noreply.github.com" }]
+requires-python = ">=3.9,<3.14"
readme = "README.md"
-packages = [{include = "bootstrap_python_package"}]
-#keywords = ["add", "keywords", "here"]
+license = "MIT"
classifiers = [
"Development Status :: 4 - Beta",
"Framework :: AsyncIO",
@@ -24,54 +21,58 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
- "Typing :: Typed"
+ "Typing :: Typed",
]
-[tool.poetry-dynamic-versioning]
-enable = false
+[project.urls]
+Homepage = "https://febus982.github.io/bootstrap-python-package"
+Repository = "https://github.com/febus982/bootstrap-python-package"
-[build-system]
-requires = ["poetry-core", "poetry-dynamic-versioning"]
-build-backend = "poetry_dynamic_versioning.backend"
+[dependency-groups]
+dev = [
+ "coverage>=6.5.0",
+ "mkdocs>=1.4.3",
+ "mkdocstrings[python]>=0.24.0",
+ "mkdocs-awesome-pages-plugin",
+ "mkdocs-macros-adr-summary",
+ "mkdocs-gen-files>=0.5.0",
+ "mkdocs-material>=9.1.16",
+ "mike>=2.0.0",
+ "mypy>=0.990",
+ "pymdown-extensions>=10.0.1",
+ "pytest>=8.0.0,<9",
+ "pytest-asyncio>=0.20.3",
+ "pytest-cov>=4.0.0",
+ "pytest-factoryboy>=2.5.0",
+ "pytest-xdist>=3.0.2",
+ "ruff>=0.0.263",
+ "tox>=4.12.1",
+ "tox-uv>=1.26.0",
+ "uv-dynamic-versioning>=0.8.2",
+]
-############################
-### Package requirements ###
-############################
+[build-system]
+requires = ["hatchling", "uv-dynamic-versioning"]
+build-backend = "hatchling.build"
-[tool.poetry.dependencies]
-python = ">=3.9,<3.14"
+[tool.hatch.build.targets.sdist]
+include = ["bootstrap_python_package"]
-[tool.poetry.group.dev]
-optional = true
+[tool.hatch.build.targets.wheel]
+include = ["bootstrap_python_package"]
-[tool.poetry.group.dev.dependencies]
-coverage = ">=6.5.0"
-mkdocs = ">=1.4.3"
-mkdocstrings = { version = ">=0.24.0", extras = ["python"] }
-mkdocs-awesome-pages-plugin = "*"
-mkdocs-macros-adr-summary = "*"
-mkdocs-gen-files = ">=0.5.0"
-mkdocs-material = ">=9.1.16"
-mike = ">=2.0.0"
-mypy = ">=0.990"
-pymdown-extensions = ">=10.0.1"
-pytest = "^8.0.0"
-pytest-asyncio = ">=0.20.3"
-pytest-cov = ">=4.0.0"
-pytest-factoryboy = ">=2.5.0"
-pytest-xdist = ">=3.0.2"
-ruff = ">=0.0.263"
-tox = ">=4.12.1"
+[tool.hatch.version]
+source = "uv-dynamic-versioning"
-############################
-### Tools configuration ###
-############################
+[tool.hatch.build.hooks.version]
+path = "bootstrap_python_package/version.py"
[tool.coverage.run]
branch = true
source = ["bootstrap_python_package"]
-# It's not necessary to configure concurrency here
-# because pytest-cov takes care of that
+omit = [
+ "bootstrap_python_package/version.py",
+]
[tool.coverage.report]
fail_under = 100
diff --git a/scripts/docs-version.sh b/scripts/docs-version.sh
index 7212215..0113859 100755
--- a/scripts/docs-version.sh
+++ b/scripts/docs-version.sh
@@ -24,6 +24,8 @@
# DEALINGS IN THE SOFTWARE. =
#===============================================================================
-VERSION=$(poetry version -s)
+# uv doesn't yet support reading dynamic version: https://github.com/astral-sh/uv/issues/14137
+#VERSION=$(uv version --short)
+VERSION=$(uv run scripts/version_from_git.py)
SEMVER=( ${VERSION//./ } )
echo "${SEMVER[0]}.${SEMVER[1]}"
diff --git a/scripts/version_from_git.py b/scripts/version_from_git.py
new file mode 100644
index 0000000..b9237f7
--- /dev/null
+++ b/scripts/version_from_git.py
@@ -0,0 +1,26 @@
+# ==============================================================================
+# Copyright (c) 2025 Federico Busetti =
+# <729029+febus982@users.noreply.github.com> =
+# =
+# Permission is hereby granted, free of charge, to any person obtaining a =
+# copy of this software and associated documentation files (the "Software"), =
+# to deal in the Software without restriction, including without limitation =
+# the rights to use, copy, modify, merge, publish, distribute, sublicense, =
+# and/or sell copies of the Software, and to permit persons to whom the =
+# Software is furnished to do so, subject to the following conditions: =
+# =
+# The above copyright notice and this permission notice shall be included in =
+# all copies or substantial portions of the Software. =
+# =
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR =
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, =
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL =
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER =
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING =
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER =
+# DEALINGS IN THE SOFTWARE. =
+# ==============================================================================
+from dunamai import Version
+
+version = Version.from_git().serialize()
+print(version)
diff --git a/tox.ini b/tox.ini
index ff1c841..3e86820 100644
--- a/tox.ini
+++ b/tox.ini
@@ -11,14 +11,8 @@ env_list =
format
[testenv]
-; The file /tmp/requirements.txt is created automatically if you run tox
-; using `make check` command, otherwise manually run
-; `poetry export -f requirements.txt --output /tmp/requirements.txt --with dev`
-; Poetry is really bad in identifying running virtualenvs, so we can't use
-; directly poetry install. This is the best hacky way to install poetry
-; requirements inside tox.
-deps =
- -r/tmp/requirements.txt
+runner = uv-venv-runner
+dependency_groups = dev
commands =
pytest