From cc1086ccc3bdf467d1c9ff6e957c8de343e8d9a2 Mon Sep 17 00:00:00 2001 From: Ayala Shachar Date: Fri, 11 Oct 2024 11:01:12 +0300 Subject: [PATCH 1/5] Use UV instead of pip --- .github/workflows/main.yml | 16 +++++++++++----- Makefile | 16 ++++++---------- pyproject.toml | 8 +++++++- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7b9c194..32e88c0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,13 +12,19 @@ jobs: strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + 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 - name: Lint with pylint 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/pyproject.toml b/pyproject.toml index 7a5bc22..23bf685 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,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 +57,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" From fbbc0b8e45c6d1a091410255dcf7e897718dad5a Mon Sep 17 00:00:00 2001 From: Ayala Shachar Date: Fri, 11 Oct 2024 11:08:30 +0300 Subject: [PATCH 2/5] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 7c4af29e7dbdc8ded6fff6b27a25a0b4c0eae355 Mon Sep 17 00:00:00 2001 From: Ayala Shachar Date: Fri, 11 Oct 2024 11:09:37 +0300 Subject: [PATCH 3/5] Update supported python versions: >= 3.8, <= 3.13 --- .github/workflows/main.yml | 2 +- pyproject.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 32e88c0..a3ffd03 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ jobs: 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 }} diff --git a/pyproject.toml b/pyproject.toml index 23bf685..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", From 68af6261b90551ff381cf95b1756b12742eec261 Mon Sep 17 00:00:00 2001 From: Ayala Shachar Date: Fri, 3 Oct 2025 09:56:18 +0300 Subject: [PATCH 4/5] Update changelog --- docs/changelog.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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>` From e3e0a66d165be90ba3e9bf4e6dffde6a162a3aec Mon Sep 17 00:00:00 2001 From: Ayala Shachar Date: Fri, 3 Oct 2025 09:55:07 +0300 Subject: [PATCH 5/5] CI: Building env only once, run sphinx for specific python only & Add publish job --- .github/workflows/main.yml | 52 ++++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a3ffd03..10e4bc8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,7 @@ on: # manually triggered jobs: - build: + test: runs-on: ubuntu-latest strategy: matrix: @@ -26,10 +26,52 @@ jobs: - 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