Skip to content

Commit 89490a1

Browse files
committed
Move from Poetry to UV and Hatching
1 parent 2b735fe commit 89490a1

File tree

6 files changed

+58
-54
lines changed

6 files changed

+58
-54
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
pypi_release:
9-
name: Build with Poetry and Publish to PyPI
9+
name: Build and Publish to PyPI
1010
runs-on: ubuntu-latest
1111
environment:
1212
name: pypi
@@ -16,9 +16,12 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818
- uses: actions/setup-python@v5
19-
- name: Install and configure Poetry
20-
run: pip install poetry
21-
- name: Publish package
22-
run: poetry build
19+
- name: Install the latest version of uv
20+
uses: astral-sh/setup-uv@v5
21+
with:
22+
version: latest
23+
enable-cache: true
24+
- name: Build package
25+
run: uv build
2326
- name: Publish package distributions to PyPI
2427
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yml

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
11
name: Test
22

33
on:
4-
- push
5-
- pull_request
4+
pull_request:
5+
push:
6+
branches:
7+
- main
68

79
jobs:
8-
pre_job:
9-
runs-on: ubuntu-latest
10-
outputs:
11-
should_skip: ${{ steps.skip_check.outputs.should_skip }}
12-
steps:
13-
- id: skip_check
14-
uses: fkirc/skip-duplicate-actions@master
15-
with:
16-
do_not_skip: '["pull_request"]'
17-
cancel_others: 'true'
18-
concurrent_skipping: same_content
1910
ruff:
20-
needs: pre_job
2111
runs-on: ubuntu-latest
2212
steps:
2313
- uses: actions/checkout@v4
@@ -44,15 +34,14 @@ jobs:
4434
uses: actions/setup-python@v5
4535
with:
4636
python-version: ${{ matrix.python-version }}
47-
- name: Install and configure Poetry
48-
run: |
49-
pip install poetry
50-
poetry config virtualenvs.in-project true
51-
- name: Install dependencies
52-
run: poetry install
37+
- name: Install the latest version of uv
38+
uses: astral-sh/setup-uv@v5
39+
with:
40+
version: latest
41+
enable-cache: true
5342
- name: Run pytest
5443
run: |
55-
poetry run pytest -vvv -ra --cov=cryptojwt --cov-report=xml
44+
uv run pytest -vvv -ra --cov=cryptojwt --cov-report=xml
5645
- name: Upload coverage to Codecov
5746
uses: codecov/codecov-action@v4
5847
with:

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,5 +137,4 @@ tests/pyoidc
137137
tests/pyoidc.pub
138138
tests/xtest_usage.py
139139

140-
# Poetry
141-
poetry.lock
140+
*.lock

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
all:
22

33
test:
4-
poetry run pytest --ruff --ruff-format --cov
4+
uv run pytest --ruff --ruff-format --cov
55

66
reformat:
7-
poetry run ruff check --select I --fix src tests
8-
poetry run ruff format src tests
7+
uv run ruff check --select I --fix src tests
8+
uv run ruff format src tests

pyproject.toml

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,51 @@
11
# PEP 518: https://www.python.org/dev/peps/pep-0518/
22

3-
[tool.poetry]
3+
[project]
44
name = "cryptojwt"
5-
version = "1.9.4"
5+
dynamic = ["version"]
66
description = "Python implementation of JWT, JWE, JWS and JWK"
7-
authors = ["Roland Hedberg <[email protected]>"]
7+
authors = [
8+
{name="Roland Hedberg", email = "[email protected]"}
9+
]
810
license = "Apache-2.0"
911
repository = "https://github.com/IdentityPython/JWTConnect-Python-CryptoJWT"
1012
readme = "README.md"
1113
packages = [
1214
{ include = "cryptojwt", from = "src" }
1315
]
16+
requires-python = ">=3.9,<4.0"
17+
dependencies = [
18+
"cryptography>=3.4.6",
19+
"requests>=2.25.1"
20+
]
1421

15-
[tool.poetry.scripts]
22+
[project.scripts]
1623
jwkgen = "cryptojwt.tools.keygen:main"
1724
jwkconv = "cryptojwt.tools.keyconv:main"
1825
jwtpeek = "cryptojwt.tools.jwtpeek:main"
1926

20-
[tool.poetry.dependencies]
21-
python = "^3.9"
22-
cryptography = ">=3.4.6"
23-
requests = "^2.25.1"
27+
[build-system]
28+
requires = ["hatchling", "uv-dynamic-versioning"]
29+
build-backend = "hatchling.build"
30+
31+
[tool.hatch.version]
32+
source = "uv-dynamic-versioning"
2433

25-
[tool.poetry.group.dev.dependencies]
26-
alabaster = "^0.7.12"
27-
pytest = "^8.2.1"
28-
pytest-cov = "^4.0.0"
29-
responses = "^0.13.0"
30-
sphinx = "^3.5.2"
31-
sphinx-autobuild = "^2021.3.14"
32-
coverage = "^7"
33-
ruff = ">=0.9.9"
34-
pytest-ruff = "^0.3.2"
34+
[tool.hatch.metadata]
35+
allow-direct-references = true
3536

36-
[build-system]
37-
requires = ["poetry-core>=1.0.0"]
38-
build-backend = "poetry.core.masonry.api"
37+
[dependency-groups]
38+
dev = [
39+
"alabaster>=0.7.12",
40+
"pytest>=8.2.1",
41+
"pytest-cov>=4.0.0",
42+
"responses>=0.13.0",
43+
"sphinx>=3.5.2",
44+
"sphinx-autobuild>=2021.3.14",
45+
"coverage>=7",
46+
"ruff>=0.9.9",
47+
"pytest-ruff>=0.3.2"
48+
]
3949

4050
[tool.coverage.run]
4151
branch = true

src/cryptojwt/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""JSON Web Token"""
22

33
import logging
4-
from importlib.metadata import version
4+
from importlib.metadata import version, PackageNotFoundError
55

66
from cryptojwt.jwe.jwe import JWE
77
from cryptojwt.jwk import JWK
@@ -13,7 +13,10 @@
1313
from .exception import BadSyntax
1414
from .utils import as_unicode, b64d, b64encode_item, split_token
1515

16-
__version__ = version("cryptojwt")
16+
try:
17+
__version__ = version("cryptojwt")
18+
except PackageNotFoundError:
19+
__version__ = "0.0.0"
1720

1821
__all__ = [
1922
"JWE",

0 commit comments

Comments
 (0)