Skip to content

Commit

Permalink
Migrate from poetry to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
mconigliaro committed Jan 30, 2025
1 parent 264c6b9 commit ba0c04c
Show file tree
Hide file tree
Showing 9 changed files with 1,240 additions and 1,192 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on: push

env:
AWS_DEFAULT_REGION: us-east-1
UV_VERSION: 0.5.5

jobs:
ci:
Expand All @@ -12,13 +13,16 @@ jobs:
- name: Check out repository code
uses: actions/checkout@v2

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: ${{ env.UV_VERSION}}
enable-cache: true

- name: Install dependencies
run: |
sudo apt-get update
sudo apt install -y gnome-keyring
pip3 install --upgrade pip
pip3 install poetry
poetry install
uv python install
uv sync
- name: Lint and test
run: make ci
Expand All @@ -27,6 +31,6 @@ jobs:
run: make pex

- name: Upload artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
path: dist/*
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.DS_Store
.coverage
.coverage*
.env
.tox
.vscode
Expand Down
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
ci: lint test

lint:
poetry run black --check .
uv run ruff check

test:
poetry run pytest --cov=authum --cov-report=term-missing
uv run pytest --cov=authum --cov-report=term-missing

tdd:
poetry run pytest -f --color=yes -o log_cli=1 --capture=tee-sys --log-level=DEBUG
uv run pytest -f --color=yes -o log_cli=1 --capture=tee-sys --log-level=DEBUG

# FIXME: run `dist/athm --version` at the end of CI to make sure it works.
# Need to get keyring working on headless Ubuntu first.
# See: https://pypi.org/project/keyring/
pex:
$(eval REQUIREMENTS=${TMPDIR}requirements.txt)
poetry export --without-hashes > ${REQUIREMENTS}
poetry run pex -r ${REQUIREMENTS} -e authum.cli:main -o dist/athm .
uv export --no-hashes --no-emit-project > ${REQUIREMENTS}
uv run pex -r ${REQUIREMENTS} -e authum.cli:main -o dist/athm .

release:
$(eval VERSION=`poetry version -s`)
$(eval VERSION=`uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version`)
git tag -a v${VERSION} -m "Release version ${VERSION}"
git push --tags
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ SAML/OIDC identity and service providers. Authum is the successor to

## Installation

1. Install [Poetry](https://python-poetry.org)
- `brew install poetry`
1. Install [uv](https://docs.astral.sh/uv/)
- `brew install uv`
1. Clone this repository
1. `cd /path/to/repository`
1. `poetry install`
1. `uv python install`
1. `uv sync`
1. `make pex`
1. Copy `dist/athm` to a location in $PATH
- Homebrewers `cp dist/athm $(eval brew --prefix)/bin`
Expand Down Expand Up @@ -64,11 +65,11 @@ athm --debug <command>

## Development

1. Install [Poetry](https://python-poetry.org)
1. Install [uv](https://docs.astral.sh/uv/)
1. Clone this repository
1. `cd /path/to/repository`
1. `poetry install`
1. `poetry shell`
1. `uv python install`
1. `uv sync`

### Running Tests

Expand All @@ -80,6 +81,6 @@ See [Developing Authum Plugins](authum/plugins/)

### Releasing New Versions

1. Bump the version (e.g. run [poetry version](https://python-poetry.org/docs/cli/#version))
1. Bump the version
1. Update the [CHANGELOG](./CHANGELOG.md)
1. Run `make release`
1,136 changes: 0 additions & 1,136 deletions poetry.lock

This file was deleted.

2 changes: 0 additions & 2 deletions poetry.toml

This file was deleted.

65 changes: 32 additions & 33 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
[project]
name = "authum"
version = "1.1.0"
authors = [
{ name = "CirrusMD", email = "devops@cirrusmd.com" }
]
description = "Awesome authentication tool for connecting command line applications to SAML/OIDC identity and service providers"
authors = ["CirrusMD <devops@cirrusmd.com>"]
homepage = "https://github.com/CirrusMD/authum"

[tool.poetry.dependencies]
python = ">=3.8,<3.13"
readme = "README.md"
requires-python = "~=3.8"
dependencies = [
"arn~=0.1.5",
"beautifulsoup4~=4.10",
"boto3~=1.19",
"click~=8.0",
"Flask~=2.0",
"keyring~=23.2",
"pluggy~=1.0",
"pyyaml~=6.0",
"requests~=2.26",
"rich~=10.12"
]

arn = "^0.1"
beautifulsoup4 = "^4.10"
boto3 = "^1.19"
click = "^8.0"
Flask = "^2.0"
keyring = "^23.2"
pluggy = "^1.0"
pyyaml = "^6.0"
requests = "^2.26"
rich = "^10.12"
[dependency-groups]
dev = [
"Mako~=1.1",
"pex~=2.1",
"pytest~=6.2",
"pytest-cov~=3.0",
"pytest-xdist~=2.4",
"responses~=0.15",
"ruff~=0.9.4",
]

[tool.poetry.dev-dependencies]
black = "*"
Mako = "^1.1"
pex = "^2.1"
pytest = "^6.2"
pytest-cov = "^3.0"
pytest-xdist = "^2.4"
responses = "^0.15"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.poetry.scripts]
[project.scripts]
athm = "authum.cli:main"

[tool.pyright]
venvPath = "."
venv = ".venv"

[tool.pytest.ini_options]
log_level = "DEBUG"
Loading

0 comments on commit ba0c04c

Please sign in to comment.