From bd74cb4622db86d04c9e663d63d1ac00a44e8a2a Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Tue, 22 Oct 2024 20:47:56 -0400 Subject: [PATCH 1/5] Try to simplify some of the CI and add support for Python 3.13 --- .github/workflows/ci.yml | 7 ++++--- .github/workflows/doc.yml | 25 +++++++++---------------- .github/workflows/format.yml | 19 ++++--------------- .github/workflows/lint.yml | 17 +++-------------- .github/workflows/mypy.yml | 22 +++++++--------------- 5 files changed, 27 insertions(+), 63 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b35ac514..6a25f275 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,14 +2,14 @@ # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions name: CI -on: [push, pull_request] +on: [ push, pull_request ] jobs: ci: strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + os: [ ubuntu-latest, macos-latest, windows-latest ] + python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ] fail-fast: false runs-on: ${{ matrix.os }} steps: @@ -22,6 +22,7 @@ jobs: uses: actions/setup-python@v5 # https://github.com/actions/setup-python with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install python prerequisites run: pip install -U --user pip setuptools setuptools-scm nox - name: Run tests and post coverage results diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 9605605f..663b1401 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -2,30 +2,23 @@ # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions name: Doc -on: [push, pull_request] +on: [ push, pull_request, workflow_dispatch ] permissions: contents: read jobs: - doc: - strategy: - matrix: - os: [ubuntu-latest] - python-version: ["3.12"] - fail-fast: false - runs-on: ${{ matrix.os }} + build_docs: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 # https://github.com/actions/checkout + - uses: actions/setup-python@v5 with: + python-version: 3.13 + allow-prereleases: true # Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. # Set fetch-depth: 0 to fetch all history for all branches and tags. fetch-depth: 0 # Needed for setuptools_scm to work correctly - - name: Set up Python - uses: actions/setup-python@v5 # https://github.com/actions/setup-python - with: - python-version: ${{ matrix.python-version }} - - name: Install python prerequisites - run: pip install -U --user pip setuptools setuptools-scm nox - - name: Sphinx documentation build - run: python -m nox --non-interactive --session docs + - run: pip install --upgrade pip + - run: pip install -r docs/requirements.txt + - run: sphinx-build -c docs . docs/_build/html diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 9c474be9..bbef3430 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -8,24 +8,13 @@ permissions: contents: read jobs: - lint: - strategy: - matrix: - os: [ ubuntu-latest ] - python-version: [ "3.12" ] - fail-fast: false - runs-on: ${{ matrix.os }} + format: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 # https://github.com/actions/checkout with: # Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. # Set fetch-depth: 0 to fetch all history for all branches and tags. fetch-depth: 0 # Needed for setuptools_scm to work correctly - - name: Set up Python - uses: actions/setup-python@v5 # https://github.com/actions/setup-python - with: - python-version: ${{ matrix.python-version }} - - name: Install python prerequisites - run: pip install -U --user ruff - - name: Ruff format - run: ruff format --check + - run: pip install --user ruff + - run: ruff format --check diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 967e9a5f..50913bcf 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,23 +9,12 @@ permissions: jobs: lint: - strategy: - matrix: - os: [ ubuntu-latest ] - python-version: [ "3.12" ] - fail-fast: false - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 # https://github.com/actions/checkout with: # Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. # Set fetch-depth: 0 to fetch all history for all branches and tags. fetch-depth: 0 # Needed for setuptools_scm to work correctly - - name: Set up Python - uses: actions/setup-python@v5 # https://github.com/actions/setup-python - with: - python-version: ${{ matrix.python-version }} - - name: Install python prerequisites - run: pip install -U --user ruff - - name: Ruff lint - run: ruff check + - run: pip install --user ruff + - run: ruff check --output-format=github . diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 727ed43d..cf1833fd 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -2,30 +2,22 @@ # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions name: MyPy -on: [push, pull_request] +on: [ push, pull_request ] permissions: contents: read jobs: mypy: - strategy: - matrix: - os: [ubuntu-latest] - python-version: ["3.12"] - fail-fast: false - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 # https://github.com/actions/checkout + - uses: actions/setup-python@v5 # https://github.com/actions/setup-python with: + python-version: 3.13 + allow-prereleases: true # Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. # Set fetch-depth: 0 to fetch all history for all branches and tags. fetch-depth: 0 # Needed for setuptools_scm to work correctly - - name: Set up Python - uses: actions/setup-python@v5 # https://github.com/actions/setup-python - with: - python-version: ${{ matrix.python-version }} - - name: Install python prerequisites - run: pip install -U --user pip setuptools setuptools-scm nox - - name: MyPy - run: python -m nox --non-interactive --session validate-${{ matrix.python-version }} -k mypy # Run nox for mypy + - run: pip install -U --user pip setuptools setuptools-scm nox + - run: python -m nox --non-interactive --session validate-${{ python-version }} -k mypy # Run nox for mypy From 4af169d8bddf07afcebe9021e4d90c836cf2de18 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Tue, 22 Oct 2024 20:54:59 -0400 Subject: [PATCH 2/5] Add support for Python 3.13 to noxfile.py --- docs/requirements.txt | 3 +++ noxfile.py | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 42757cc2..f32ef6e9 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,6 @@ + +pyperclip Sphinx>=8.1.0 sphinx-autobuild>=2024.10.3 sphinx-rtd-theme>=3.0.1 +wcwidth diff --git a/noxfile.py b/noxfile.py index 9ec2ce16..11ecdcab 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,7 +1,7 @@ import nox -@nox.session(python=['3.12']) +@nox.session(python=['3.13']) def docs(session): session.install( 'sphinx', @@ -17,7 +17,7 @@ def docs(session): ) -@nox.session(python=['3.8', '3.9', '3.10', '3.11', '3.12']) +@nox.session(python=['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']) @nox.parametrize('plugin', [None, 'ext_test', 'template', 'coverage']) def tests(session, plugin): if plugin is None: @@ -41,7 +41,7 @@ def tests(session, plugin): ) -@nox.session(python=['3.8', '3.9', '3.10', '3.11', '3.12']) +@nox.session(python=['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']) @nox.parametrize('step', ['mypy', 'flake8']) def validate(session, step): session.install('invoke', './[validate]') From 3c68b562154db4063230effa4c3c3cc224dff739 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Tue, 22 Oct 2024 21:02:09 -0400 Subject: [PATCH 3/5] Add missing requirements to docs/requirements.txt --- docs/requirements.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index f32ef6e9..58a108b5 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,6 +1,8 @@ pyperclip -Sphinx>=8.1.0 -sphinx-autobuild>=2024.10.3 -sphinx-rtd-theme>=3.0.1 +setuptools +setuptools-scm +Sphinx +sphinx-autobuild +sphinx-rtd-theme wcwidth From 051fcf8258af1de2a0a2a825859152ed06a1e1e1 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Tue, 22 Oct 2024 21:11:37 -0400 Subject: [PATCH 4/5] Update Changelog and revert Sphinx build to use nox --- .github/workflows/doc.yml | 5 ++--- CHANGELOG.md | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 663b1401..e6ecf820 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -19,6 +19,5 @@ jobs: # Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. # Set fetch-depth: 0 to fetch all history for all branches and tags. fetch-depth: 0 # Needed for setuptools_scm to work correctly - - run: pip install --upgrade pip - - run: pip install -r docs/requirements.txt - - run: sphinx-build -c docs . docs/_build/html + - run: pip install --upgrade pip setuptools setuptools-scm nox + - run: python -m nox --non-interactive --session docs diff --git a/CHANGELOG.md b/CHANGELOG.md index 66a5a3f6..1c08fe83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.5.0 (TBD) +## 2.5.0 (October 22, 2024) * Breaking Change * `cmd2` 2.5 supports Python 3.8+ (removed support for Python 3.6 and 3.7) * Bug Fixes @@ -12,7 +12,7 @@ * Removed dependency on `attrs` and replaced with [dataclasses](https://docs.python.org/3/library/dataclasses.html) * add `allow_clipboard` initialization parameter and attribute to disable ability to add output to the operating system clipboard - * Updated unit tests to be Python 3.12 compliant. + * Updated unit tests to be Python 3.13 compliant. * Fall back to bz2 compression of history file when lzma is not installed. * Added settable called `scripts_add_to_history` which determines whether scripts and pyscripts add commands to history. From 807e619dd8f0c5b3a1b57577d31cf87170d8b40d Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Tue, 22 Oct 2024 21:16:53 -0400 Subject: [PATCH 5/5] Revert doc.yml to where it was --- .github/workflows/doc.yml | 22 +++++++++++++++------- noxfile.py | 2 +- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index e6ecf820..5349f6b2 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -8,16 +8,24 @@ permissions: contents: read jobs: - build_docs: - runs-on: ubuntu-latest + doc: + strategy: + matrix: + os: [ ubuntu-latest ] + python-version: [ "3.12" ] + fail-fast: false + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 # https://github.com/actions/checkout - - uses: actions/setup-python@v5 with: - python-version: 3.13 - allow-prereleases: true # Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. # Set fetch-depth: 0 to fetch all history for all branches and tags. fetch-depth: 0 # Needed for setuptools_scm to work correctly - - run: pip install --upgrade pip setuptools setuptools-scm nox - - run: python -m nox --non-interactive --session docs + - name: Set up Python + uses: actions/setup-python@v5 # https://github.com/actions/setup-python + with: + python-version: ${{ matrix.python-version }} + - name: Install python prerequisites + run: pip install -U --user pip setuptools setuptools-scm nox + - name: Sphinx documentation build + run: python -m nox --non-interactive --session docs diff --git a/noxfile.py b/noxfile.py index 11ecdcab..30013e1d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,7 +1,7 @@ import nox -@nox.session(python=['3.13']) +@nox.session(python=['3.12']) def docs(session): session.install( 'sphinx',