diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6610013..2e7f034 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ on: jobs: pypi_release: - name: Build with Poetry and Publish to PyPI + name: Build and Publish to PyPI runs-on: ubuntu-latest environment: name: pypi @@ -16,9 +16,12 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 - - name: Install and configure Poetry - run: pip install poetry - - name: Publish package - run: poetry build + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v5 + with: + version: latest + enable-cache: true + - name: Build package + run: uv build - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3bcffe1..b436298 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,23 +1,13 @@ name: Test on: - - push - - pull_request + pull_request: + push: + branches: + - main jobs: - pre_job: - runs-on: ubuntu-latest - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@master - with: - do_not_skip: '["pull_request"]' - cancel_others: 'true' - concurrent_skipping: same_content ruff: - needs: pre_job runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -44,15 +34,14 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install and configure Poetry - run: | - pip install poetry - poetry config virtualenvs.in-project true - - name: Install dependencies - run: poetry install + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v5 + with: + version: latest + enable-cache: true - name: Run pytest run: | - poetry run pytest -vvv -ra --cov=cryptojwt --cov-report=xml + uv run pytest -vvv -ra --cov=cryptojwt --cov-report=xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 with: diff --git a/.gitignore b/.gitignore index 05dd57f..777c976 100644 --- a/.gitignore +++ b/.gitignore @@ -137,5 +137,4 @@ tests/pyoidc tests/pyoidc.pub tests/xtest_usage.py -# Poetry -poetry.lock +*.lock diff --git a/Makefile b/Makefile index 81002fc..bbae2e2 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ all: test: - poetry run pytest --ruff --ruff-format --cov + uv run pytest --ruff --ruff-format --cov reformat: - poetry run ruff check --select I --fix src tests - poetry run ruff format src tests + uv run ruff check --select I --fix src tests + uv run ruff format src tests diff --git a/pyproject.toml b/pyproject.toml index ed17238..bd8b719 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,41 +1,51 @@ # PEP 518: https://www.python.org/dev/peps/pep-0518/ -[tool.poetry] +[project] name = "cryptojwt" -version = "1.9.4" +dynamic = ["version"] description = "Python implementation of JWT, JWE, JWS and JWK" -authors = ["Roland Hedberg "] +authors = [ + {name="Roland Hedberg", email = "roland@catalogix.se"} +] license = "Apache-2.0" repository = "https://github.com/IdentityPython/JWTConnect-Python-CryptoJWT" readme = "README.md" packages = [ { include = "cryptojwt", from = "src" } ] +requires-python = ">=3.9,<4.0" +dependencies = [ + "cryptography>=3.4.6", + "requests>=2.25.1" +] -[tool.poetry.scripts] +[project.scripts] jwkgen = "cryptojwt.tools.keygen:main" jwkconv = "cryptojwt.tools.keyconv:main" jwtpeek = "cryptojwt.tools.jwtpeek:main" -[tool.poetry.dependencies] -python = "^3.9" -cryptography = ">=3.4.6" -requests = "^2.25.1" +[build-system] +requires = ["hatchling", "uv-dynamic-versioning"] +build-backend = "hatchling.build" + +[tool.hatch.version] +source = "uv-dynamic-versioning" -[tool.poetry.group.dev.dependencies] -alabaster = "^0.7.12" -pytest = "^8.2.1" -pytest-cov = "^4.0.0" -responses = "^0.13.0" -sphinx = "^3.5.2" -sphinx-autobuild = "^2021.3.14" -coverage = "^7" -ruff = ">=0.9.9" -pytest-ruff = "^0.3.2" +[tool.hatch.metadata] +allow-direct-references = true -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" +[dependency-groups] +dev = [ + "alabaster>=0.7.12", + "pytest>=8.2.1", + "pytest-cov>=4.0.0", + "responses>=0.13.0", + "sphinx>=3.5.2", + "sphinx-autobuild>=2021.3.14", + "coverage>=7", + "ruff>=0.9.9", + "pytest-ruff>=0.3.2" +] [tool.coverage.run] branch = true diff --git a/src/cryptojwt/__init__.py b/src/cryptojwt/__init__.py index a53a26c..cd515ac 100644 --- a/src/cryptojwt/__init__.py +++ b/src/cryptojwt/__init__.py @@ -1,7 +1,7 @@ """JSON Web Token""" import logging -from importlib.metadata import version +from importlib.metadata import version, PackageNotFoundError from cryptojwt.jwe.jwe import JWE from cryptojwt.jwk import JWK @@ -13,7 +13,10 @@ from .exception import BadSyntax from .utils import as_unicode, b64d, b64encode_item, split_token -__version__ = version("cryptojwt") +try: + __version__ = version("cryptojwt") +except PackageNotFoundError: + __version__ = "0.0.0" __all__ = [ "JWE",