Skip to content

Commit

Permalink
chore: migrate migrate packaging to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
browniebroke committed Dec 20, 2024
1 parent 7dbf702 commit 01061a1
Show file tree
Hide file tree
Showing 9 changed files with 345 additions and 382 deletions.
16 changes: 5 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,15 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
cache: poetry
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: poetry install
- uses: astral-sh/setup-uv@v5
- run: uv sync --no-python-downloads
shell: bash
- name: Test with Pytest
run: poetry run pytest --cov-report=xml
- run: uv run pytest --cov-report=xml
shell: bash
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ on:

jobs:
upgrade:
uses: browniebroke/github-actions/.github/workflows/poetry-upgrade.yml@v1
uses: browniebroke/github-actions/.github/workflows/uv-upgrade.yml@v1
secrets:
gh_pat: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
4 changes: 2 additions & 2 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tasks:
- command: |
pip install poetry
PIP_USER=false poetry install
pip install uv
PIP_USER=false uv sync
- command: |
pip install pre-commit
pre-commit install
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: "CHANGELOG.md|.all-contributorsrc"
default_stages: [commit]
default_stages: [pre-commit]

ci:
autofix_commit_msg: "chore(pre-commit.ci): auto fixes"
Expand Down Expand Up @@ -32,10 +32,10 @@ repos:
rev: "v2.5.0"
hooks:
- id: pyproject-fmt
- repo: https://github.com/python-poetry/poetry
rev: 1.8.5
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.5.11
hooks:
- id: poetry-check
- id: uv-lock
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ Ready to contribute? Here's how to set yourself up for local development.
$ git clone git@github.com:your_name_here/all-repos-envvar.git
```

3. Install the project dependencies with [Poetry](https://python-poetry.org):
3. Install the project dependencies with [uv](https://docs.astral.sh/uv/):

```shell
$ poetry install
$ uv sync
```

4. Create a branch for local development:
Expand All @@ -63,7 +63,7 @@ Ready to contribute? Here's how to set yourself up for local development.
5. When you're done making changes, check that your changes pass our tests:

```shell
$ poetry run pytest
$ uv run pytest
```

6. Linting is done through [pre-commit](https://pre-commit.com). Provided you have the tool installed globally, you can run them all as one-off:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</a>
</p>
<p align="center">
<a href="https://python-poetry.org/">
<img src="https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json" alt="Poetry">
<a href="https://github.com/astral-sh/uv">
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json" alt="uv">
</a>
<a href="https://github.com/astral-sh/ruff">
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
Expand Down
320 changes: 0 additions & 320 deletions poetry.lock

This file was deleted.

84 changes: 45 additions & 39 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,41 +1,6 @@
[build-system]
build-backend = "poetry.core.masonry.api"
requires = [ "poetry-core>=1" ]

[tool.poetry]
name = "all-repos-envvar"
version = "1.2.0"
description = "An all-repos extension to read values from environment variables."
authors = [ "Bruno Alla <alla.brunoo@gmail.com>" ]
license = "MIT"
readme = "README.md"
repository = "https://github.com/browniebroke/all-repos-envvar"
documentation = "https://all-repos-envvar.readthedocs.io"
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"Natural Language :: English",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries",
]
packages = [
{ include = "all_repos_envvar", from = "src" },
]

[tool.poetry.urls]
"Bug Tracker" = "https://github.com/browniebroke/all-repos-envvar/issues"
"Changelog" = "https://all-repos-envvar.readthedocs.io/changelog.html"
"Twitter" = "https://twitter.com/_BrunoAlla"
"Mastodon" = "https://fosstodon.org/@browniebroke"

[tool.poetry.dependencies]
python = "^3.9"
all-repos = ">=1"
environs = ">=10.0"

[tool.poetry.group.dev.dependencies]
pytest = "^8.0"
pytest-cov = "^6.0.0"
build-backend = "setuptools.build_meta"
requires = [ "setuptools" ]

[tool.ruff]
target-version = "py39"
Expand Down Expand Up @@ -106,11 +71,16 @@ module = "tests.*"
allow_untyped_defs = true

[tool.semantic_release]
version_toml = [ "pyproject.toml:tool.poetry.version" ]
version_toml = [ "pyproject.toml:project.version" ]
version_variables = [
"src/all_repos_envvar/__init__.py:__version__",
]
build_command = "pip install poetry && poetry build"
build_command = """
pip install uv
uv lock
git add uv.lock
uv build
"""

[tool.semantic_release.changelog]
exclude_commit_patterns = [
Expand All @@ -128,3 +98,39 @@ match = "main"
[tool.semantic_release.branches.noop]
match = "(?!main$)"
prerelease = true

[dependency-groups]
dev = [
"pytest<9.0,>=8.0",
"pytest-cov<7.0.0,>=6.0.0",
]

[project]
authors = [
{name = "Bruno Alla", email = "alla.brunoo@gmail.com"},
]
license = {text = "MIT"}
requires-python = ">=3.9"
dependencies = [
"all-repos>=1",
"environs>=10.0",
]
name = "all-repos-envvar"
version = "1.2.0"
description = "An all-repos extension to read values from environment variables."
readme = "README.md"
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"Natural Language :: English",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries",
]

[project.urls]
"Bug Tracker" = "https://github.com/browniebroke/all-repos-envvar/issues"
Changelog = "https://all-repos-envvar.readthedocs.io/changelog.html"
Twitter = "https://twitter.com/_BrunoAlla"
Mastodon = "https://fosstodon.org/@browniebroke"
repository = "https://github.com/browniebroke/all-repos-envvar"
documentation = "https://all-repos-envvar.readthedocs.io"
Loading

0 comments on commit 01061a1

Please sign in to comment.