From 4e8a4d74bb2ea5fd0d20003dd78f1c7c3995675d Mon Sep 17 00:00:00 2001 From: Jonathan Huot Date: Thu, 19 Jun 2025 17:29:13 +0200 Subject: [PATCH 1/5] Added graphviz/dot dependency --- .readthedocs.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index d76e42c7..6bdea12d 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -4,6 +4,8 @@ build: os: ubuntu-22.04 tools: python: "3.12" + apt_packages: + - graphviz # used for "dot" graphs sphinx: builder: html configuration: docs/conf.py From a015b446622f2b925517501fe484c10eff7a83c0 Mon Sep 17 00:00:00 2001 From: Jonathan Huot Date: Sat, 21 Jun 2025 09:48:27 +0200 Subject: [PATCH 2/5] Replace pyenv with uv in documentation and tooling (#910) * Removed black & lint since we use ruff * Add uv to use multiple python versions * Excluded folders when using make --- Makefile | 19 ++++++------------- docs/contributing.rst | 28 +++++++++++++++++----------- ruff.toml | 1 + 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 9622f70d..5313c80a 100644 --- a/Makefile +++ b/Makefile @@ -34,44 +34,37 @@ clean-build: @rm -fr dist/ @rm -fr *.egg-info -format fmt black: - black . - -lint ruff: - ruff check . - test: - tox + uvx --with tox-uv tox bottle: #--------------------------- # Library refinitiv/bottle-oauthlib # Contacts: Jonathan.Huot cd bottle-oauthlib 2>/dev/null || git clone https://github.com/refinitiv/bottle-oauthlib.git - cd bottle-oauthlib && sed -i.old 's,deps =,deps= --editable=file://{toxinidir}/../,' tox.ini && sed -i.old '/oauthlib/d' requirements.txt && tox + cd bottle-oauthlib && sed -i.old 's,deps =,deps= --editable=file://{toxinidir}/../,' tox.ini && sed -i.old '/oauthlib/d' requirements.txt && uvx --with tox-uv tox django: #--------------------------- # Library: evonove/django-oauth-toolkit # Contacts: evonove,masci - # (note: has tox.ini already) cd django-oauth-toolkit 2>/dev/null || git clone https://github.com/evonove/django-oauth-toolkit.git - cd django-oauth-toolkit && sed -i.old 's,deps =,deps= --editable=file://{toxinidir}/../,' tox.ini && tox + cd django-oauth-toolkit && sed -i.old 's,deps =,deps= --editable=file://{toxinidir}/../,' tox.ini && uvx --with tox-uv tox requests: #--------------------------- # Library requests/requests-oauthlib # Contacts: ib-lundgren,lukasa cd requests-oauthlib 2>/dev/null || git clone https://github.com/requests/requests-oauthlib.git - cd requests-oauthlib && sed -i.old 's,deps=,deps = --editable=file://{toxinidir}/../[signedtoken],' tox.ini && sed -i.old '/oauthlib/d' requirements.txt && tox + cd requests-oauthlib && sed -i.old 's,oauthlib.*,--editable=file://{toxinidir}/../../[signedtoken],' requirements.txt && uvx --with tox-uv tox dance: #--------------------------- # Library singingwolfboy/flask-dance # Contacts: singingwolfboy cd flask-dance 2>/dev/null || git clone https://github.com/singingwolfboy/flask-dance.git - cd flask-dance && sed -i.old 's,deps=,deps = --editable=file://{toxinidir}/../,' tox.ini && sed -i.old '/oauthlib/d' requirements.txt && tox + cd flask-dance && sed -i.old 's;"oauthlib.*";"oauthlib @ file://'`pwd`'/../";' pyproject.toml && uv venv && uv pip install -e '.[test]' && ./.venv/bin/coverage run -m pytest .DEFAULT_GOAL := all .PHONY: clean test bottle dance django flask requests -all: lint test bottle dance django flask requests +all: test bottle dance django flask requests diff --git a/docs/contributing.rst b/docs/contributing.rst index 9da1370c..19c08190 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -159,24 +159,22 @@ all versions conveniently at once can be done using `Tox`_. $ tox -Tox requires you to have `virtualenv`_ installed as well as respective python -version. We recommend using `pyenv`_ to install those Python versions. +Tox requires you to have respective python versions. We recommend using `uv`_ to install those Python versions. -We recommend using the latest patch version for each Python version we support and the latest PyPy versions. -The versions beloew may not be up to date. .. sourcecode:: bash - $ pyenv install -l # check which versions you want to use - $ pyenv install 3.8.18 - $ pyenv install 3.11.7 - $ pyenv install pypy3.10-7.3.13 + $ uv tool install tox --with tox-uv + $ uv python list # check which versions you want to use + $ uv python install 3.8 3.9 3.10 3.11 3.12 3.13 + $ uv python install pypy3 + $ uvx --with tox-uv tox # that run all tests with all python versions + .. _`Tox`: https://tox.readthedocs.io/en/latest/install.html -.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/installation/ -.. _`pyenv`: https://github.com/pyenv/pyenv +.. _`uv`: https://docs.astral.sh/uv/#python-versions -Test upstream applications +Test downstream applications ----------------------------------- Remember, OAuthLib is used by several 3rd party projects. If you think you @@ -186,6 +184,14 @@ submit a breaking change, confirm that other projects builds are not affected. $ make +Note be sure you are using ``uv`` as explained before with all python versions, including those from downstream libraries, to have all test cases running. + +As of 2025, additional downstreams python versions are as below: + +.. sourcecode:: bash + + $ uv python install pypy3.10 + If you add code, add tests! -------------------------------------- diff --git a/ruff.toml b/ruff.toml index ec45dd4b..9dffa813 100644 --- a/ruff.toml +++ b/ruff.toml @@ -5,6 +5,7 @@ # When switching from ruff.toml to pyproject.toml, use the section names that # start with [tool.ruff +exclude = ["flask-dance", "requests-oauthlib", "bottle-oauthlib", "django-oauth-toolkit"] # [tool.ruff] lint.select = [ From 79e08ce3735c9bdfa556283a3179e2d1d56e7a34 Mon Sep 17 00:00:00 2001 From: Jonathan Huot Date: Thu, 10 Jul 2025 19:03:26 +0200 Subject: [PATCH 3/5] Improve github action to publish package Separated build from publish job. Migrated from twine to python build Fix #913 --- .github/workflows/python-build.yml | 51 +++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/.github/workflows/python-build.yml b/.github/workflows/python-build.yml index 51623fad..659df716 100644 --- a/.github/workflows/python-build.yml +++ b/.github/workflows/python-build.yml @@ -19,6 +19,8 @@ jobs: allow-prereleases: true - name: Check out repository code uses: actions/checkout@v4 + with: + persist-credentials: false - name: Install prereq run: pip install tox coveralls - name: Run python tests @@ -58,16 +60,47 @@ jobs: python-version: "3.11" - name: Check out repository code uses: actions/checkout@v4 + with: + persist-credentials: false - name: Install prereq run: pip install tox - name: Run python tests run: tox -e ${{ matrix.toxenv }} - pypi-publish: + build: + name: Build oauthlib distribution needs: - tests - docs - coveralls - if: ${{ success() }} && github.repository == 'oauthlib/oauthlib' && startsWith(github.ref, 'refs/tags') + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Check out repository code + uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build wheel and tarball + run: python3 -m build + - name: Store the package's artifact + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + pypi-publish: + if: success() && github.repository == 'oauthlib/oauthlib' && startsWith(github.ref, 'refs/tags/') + needs: + - build name: Upload release to PyPI runs-on: ubuntu-latest environment: @@ -76,16 +109,10 @@ jobs: permissions: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing steps: - - name: Check out repository code - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - name: Download all the dists + uses: actions/download-artifact@v4 with: - python-version: '3.10' - - name: Install prereq - run: pip install build twine - - name: Build python package - run: python -m build - - name: Check python package - run: twine check dist/* + name: python-package-distributions + path: dist/ - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 From 07d50a4322fa45afe9c99e61b05e55f765a08c5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asif=20Saif=20Uddin=20=7B=22Auvi=22=3A=22=E0=A6=85?= =?UTF-8?q?=E0=A6=AD=E0=A6=BF=22=7D?= Date: Fri, 11 Jul 2025 12:55:01 +0600 Subject: [PATCH 4/5] Update .github/workflows/python-build.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) --- .github/workflows/python-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-build.yml b/.github/workflows/python-build.yml index 659df716..7b7c2557 100644 --- a/.github/workflows/python-build.yml +++ b/.github/workflows/python-build.yml @@ -98,7 +98,7 @@ jobs: name: python-package-distributions path: dist/ pypi-publish: - if: success() && github.repository == 'oauthlib/oauthlib' && startsWith(github.ref, 'refs/tags/') + if: success() && github.repository == 'oauthlib/oauthlib' && github.ref_type = 'tag' needs: - build name: Upload release to PyPI From fee688a39e0efb2f18eb6c141f43cc9f8b63fec7 Mon Sep 17 00:00:00 2001 From: Jonathan Huot Date: Sat, 12 Jul 2025 19:18:18 +0200 Subject: [PATCH 5/5] Fix ref_type equal sign Co-authored-by: Christian Clauss --- .github/workflows/python-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-build.yml b/.github/workflows/python-build.yml index 7b7c2557..477234b8 100644 --- a/.github/workflows/python-build.yml +++ b/.github/workflows/python-build.yml @@ -98,7 +98,7 @@ jobs: name: python-package-distributions path: dist/ pypi-publish: - if: success() && github.repository == 'oauthlib/oauthlib' && github.ref_type = 'tag' + if: success() && github.repository == 'oauthlib/oauthlib' && github.ref_type == 'tag' needs: - build name: Upload release to PyPI