diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7b9c194..10e4bc8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,23 +7,71 @@ on: # manually triggered jobs: - build: + test: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + env: + UV_PYTHON: ${{ matrix.python-version }} steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} + - name: Checkout the repository + uses: actions/checkout@main + - name: Install the default version of uv + id: setup-uv + uses: astral-sh/setup-uv@v3 + - name: Print the installed version + run: echo "Installed uv version is ${{ steps.setup-uv.outputs.uv-version }}" + - name: Install Python ${{ matrix.python-version }} + run: uv python install ${{ matrix.python-version }} - name: Install dependencies - run: make env + run: | + uv venv + uv pip install ".[testing]" - name: Lint with pylint - run: make pylint + run: .venv/bin/pylint --rcfile .pylintrc backslash tests - name: Test with pytest - run: make test - - name: Documentation + run: .venv/bin/pytest tests --cov=backslash --cov-report=html + + docs: + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@main + - name: Install the default version of uv + id: setup-uv + uses: astral-sh/setup-uv@v3 + - name: Building docs run: make doc + + publish: + if: startsWith(github.ref, 'refs/tags/') + needs: test + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install hatch + run: pip install hatch + + - name: Build package + run: hatch build + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + attestations: true + skip-existing: true diff --git a/Makefile b/Makefile index ae2b4de..90cee10 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,15 @@ default: test test: env - .env/bin/pytest -x tests --cov=backslash --cov-report=html + .venv/bin/pytest -x tests --cov=backslash --cov-report=html pylint: env - .env/bin/pylint --rcfile .pylintrc backslash tests + .venv/bin/pylint --rcfile .pylintrc backslash tests doc: env - .env/bin/sphinx-build -a -W -E docs build/sphinx/html + .venv/bin/sphinx-build -a -W -E docs build/sphinx/html -env: .env/.up-to-date - - -.env/.up-to-date: Makefile pyproject.toml - python3 -m venv .env - .env/bin/pip install -e .[testing,doc] - touch $@ +env: + uv venv + uv pip install -e .[testing,doc] diff --git a/README.md b/README.md index 625fab6..32e3630 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ | | | |-----------------------|-----------------------------------------------------------------------------------------| -| Build Status | ![Build Status](https://github.com/getslash/backslash-python/actions/workflows/main.yml/badge.svg?branch=develop) | +| Build Status | ![Build Status](https://github.com/getslash/backslash-python/actions/workflows/main.yml/badge.svg?branch=master) | | Supported Versions | ![Supported Versions](https://img.shields.io/pypi/pyversions/backslash.svg) | | Latest Version | ![Latest Version](https://img.shields.io/pypi/v/backslash.svg) | -# Licence +# License BSD3 diff --git a/docs/changelog.rst b/docs/changelog.rst index 0ac17d2..d6b718e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,7 +1,8 @@ Changelog ========= -* :feature:`-` Support python versions 3.8 to 3.12 +* :feature:`-` Use UV +* :feature:`-` Support python versions 3.8 to 3.13 * :feature:`-` Use pyproject.toml for project configuration * :feature:`104` Drop support for python version < 3.6 * :release:`2.39.0 <03-07-2019>` diff --git a/pyproject.toml b/pyproject.toml index 7a5bc22..41832aa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,6 +15,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] dependencies = [ "GitPython", @@ -44,6 +45,10 @@ testing = [ "pytest-cov>=2.6", "URLObject", "weber-utils", + # Slash still using pkg_resources, installing setuptools as temporary workaround + # so this repo can be installed with UV + # Should be removed once a new version of slash will be released. + "setuptools<81", ] doc = ["alabaster", "releases", "Sphinx"] @@ -53,4 +58,6 @@ source = "vcs" [tool.pytest] testpaths = "tests" timeout_method = "signal" -addopts = "-ra -W error::DeprecationWarning" +# Current slash version uses pkg_resources, deprecated module, which emits warnings. +# This option (of consider warnings as errors) should be comment out, until a new slash version will be released. +# addopts = "-ra -W error::DeprecationWarning"