From a656518ee07f8878a65cb0653000c6d705a42233 Mon Sep 17 00:00:00 2001 From: hejamu Date: Wed, 3 Apr 2024 15:40:01 +0200 Subject: [PATCH 01/11] Fix changelog check --- devtools/check_changelog.py | 32 +++++++++++++++++++++----------- docs/CHANGELOG.rst | 1 + tox.ini | 3 ++- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/devtools/check_changelog.py b/devtools/check_changelog.py index 6cc79d1..bc46120 100644 --- a/devtools/check_changelog.py +++ b/devtools/check_changelog.py @@ -5,11 +5,10 @@ * additions are reported in CHANGELOG.rst """ +import os from pathlib import Path -folder = Path(__file__).resolve().parents[1] -changelog = Path('docs', 'CHANGELOG.rst') -contributing = Path('docs', 'CONTRIBUTING.rst') +import git class ChangelogError(Exception): @@ -18,13 +17,24 @@ class ChangelogError(Exception): pass -with open(Path(folder, changelog), 'r') as fin: +folder = Path(__file__).resolve().parents[1] +changelog = Path("docs", "CHANGELOG.rst") +contributing = Path("docs", "CONTRIBUTING.rst") + +repo = git.Repo(folder) + +if repo.active_branch.name == "main": + print("You are on the main branch. Nothing to check.") + exit(0) + +with open(Path(folder, changelog), "r") as fin: for line in fin: - if line.startswith('v'): + if line.startswith("v"): raise ChangelogError( - 'You have not updated the CHANGELOG file. ' - f'Please add a summary of your additions to {str(changelog)!r} ' - f'as described in {str(contributing)!r}.' - ) - elif line.startswith('*'): - break + "You have not updated the CHANGELOG file. " + f"Please add a summary of your additions to {str(changelog)!r} " + f"as described in {str(contributing)!r}." + ) + elif line.startswith("*"): + print("Changelog updated.") + exit(0) diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index 4a77fdc..8d89f0e 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -2,6 +2,7 @@ Changelog ========= +* Change handling of CHANGELOG checks v0.1.30 (2024-04-03) ------------------------------------------ diff --git a/tox.ini b/tox.ini index dcc94bc..01e7e52 100644 --- a/tox.ini +++ b/tox.ini @@ -71,7 +71,6 @@ skip_install = true commands_pre = python {toxinidir}/devtools/clean_dist_check.py commands = python --version - python {toxinidir}/devtools/check_changelog.py python -m build twine check dist/*.whl twine check dist/*.tar.gz @@ -95,8 +94,10 @@ commands = usedevelop = true deps = -r{toxinidir}/devtools/docs_requirements.txt + gitpython commands = sphinx-build {posargs:-E} -b html docs/rst dist/docs + python {toxinidir}/devtools/check_changelog.py [testenv:safety] deps = safety From 3e0638ae830d644a941c7fd576df222c348bfa30 Mon Sep 17 00:00:00 2001 From: hejamu Date: Wed, 3 Apr 2024 15:49:41 +0200 Subject: [PATCH 02/11] check even in detached state --- devtools/check_changelog.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/devtools/check_changelog.py b/devtools/check_changelog.py index bc46120..6643e40 100644 --- a/devtools/check_changelog.py +++ b/devtools/check_changelog.py @@ -23,7 +23,10 @@ class ChangelogError(Exception): repo = git.Repo(folder) -if repo.active_branch.name == "main": +# Check if the developer is on the main branch +# We check if the head commit is the same as the main branch head commit +# as the CI will be in detached head state +if repo.head.commit == repo.branches["main"].commit: print("You are on the main branch. Nothing to check.") exit(0) @@ -32,8 +35,8 @@ class ChangelogError(Exception): if line.startswith("v"): raise ChangelogError( "You have not updated the CHANGELOG file. " - f"Please add a summary of your additions to {str(changelog)!r} " - f"as described in {str(contributing)!r}." + f"Please add a summary of your additions to {str(changelog)!r}" + f" as described in {str(contributing)!r}." ) elif line.startswith("*"): print("Changelog updated.") From 5fd7fa20da32d1cb30708ca4645360dcf4ceee59 Mon Sep 17 00:00:00 2001 From: hejamu Date: Mon, 8 Jul 2024 11:11:13 +0200 Subject: [PATCH 03/11] Cleanup --- devtools/check_changelog.py | 1 - 1 file changed, 1 deletion(-) diff --git a/devtools/check_changelog.py b/devtools/check_changelog.py index 6643e40..06256e6 100644 --- a/devtools/check_changelog.py +++ b/devtools/check_changelog.py @@ -19,7 +19,6 @@ class ChangelogError(Exception): folder = Path(__file__).resolve().parents[1] changelog = Path("docs", "CHANGELOG.rst") -contributing = Path("docs", "CONTRIBUTING.rst") repo = git.Repo(folder) From ac5e2ac2e5952209b0b9335740674b41f30cbb6a Mon Sep 17 00:00:00 2001 From: hejamu Date: Mon, 8 Jul 2024 11:34:25 +0200 Subject: [PATCH 04/11] Try something different --- .github/workflows/docs.yml | 4 ++++ devtools/check_changelog.py | 1 + 2 files changed, 5 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e055d2f..60f5da0 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -19,6 +19,10 @@ jobs: - run: pip install tox - name: Build docs + uses: actions/checkout@v3 + with: + ref: ${{ github.head_ref }} + fetch-depth: 0 run: tox -e docs - name: Deploy docs diff --git a/devtools/check_changelog.py b/devtools/check_changelog.py index 06256e6..6643e40 100644 --- a/devtools/check_changelog.py +++ b/devtools/check_changelog.py @@ -19,6 +19,7 @@ class ChangelogError(Exception): folder = Path(__file__).resolve().parents[1] changelog = Path("docs", "CHANGELOG.rst") +contributing = Path("docs", "CONTRIBUTING.rst") repo = git.Repo(folder) From 793573a395bd5521e0dab1a8981e9b701b34812c Mon Sep 17 00:00:00 2001 From: hejamu Date: Mon, 8 Jul 2024 11:37:47 +0200 Subject: [PATCH 05/11] Try to fetch the repo --- .github/workflows/docs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 60f5da0..6b200a1 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -19,7 +19,6 @@ jobs: - run: pip install tox - name: Build docs - uses: actions/checkout@v3 with: ref: ${{ github.head_ref }} fetch-depth: 0 From a95d661f5e1287db5d76573d39c12f13f3801374 Mon Sep 17 00:00:00 2001 From: hejamu Date: Mon, 8 Jul 2024 11:45:23 +0200 Subject: [PATCH 06/11] Tell actions to fetch tags --- .github/workflows/docs.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6b200a1..84cfa31 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -12,6 +12,10 @@ jobs: steps: - uses: actions/checkout@v3 + with: + ref: ${{ github.head_ref }} + fetch-depth: 1 + fetch-tags: True - name: Set up Python 3.10 uses: actions/setup-python@v4 with: @@ -19,9 +23,7 @@ jobs: - run: pip install tox - name: Build docs - with: - ref: ${{ github.head_ref }} - fetch-depth: 0 + run: tox -e docs - name: Deploy docs From 4abbed39183712fbaebdbc4a7ac923ad3783a8f9 Mon Sep 17 00:00:00 2001 From: hejamu Date: Mon, 8 Jul 2024 11:57:48 +0200 Subject: [PATCH 07/11] Fix gitpython check --- .github/workflows/docs.yml | 2 +- devtools/check_changelog.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 84cfa31..3e0f59d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v3 - with: + with: ref: ${{ github.head_ref }} fetch-depth: 1 fetch-tags: True diff --git a/devtools/check_changelog.py b/devtools/check_changelog.py index 6643e40..d2b3625 100644 --- a/devtools/check_changelog.py +++ b/devtools/check_changelog.py @@ -26,7 +26,7 @@ class ChangelogError(Exception): # Check if the developer is on the main branch # We check if the head commit is the same as the main branch head commit # as the CI will be in detached head state -if repo.head.commit == repo.branches["main"].commit: +if repo.active_branch.name == 'main': print("You are on the main branch. Nothing to check.") exit(0) From 4d9319a1db5f272e7067df4968b8a5a23f3b45bc Mon Sep 17 00:00:00 2001 From: hejamu Date: Mon, 8 Jul 2024 12:02:54 +0200 Subject: [PATCH 08/11] Bump python version, remove unsupported --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0051c3c..d948d0d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: platform: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v3 From 575f252889101aee447780e85b71fce32e96cd06 Mon Sep 17 00:00:00 2001 From: hejamu Date: Mon, 8 Jul 2024 13:28:43 +0200 Subject: [PATCH 09/11] Codecov bump to 4 --- .github/workflows/build.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 01cbb8f..0f188c6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: platform: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b6cfb52..19ba502 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: platform: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d948d0d..b505c73 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,9 +27,11 @@ jobs: run: tox -e test - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: env_vars: OS,PYTHON files: ./coverage.xml fail_ci_if_error: true verbose: true + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file From 61c77dd2174d1fd2cb61c9d22c7c790c2a69510c Mon Sep 17 00:00:00 2001 From: hejamu Date: Mon, 8 Jul 2024 13:32:47 +0200 Subject: [PATCH 10/11] Bump python version in toml --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 500a049..52fd9e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ authors = [ {name = "MDAnalysis Development Team and contributors", email = "mdanalysis@numfocus.org"}, ] readme = "README.rst" -requires-python = ">=3.8" +requires-python = ">=3.9" keywords = [ "python", "cli", @@ -36,10 +36,10 @@ classifiers = [ "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Bio-Informatics", "Topic :: Scientific/Engineering :: Chemistry", From b8278d9b8e89b6263ce1a8a1f5c63e36afccefb4 Mon Sep 17 00:00:00 2001 From: hejamu Date: Mon, 8 Jul 2024 14:01:57 +0200 Subject: [PATCH 11/11] Finish up --- .github/workflows/docs.yml | 1 - .github/workflows/test.yml | 2 +- docs/CHANGELOG.rst | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 3e0f59d..d1357ed 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -23,7 +23,6 @@ jobs: - run: pip install tox - name: Build docs - run: tox -e docs - name: Deploy docs diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b505c73..5aadd30 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,4 +34,4 @@ jobs: fail_ci_if_error: true verbose: true env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index 8d89f0e..9f61bdc 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -2,6 +2,8 @@ Changelog ========= +* Add Python 3.12 +* Remove Python 3.8 * Change handling of CHANGELOG checks v0.1.30 (2024-04-03)