From 14edb8d9f3bdfffa2cb94624c137fd049a68d33c Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Tue, 8 Nov 2022 22:36:21 -0500 Subject: [PATCH 01/36] Bump version to 2.3.1.dev0 --- src/sphobjinv/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sphobjinv/version.py b/src/sphobjinv/version.py index 566fa7a..21e130e 100644 --- a/src/sphobjinv/version.py +++ b/src/sphobjinv/version.py @@ -29,4 +29,4 @@ """ -__version__ = "2.3" +__version__ = "2.3.1.dev0" From c9b280b69aac1f4427163c8e44fd82a0422343dd Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Fri, 11 Nov 2022 00:03:46 -0500 Subject: [PATCH 02/36] Fix CHANGELOG entry in wrong place The suggest inventory count message was not added in v2.2.2, it was part of the CLI campaign of v2.3. --- CHANGELOG.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ff2955..9ef7ffc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,10 @@ and this project strives to adhere to with the URLs it checks when trying to retrieve a remote inventory. ([#99](https://github.com/bskinn/sphobjinv/issues/99), plus more) + * CLI 'suggest' results output now displays more information about + the total number of objects in the inventory, the search score threshold, + and the number of results falling at/above that threshold. + * A new CLI option, `-p`/`--paginate`, enables paging of the results from the `suggest` feature. ([#70](https://github.com/bskinn/sphobjinv/issues/70)) @@ -105,12 +109,6 @@ and this project strives to adhere to ### [2.2.2] - 2022-03-22 -#### Changed - - * CLI 'suggest' results output now displays more information about - the total number of objects in the inventory, the search score threshold, - and the number of results falling at/above that threshold. - #### Fixed * UnicodeDecodeErrors are ignored within the vendored `fuzzywuzzy` package From 312b1787c2ac45fc2b6ff27b28bc3a54801f8e02 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Fri, 11 Nov 2022 00:06:11 -0500 Subject: [PATCH 03/36] Add issue reference for moved CHANGELOG bullet --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ef7ffc..7addc3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ and this project strives to adhere to * CLI 'suggest' results output now displays more information about the total number of objects in the inventory, the search score threshold, and the number of results falling at/above that threshold. + ([#232](https://github.com/bskinn/sphobjinv/issues/232)) * A new CLI option, `-p`/`--paginate`, enables paging of the results from the `suggest` feature. ([#70](https://github.com/bskinn/sphobjinv/issues/70)) From 1cce07bcbab45ace83c7c6e3c530bf4a44c57cde Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Mon, 14 Nov 2022 12:04:46 -0500 Subject: [PATCH 04/36] Compartmentalize README doc/shell tests (#261) * Compartmentalize README doc/shell tests They're now no longer run as part of the core test suite; only as part of the Azure Pipelines auxiliary CI. This will help ease the pain of #260, and also will minimize the thrashing of the commit history during general development... README glitches will only be surfaced on PR merge and releases. Closes #260. * Add --readme to 'check all tests ran' step * Add pragma for case of failed CLI load attempt --- azure-pipelines.yml | 22 +++++++++++++++++++++- conftest.py | 1 + src/sphobjinv/cli/load.py | 2 +- tests/test_readme.py | 14 ++++++++++++++ tox.ini | 2 +- 5 files changed, 38 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 893d097..7ca1dcc 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -126,6 +126,26 @@ stages: - script: cd doc; make doctest displayName: Run doctests + - job: readme + displayName: Run README doctests/shell tests + + pool: + vmImage: 'Ubuntu-latest' + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.10' + + - script: pip install -r requirements-ci.txt + displayName: Install CI requirements + + - script: cd doc; make html + displayName: Build docs + + - script: pytest -k readme --readme --doctest-glob="README.rst" + displayName: Run README doc/shell tests + - job: linkcheck displayName: Run docs link-check suite @@ -161,7 +181,7 @@ stages: - script: cd doc; make html; mkdir scratch displayName: Build docset - - script: pytest --cov=. --nonloc --flake8_ext + - script: pytest --cov=. --nonloc --flake8_ext --readme displayName: Run pytest with coverage on the entire project tree - script: coverage report --include="tests/*" --fail-under=100 diff --git a/conftest.py b/conftest.py index a4e7729..270bdf4 100644 --- a/conftest.py +++ b/conftest.py @@ -63,6 +63,7 @@ def pytest_addoption(parser): parser.addoption( "--flake8_ext", action="store_true", help="Include flake8 extensions test" ) + parser.addoption("--readme", action="store_true", help="Include README shell tests") @pytest.fixture(scope="session") diff --git a/src/sphobjinv/cli/load.py b/src/sphobjinv/cli/load.py index fc8c075..f9bd326 100644 --- a/src/sphobjinv/cli/load.py +++ b/src/sphobjinv/cli/load.py @@ -170,7 +170,7 @@ def attempt_inv_load(url, params): print_stderr(f" ... HTTP error: {e.code} {e.reason}.", params) except URLError: # pragma: no cover print_stderr(" ... error attempting to retrieve URL.", params) - except VersionError: + except VersionError: # pragma: no cover print_stderr(" ... no recognized inventory.", params) except ValueError: print_stderr( diff --git a/tests/test_readme.py b/tests/test_readme.py index bddd949..d22a1e9 100644 --- a/tests/test_readme.py +++ b/tests/test_readme.py @@ -58,6 +58,20 @@ ) +pytestmark = [pytest.mark.readme] + + +@pytest.fixture(scope="module", autouse=True) +def skip_if_no_readme_option(pytestconfig): + """Skip test if --readme not provided. + + Auto-applied to all functions in module, since module is dedicated to README. + + """ + if not pytestconfig.getoption("--readme"): + pytest.skip("'--readme' not specified") # pragma: no cover + + @pytest.mark.skipif( sphinx_ver != sphinx_req, reason="Skip if Sphinx version mismatches current dev version.", diff --git a/tox.ini b/tox.ini index 13d861b..e396557 100644 --- a/tox.ini +++ b/tox.ini @@ -124,7 +124,7 @@ markers = first: Inherited marker from `pytest-ordering` timeout: Inherited marker from `pytest-timeout` -addopts = --strict-markers --doctest-glob="README.rst" -rsxX -Werror +addopts = --strict-markers -rsxX -Werror norecursedirs = .* env* src *.egg dist build From 648d3e8377c030509b14870c0434628abb6a85f0 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Tue, 22 Nov 2022 20:18:20 -0500 Subject: [PATCH 05/36] Rearrange suggest output and sys.exit Closes #262 anc closes #263. --- README.rst | 23 ++++++++++++++++++----- src/sphobjinv/cli/suggest.py | 16 ++++++++++++++-- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index c1803f5..9ce5750 100644 --- a/README.rst +++ b/README.rst @@ -57,14 +57,21 @@ For internal cross-references, locate ``objects.inv`` within ``build/html``:: $ sphobjinv suggest doc/build/html/objects.inv as_rst -st 58 + ------------------------------------------------ + + Cannot infer intersphinx_mapping from a local objects.inv. + + ------------------------------------------------ + Project: sphobjinv Version: 2.3 219 objects in inventory. + ------------------------------------------------ + 11 results found at/above current threshold of 58. - Cannot infer intersphinx_mapping from a local objects.inv. Name Score --------------------------------------------------- ------- @@ -103,16 +110,22 @@ cross-reference the ``linspace`` function from numpy (see Attempting "https://numpy.org/doc/1.23/objects.inv" ... ... inventory found. + ------------------------------------------------ + + The intersphinx_mapping for this docset is LIKELY: + + (https://numpy.org/doc/1.23/, None) + + ------------------------------------------------ + Project: NumPy Version: 1.23 8074 objects in inventory. - 8 results found at/above current threshold of 75. - - The intersphinx_mapping for this docset is LIKELY: + ------------------------------------------------ - (https://numpy.org/doc/1.23/, None) + 8 results found at/above current threshold of 75. Name Score diff --git a/src/sphobjinv/cli/suggest.py b/src/sphobjinv/cli/suggest.py index 92c0280..8bd7d65 100644 --- a/src/sphobjinv/cli/suggest.py +++ b/src/sphobjinv/cli/suggest.py @@ -78,14 +78,21 @@ def do_suggest(inv, params): with_score=with_score, ) + print_divider(params) + print_stderr_inferred_mapping(params) + print_divider(params) + print_stderr(f"Project: {inv.project}", params) print_stderr(f"Version: {inv.version}\n", params) print_stderr(f"{inv.count} objects in inventory.\n", params) + print_divider(params) print_stderr_result_count(params, results) - print_stderr_inferred_mapping(params) + if not results: + print_stderr("\nExiting...\n", params) + sys.exit(0) # The query here for printing the full list only occurs in some # circumstances; see the function docstring. @@ -94,6 +101,12 @@ def do_suggest(inv, params): print_results_table(with_index, with_score, results, params) +def print_divider(params): + """Print a visual divider to break up sections of the CLI output.""" + length = shutil.get_terminal_size().columns * 3 // 5 + print_stderr("-" * length + "\n", params) + + def print_stderr_result_count(params, results): """Report the count of found objects from the suggest search.""" if len(results) == 0: @@ -104,7 +117,6 @@ def print_stderr_result_count(params, results): ), params, ) - sys.exit(0) else: print_stderr( ( From b206c683c1987b418451a72c8884651690ec857d Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Tue, 22 Nov 2022 21:28:08 -0500 Subject: [PATCH 06/36] Bump pre-commit hook versions --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ccc2af3..f52668c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,17 +2,17 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: 'v3.2.0' + rev: 'v4.3.0' hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files - repo: https://github.com/psf/black - rev: '22.3.0' + rev: '22.10.0' hooks: - id: black - repo: https://github.com/tox-dev/pyproject-fmt - rev: '0.3.2' + rev: '0.3.5' hooks: - id: pyproject-fmt From fc067f8360f0322f078f56e028748e2f50fe2200 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Tue, 22 Nov 2022 21:52:41 -0500 Subject: [PATCH 07/36] Update CHANGELOG --- CHANGELOG.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7addc3b..915bc21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,22 @@ and this project strives to adhere to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +### (unreleased) + +#### Changed + + * The printout of the inferred `intersphinx_mapping` item for inventories + retrieved by URL (`--url`) in the 'suggest' CLI mode is now relocated to + fall immediately below the inventory-search output. ([#262](https://github.com/bskinn/sphobjinv/issues/262)) + + * The 'suggest' CLI mode output now includes dividers for improved + readability. + +#### Internal + + * The `sys.exit()` in the case of no objects falling above the 'suggest' search threshold was refactored into the main `do_suggest()` body, to minimize the surprise of an `exit()` call coming in a subfunction. ([#263](https://github.com/bskinn/sphobjinv/issues/263)) + + ### [2.3] - 2022-11-08 #### Added @@ -66,7 +82,8 @@ and this project strives to adhere to `objects_sphinx.inv`, and the previous v1.6.6 was renamed to `objects_sphinx_1_6_6.inv`. - * The 'valid objects' test cases were updated to reflect the possibility for a colon within `{role}`: + * The 'valid objects' test cases were updated to reflect the possibility for a + colon within `{role}`: * The colon-within-`{role}` test case was moved from 'invalid' to 'valid'. From f8437917e3d4f43617ad4ae5a30042c2de13343d Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Tue, 22 Nov 2022 22:53:54 -0500 Subject: [PATCH 08/36] Update README with doctest output --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 9ce5750..22fb40f 100644 --- a/README.rst +++ b/README.rst @@ -66,7 +66,7 @@ For internal cross-references, locate ``objects.inv`` within ``build/html``:: Project: sphobjinv Version: 2.3 - 219 objects in inventory. + 220 objects in inventory. ------------------------------------------------ @@ -170,7 +170,7 @@ inventory creation/modification:: >>> import sphobjinv as soi >>> inv = soi.Inventory('doc/build/html/objects.inv') >>> print(inv) - + >>> inv.project 'sphobjinv' >>> inv.version From 9682a68d30eb8c79b9d2c220b170caf66a940b7e Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Tue, 22 Nov 2022 23:10:44 -0500 Subject: [PATCH 09/36] Split code and content licenses Definitely prefer to have Github report the code license accurately in the repo sidebar. --- CONTENT_LICENSE.txt | 4 ++++ LICENSE.txt | 13 ------------- 2 files changed, 4 insertions(+), 13 deletions(-) create mode 100644 CONTENT_LICENSE.txt diff --git a/CONTENT_LICENSE.txt b/CONTENT_LICENSE.txt new file mode 100644 index 0000000..d5cf27b --- /dev/null +++ b/CONTENT_LICENSE.txt @@ -0,0 +1,4 @@ +The sphobjinv documentation (including docstrings) is licensed under a Creative +Commons Attribution 4.0 International License (CC-BY). + +See http://creativecommons.org/licenses/by/4.0/. diff --git a/LICENSE.txt b/LICENSE.txt index 8cf9895..3a32da7 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,16 +1,3 @@ -The sphobjinv documentation (including docstrings) is licensed under a Creative -Commons Attribution 4.0 International License (CC-BY). - -See http://creativecommons.org/licenses/by/4.0/. - - -The sphobjinv codebase is released under the MIT License, the text of which is -included below. - - -==================================================================================== - - The MIT License (MIT) Copyright (c) 2016-2022 Brian Skinn and community contributors From 8642c0e059ac38bb4afbe46b148e4a58ec9ad4d2 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Tue, 22 Nov 2022 23:12:12 -0500 Subject: [PATCH 10/36] Update content license text In README footer and new CONTENT_LICENSE.txt file --- CONTENT_LICENSE.txt | 4 ++-- README.rst | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CONTENT_LICENSE.txt b/CONTENT_LICENSE.txt index d5cf27b..d187275 100644 --- a/CONTENT_LICENSE.txt +++ b/CONTENT_LICENSE.txt @@ -1,4 +1,4 @@ -The sphobjinv documentation (including docstrings) is licensed under a Creative -Commons Attribution 4.0 International License (CC-BY). +The sphobjinv documentation (including docstrings and README) is licensed under +a Creative Commons Attribution 4.0 International License (CC-BY). See http://creativecommons.org/licenses/by/4.0/. diff --git a/README.rst b/README.rst index 22fb40f..546bcb0 100644 --- a/README.rst +++ b/README.rst @@ -198,7 +198,8 @@ and feature requests are welcomed at the Copyright (c) Brian Skinn 2016-2022 -The ``sphobjinv`` documentation (including docstrings) is licensed under a +The ``sphobjinv`` documentation (including docstrings and README) is licensed +under a `Creative Commons Attribution 4.0 International License `__ (CC-BY). The ``sphobjinv`` codebase is released under the `MIT License `__. See From 6fa67e5b2a62746b69321b213fcf0185a5cfbd2b Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Wed, 23 Nov 2022 14:50:26 -0500 Subject: [PATCH 11/36] Update pytest-check pin and check usage Resolves #265. --- requirements-ci.txt | 2 +- requirements-dev.txt | 2 +- tests/test_api_good.py | 6 +++--- tests/test_cli.py | 4 ++-- tests/test_fixture.py | 2 +- tests/test_flake8_ext.py | 2 +- tests/test_readme.py | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/requirements-ci.txt b/requirements-ci.txt index 0646ec4..e2ab803 100644 --- a/requirements-ci.txt +++ b/requirements-ci.txt @@ -6,7 +6,7 @@ dictdiffer jsonschema md-toc pytest>=4.4.0 -pytest-check>=0.4 +pytest-check>=1.1.2 pytest-cov pytest-ordering pytest-timeout diff --git a/requirements-dev.txt b/requirements-dev.txt index 0cba0c8..3a15831 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -9,7 +9,7 @@ md-toc pep517 pre-commit pytest>=4.4.0 -pytest-check>=0.4 +pytest-check>=1.1.2 pytest-cov pytest-ordering pytest-timeout diff --git a/tests/test_api_good.py b/tests/test_api_good.py index f3889b7..2712d4b 100644 --- a/tests/test_api_good.py +++ b/tests/test_api_good.py @@ -366,17 +366,17 @@ def test_api_inventory_bytes_fname_instantiation( source = soi.readbytes(source) # General import, without a specified kwarg - with check.check(msg="general"): + with check(msg="general"): attrs_inventory_test(soi.Inventory(source), source_type) # Importing with the respective kwarg for each source type - with check.check(msg="specific"): + with check(msg="specific"): inv = soi.Inventory(**{inv_arg: source}) attrs_inventory_test(inv, source_type) # Special case for plaintext bytes, try decoding it if source_type is soi.SourceTypes.BytesPlaintext: - with check.check(msg="plaintext_bytes"): + with check(msg="plaintext_bytes"): inv = soi.Inventory(**{inv_arg: source.decode("utf-8")}) attrs_inventory_test(inv, source_type) diff --git a/tests/test_cli.py b/tests/test_cli.py index 2fcb3ca..b1d5748 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -479,10 +479,10 @@ def test_clifail_convert_localfile_as_url( (scratch_path / (misc_info.FNames.INIT + misc_info.Extensions.DEC)).unlink() - with check.check(msg="path-style"): + with check(msg="path-style"): run_cmdline_test(["convert", "plain", "-u", str(in_path)], expect=1) - with check.check(msg="url-style"): + with check(msg="url-style"): file_url = "file:///" + str(in_path.resolve()) run_cmdline_test(["convert", "plain", "-u", file_url], expect=1) diff --git a/tests/test_fixture.py b/tests/test_fixture.py index 398cfed..985e5a3 100644 --- a/tests/test_fixture.py +++ b/tests/test_fixture.py @@ -45,7 +45,7 @@ def test_populate_scratch(misc_info, scratch_path, check): scr_base = misc_info.FNames.INIT.value for ext in [_.value for _ in misc_info.Extensions]: - with check.check(msg=ext): + with check(msg=ext): assert (scratch_path / f"{scr_base}{ext}").is_file(), ext diff --git a/tests/test_flake8_ext.py b/tests/test_flake8_ext.py index 9bd05bf..2255488 100644 --- a/tests/test_flake8_ext.py +++ b/tests/test_flake8_ext.py @@ -69,5 +69,5 @@ def test_flake8_version_output(check): ) # noqa: S607,S603 for p in plugins: - with check.check(msg=p): + with check(msg=p): assert p in flake8_ver_output.replace("_", "-").replace("\n", "") diff --git a/tests/test_readme.py b/tests/test_readme.py index d22a1e9..4b5086f 100644 --- a/tests/test_readme.py +++ b/tests/test_readme.py @@ -103,5 +103,5 @@ def test_readme_shell_cmds(ensure_doc_scratch, is_win, check): msg = "\n\nExpected:\n" + out + "\n\nGot:\n" + result - with check.check(): + with check(): assert chk.check_output(out, result, dt_flags), msg From bd6ede0b40c9a6fe55e7da4f7162153f1bc95dd6 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Wed, 23 Nov 2022 15:07:13 -0500 Subject: [PATCH 12/36] Remove Python 3.6 and add 3.11 where missing Removed Python 3.6: - Azure Pipelines matrix - Github Actions matrix - tox environments - PyPI classifier Did **NOT** bump `python_requires>=3.7`, since 3.6 *should* still work in the wild. Will wait until I get a confirmed breakage on 3.6 (or any later 3.x) or specifically make a likely-breaking change before bumping this. Added Python 3.11: - Azure Pipelines now has workers with 3.11 available across Linux/Win/Mac platforms, so added it to that matrix --- .github/workflows/ci_tests.yml | 2 +- azure-pipelines.yml | 6 ++++-- setup.cfg | 1 - tox.ini | 5 ++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 18ea8d8..7565e8e 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -63,7 +63,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ['3.6', '3.7', '3.8', '3.9', '3.11'] + python: ['3.7', '3.8', '3.9', '3.11'] if: "!contains(github.event.head_commit.message, '[skip ci]')" steps: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7ca1dcc..a75333f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -59,8 +59,6 @@ stages: - template: azure-coretest.yml parameters: pythons: - py36: - spec: '3.6' py37: spec: '3.7' py38: @@ -69,6 +67,8 @@ stages: spec: '3.9' py310: spec: '3.10' + py311: + spec: '3.11' pypy3: spec: 'pypy3' platforms: [linux] @@ -84,6 +84,8 @@ stages: spec: '3.9' py310: spec: '3.10' + py311: + spec: '3.11' platforms: [windows, macOs] diff --git a/setup.cfg b/setup.cfg index cab8eb0..73a021b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,7 +24,6 @@ classifiers = Programming Language :: Python Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 diff --git a/tox.ini b/tox.ini index e396557..f8bfe0d 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ minversion=2.0 isolated_build=True envlist= # Test all Python versions on latest lib versions - py3{6,7,8,9,10,11}-sphx_latest-attrs_latest-jsch_latest + py3{7,8,9,10,11}-sphx_latest-attrs_latest-jsch_latest # Test dev Python version on current in-repo dev lib versions py310-sphx_dev-attrs_dev-jsch_dev # Scan across Sphinx versions @@ -15,7 +15,7 @@ envlist= # Scan jsonschema versions py310-sphx_latest-attrs_latest-jsch_{3_0,3_1,3_2,4_0,4_1,dev} # Earliest supported Python and lib versions all together - py36-sphx_1_6_x-attrs_19_2-jsch_3_0 + py37-sphx_1_6_x-attrs_19_2-jsch_3_0 # Spot matrix of early Python, Sphinx, attrs versions py3{7,8,9}-sphx_{1,2}_x-attrs_{19,20}_2-jsch_latest # Test the specific Sphinx threshold cases where behavior changed @@ -84,7 +84,6 @@ basepython= py39: python3.9 py38: python3.8 py37: python3.7 - py36: python3.6 [testenv:flake8] skip_install=True From 5016731911833fff45a9193dd30e0c0a66810daa Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Wed, 23 Nov 2022 15:10:25 -0500 Subject: [PATCH 13/36] Add CHANGELOG entries --- CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 915bc21..d941a96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,22 @@ and this project strives to adhere to * The `sys.exit()` in the case of no objects falling above the 'suggest' search threshold was refactored into the main `do_suggest()` body, to minimize the surprise of an `exit()` call coming in a subfunction. ([#263](https://github.com/bskinn/sphobjinv/issues/263)) +#### Testing + + * The constraint for `pytest-check` was bumped to `>=1.1.2` and all uses of + the `check` fixture were revised from `with check.check(...):` to + `with check(...):`. ([#265](https://github.com/bskinn/sphobjinv/issues/265)) + + * Azure Pipelines now has Python 3.11 available for all of Ubuntu, Windows and + MacOS, so it was added to the core text matrix for all platforms. + +#### Administrative + + * The version bump on `pytest-check` no longer permits the use of Python 3.6 + in CI. As Python 3.6 is nearly a year beyond EOL, this seems a reasonable + time to officially drop support for it. `python_requires` will still be at + `>=3.6` for now; it *should* still work for 3.6...but, no guarantees. + ### [2.3] - 2022-11-08 From cf211c105c76b81e8eadac1a050d693c6ec65de5 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Wed, 23 Nov 2022 17:31:05 -0500 Subject: [PATCH 14/36] Cap flake8 to < 6.0 Is blowing up pip's resolve. --- requirements-flake8.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-flake8.txt b/requirements-flake8.txt index 833ef9e..3151acc 100644 --- a/requirements-flake8.txt +++ b/requirements-flake8.txt @@ -1,5 +1,5 @@ colorama -flake8>=5 +flake8>=5,<6 flake8-2020 flake8-absolute-import flake8-bandit From e6f6cdaee0a46449907656dbbbb1580ca31a610b Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Wed, 23 Nov 2022 09:03:32 -0500 Subject: [PATCH 15/36] Update CHANGELOG for README tests change --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d941a96..2c26b9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,12 @@ and this project strives to adhere to * The 'suggest' CLI mode output now includes dividers for improved readability. +#### Tests + + * The README doctests and shell tests have been removed from the default + pytest suite. They must be explicitly opted-in with the `--readme` and + `--doctest-glob="README.rst"` flags to pytest. + #### Internal * The `sys.exit()` in the case of no objects falling above the 'suggest' search threshold was refactored into the main `do_suggest()` body, to minimize the surprise of an `exit()` call coming in a subfunction. ([#263](https://github.com/bskinn/sphobjinv/issues/263)) From 3db2aa697e221efa23a93976b3af4fc43807d8c0 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Wed, 23 Nov 2022 09:04:12 -0500 Subject: [PATCH 16/36] Bump dev version and start modding MANIFEST.in --- MANIFEST.in | 15 ++++++++++++++- src/sphobjinv/version.py | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index bf8e0a2..e68ea2d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,14 @@ -include AUTHORS.md CHANGELOG.md CONTRIBUTING.md LICENSE.txt pyproject.toml README.rst +include AUTHORS.md CHANGELOG.md CONTRIBUTING.md LICENSE.txt pyproject.toml +include README.rst requirements-dev.txt requirements-flake8.txt tox.ini + +include src/sphobjinv/_vendored/fuzzywuzzy/LICENSE.txt + +recursive-include doc/source * +include doc/make.bat doc/Makefile + +include tests/*.py +include tests/resource/objects_attrs* +include conftest.py + +global-exclude __pycache__/* +prune **/*.egg-info diff --git a/src/sphobjinv/version.py b/src/sphobjinv/version.py index 21e130e..24a7630 100644 --- a/src/sphobjinv/version.py +++ b/src/sphobjinv/version.py @@ -29,4 +29,4 @@ """ -__version__ = "2.3.1.dev0" +__version__ = "2.3.1.dev1" From 9c0e2e10164cd441e5bcc17e7846f74cc7fe8d19 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Wed, 23 Nov 2022 12:09:11 -0500 Subject: [PATCH 17/36] Update MANIFEST.in w/1st pass at testable sdist Part of #264 --- MANIFEST.in | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index e68ea2d..c7069e4 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,14 +1,15 @@ include AUTHORS.md CHANGELOG.md CONTRIBUTING.md LICENSE.txt pyproject.toml include README.rst requirements-dev.txt requirements-flake8.txt tox.ini -include src/sphobjinv/_vendored/fuzzywuzzy/LICENSE.txt +graft src/sphobjinv/_vendored/fuzzywuzzy -recursive-include doc/source * +graft doc/source include doc/make.bat doc/Makefile -include tests/*.py -include tests/resource/objects_attrs* include conftest.py +graft tests +prune tests/resource +include tests/resource/objects_attrs* tests/resource/objects_sarge* global-exclude __pycache__/* prune **/*.egg-info From 82c250db5c0be6bc64fdda603e518d854a6ed072 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Wed, 23 Nov 2022 12:26:51 -0500 Subject: [PATCH 18/36] Add Azure Pipelines job to test sdist testability (1) Adding to a temporary first stage for now, for faster testing. Later to be moved to the aux tests at the end of the pipeline. (2) Remove 'soi' dir & change to correct dir for steps Helps to have cwd in the right place for things to, y'know, work. (3) Escape those dollar signs (4) Remove up-front docs build & req'ts install For a build, it *should* be enough just to install 'build'? (5) Unescape $s and turn 's to "s Nope, wasn't the dollar signs. Something weird in how the single quotes were interacting with Pipelines's string handling, maybe? (6) Add a debugging step (7) Refine the regex for finding the sdist dir --- azure-pipelines.yml | 78 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a75333f..0d90683 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,6 +9,79 @@ pr: stages: +- stage: temp_testable_sdist + displayName: Test sdist testability + + jobs: + - job: testable_sdist + displayName: Ensure sdist is testable + + pool: + vmImage: 'Ubuntu-latest' + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.10' + + # - script: pip install -r requirements-dev.txt + # displayName: Install full dev requirements + + # - script: cd doc; make html + # displayName: Build docs + + - script: python -m pip install build + displayName: Install 'build' package + + - script: | + python -m build -s + ls -lah dist + displayName: Build sdist + + - script: | + mkdir sandbox + displayName: Create sandbox + + - script: | + cp dist/*.gz sandbox/ + cd sandbox + tar xf *.gz + displayName: Unpack sdist in sandbox + + - script: | + cd sandbox + python -m venv env + displayName: Create venv + + - script: | + cd sandbox + echo $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) + displayName: Debug cd command arg + + # Only the dir of the unpacked sdist will have a digit in its name + - script: | + cd sandbox + source env/bin/activate + cd $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) + python -m pip install -r requirements-dev.txt + displayName: Install dev requirements to venv + + - script: | + cd sandbox + source env/bin/activate + cd $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) + cd doc + O=-Ean make html + displayName: Build docs in sandbox + + - script: | + cd sandbox + source env/bin/activate + cd $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) + pytest --nonloc + displayName: Run full test suite in sandbox + + - stage: code_quality displayName: Check code quality @@ -35,6 +108,7 @@ stages: - script: tox -e flake8 displayName: Lint the codebase + - job: interrogate displayName: Run interrogate docstrings check @@ -128,6 +202,7 @@ stages: - script: cd doc; make doctest displayName: Run doctests + - job: readme displayName: Run README doctests/shell tests @@ -148,6 +223,7 @@ stages: - script: pytest -k readme --readme --doctest-glob="README.rst" displayName: Run README doc/shell tests + - job: linkcheck displayName: Run docs link-check suite @@ -189,6 +265,7 @@ stages: - script: coverage report --include="tests/*" --fail-under=100 displayName: Check 100% test execution + - job: contributing_toc displayName: Confirm CONTRIBUTING.md TOC is up to date @@ -209,6 +286,7 @@ stages: - script: if [[ $( git status | grep modified | wc -l ) -ne 0 ]]; then exit 1; fi displayName: Fail if md-toc modified CONTRIBUTING + - job: noqa_info displayName: Report flake8-noqa results for info (never fails) From fd59f8fe010ada76da9efcf461cca914a5be0150 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Wed, 23 Nov 2022 14:02:06 -0500 Subject: [PATCH 19/36] Refactor sdist testability test to template Long enough that it's worth the extra real estate in the repo root dir, I think. --- azure-pipelines.yml | 74 ++------------------------------------------- azure-sdisttest.yml | 62 +++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 72 deletions(-) create mode 100644 azure-sdisttest.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0d90683..583361c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,78 +9,6 @@ pr: stages: -- stage: temp_testable_sdist - displayName: Test sdist testability - - jobs: - - job: testable_sdist - displayName: Ensure sdist is testable - - pool: - vmImage: 'Ubuntu-latest' - - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.10' - - # - script: pip install -r requirements-dev.txt - # displayName: Install full dev requirements - - # - script: cd doc; make html - # displayName: Build docs - - - script: python -m pip install build - displayName: Install 'build' package - - - script: | - python -m build -s - ls -lah dist - displayName: Build sdist - - - script: | - mkdir sandbox - displayName: Create sandbox - - - script: | - cp dist/*.gz sandbox/ - cd sandbox - tar xf *.gz - displayName: Unpack sdist in sandbox - - - script: | - cd sandbox - python -m venv env - displayName: Create venv - - - script: | - cd sandbox - echo $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) - displayName: Debug cd command arg - - # Only the dir of the unpacked sdist will have a digit in its name - - script: | - cd sandbox - source env/bin/activate - cd $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) - python -m pip install -r requirements-dev.txt - displayName: Install dev requirements to venv - - - script: | - cd sandbox - source env/bin/activate - cd $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) - cd doc - O=-Ean make html - displayName: Build docs in sandbox - - - script: | - cd sandbox - source env/bin/activate - cd $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) - pytest --nonloc - displayName: Run full test suite in sandbox - - stage: code_quality displayName: Check code quality @@ -162,6 +90,8 @@ stages: spec: '3.11' platforms: [windows, macOs] + - template: azure-sdisttest.yml + - stage: aux_tests displayName: Run auxiliary tests diff --git a/azure-sdisttest.yml b/azure-sdisttest.yml new file mode 100644 index 0000000..a7f5d10 --- /dev/null +++ b/azure-sdisttest.yml @@ -0,0 +1,62 @@ +jobs: +- job: testable_sdist + displayName: Ensure sdist is testable + + pool: + vmImage: 'Ubuntu-latest' + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.10' + + - script: python -m pip install build + displayName: Install 'build' package + + - script: | + python -m build -s + ls -lah dist + displayName: Build sdist + + - script: | + mkdir sandbox + displayName: Create sandbox + + - script: | + cp dist/*.gz sandbox/ + cd sandbox + tar xvf *.gz + displayName: Unpack sdist in sandbox + + - script: | + cd sandbox + python -m venv env + displayName: Create venv + + # Only the dir of the unpacked sdist will have a digit in its name + - script: | + cd sandbox + echo $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) + displayName: Check unpack dir name + + - script: | + cd sandbox + source env/bin/activate + cd $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) + python -m pip install -r requirements-dev.txt + displayName: Install dev req'ts to venv + + - script: | + cd sandbox + source env/bin/activate + cd $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) + cd doc + O=-Ean make html + displayName: Build docs in sandbox + + - script: | + cd sandbox + source env/bin/activate + cd $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) + pytest --nonloc + displayName: Run test suite in sandbox From 45d4f160cb22b3f14205f56a73f0c0bffbb42e28 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Thu, 24 Nov 2022 21:19:20 -0500 Subject: [PATCH 20/36] Coerce LF EOL for resource/objects_attrs.txt Always packaging UNIX-style line-endings this way, when creating an sdist. Should be the fix for: https://github.com/bskinn/sphobjinv/issues/264#issuecomment-1326944144 --- .gitattributes | 2 +- src/sphobjinv/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index 89af26e..c6f20db 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ tests/resource/objects_mkdoc_zlib0.inv binary - +tests/resource/objects_attrs.txt binary diff --git a/src/sphobjinv/version.py b/src/sphobjinv/version.py index 24a7630..b9f9ed9 100644 --- a/src/sphobjinv/version.py +++ b/src/sphobjinv/version.py @@ -29,4 +29,4 @@ """ -__version__ = "2.3.1.dev1" +__version__ = "2.3.1.dev2" From 2be6d476c708c09ad8fedb86293a17925560363d Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Fri, 25 Nov 2022 00:42:51 -0500 Subject: [PATCH 21/36] Convert to Win EOLs for objects_attrs.txt Fixtures needed explicit updating to account for the fact that tests/resource/objects_attrs.txt is now checked out with Unix newlines even on Windows. --- conftest.py | 23 +++++++++++++++++++---- tests/test_fixture.py | 6 ++++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/conftest.py b/conftest.py index 270bdf4..d1f0e9c 100644 --- a/conftest.py +++ b/conftest.py @@ -36,7 +36,6 @@ import shutil import sys from enum import Enum -from filecmp import cmp from functools import partial from io import BytesIO from pathlib import Path @@ -139,7 +138,7 @@ class Extensions(str, Enum): @pytest.fixture() -def scratch_path(tmp_path, res_path, misc_info): +def scratch_path(tmp_path, res_path, misc_info, is_win, unix2dos): """Provision pre-populated scratch directory, returned as Path.""" res_base = misc_info.FNames.RES.value scr_base = misc_info.FNames.INIT.value @@ -151,6 +150,13 @@ def scratch_path(tmp_path, res_path, misc_info): str(tmp_path / f"{scr_base}{ext}"), ) + # With the conversion of resources/objects_attrs.txt to Unix EOLs in order to + # provide for a Unix-testable sdist, on Windows systems this resource needs + # to be converted to DOS EOLs for consistency. + if is_win: + win_path = tmp_path / f"{scr_base}{misc_info.Extensions.DEC}" + win_path.write_bytes(unix2dos(win_path.read_bytes())) + yield tmp_path @@ -260,13 +266,22 @@ def func(arglist, *, expect=0): # , suffix=None): @pytest.fixture(scope="session") -def decomp_cmp_test(misc_info): +def decomp_cmp_test(misc_info, is_win, unix2dos): """Return function to confirm a decompressed file is identical to resource.""" def func(path): """Perform the round-trip compress/decompress comparison test.""" # The str() calls here are for Python 3.5 compat - assert cmp(str(misc_info.res_decomp_path), str(path), shallow=False) + res_bytes = Path(misc_info.res_decomp_path).read_bytes() + tgt_bytes = Path(path).read_bytes() # .replace(b"\r\n", b"\n") + + if is_win: + # Have to explicitly convert these newlines, now that the + # tests/resource/objects_attrs.txt file is marked 'binary' in + # .gitattributes + res_bytes = unix2dos(res_bytes) + + assert res_bytes == tgt_bytes return func diff --git a/tests/test_fixture.py b/tests/test_fixture.py index 985e5a3..7ee8d90 100644 --- a/tests/test_fixture.py +++ b/tests/test_fixture.py @@ -63,11 +63,13 @@ def test_cli_invoke(run_cmdline_test): run_cmdline_test([]) -def test_decomp_comp_fixture(misc_info, decomp_cmp_test): +def test_decomp_comp_fixture(misc_info, decomp_cmp_test, scratch_path): """Test decomp_cmp_test works in 'identity' case. Basically is telling filecmp.cmp to compare a reference inventory file with itself. """ - decomp_cmp_test(misc_info.res_decomp_path) + decomp_cmp_test( + scratch_path / f"{misc_info.FNames.INIT.value}{misc_info.Extensions.DEC}" + ) From 6cf0062567d156c3059a0ceb29cb322b6c90998d Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Fri, 25 Nov 2022 12:03:28 -0500 Subject: [PATCH 22/36] Add explicit .value to fixture test command Behavior change of str/Enum mixin means that I *have* to include the explicit .value. This will affect the pent codebase, too. --- tests/test_fixture.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_fixture.py b/tests/test_fixture.py index 7ee8d90..1e94d4a 100644 --- a/tests/test_fixture.py +++ b/tests/test_fixture.py @@ -71,5 +71,5 @@ def test_decomp_comp_fixture(misc_info, decomp_cmp_test, scratch_path): """ decomp_cmp_test( - scratch_path / f"{misc_info.FNames.INIT.value}{misc_info.Extensions.DEC}" + scratch_path / f"{misc_info.FNames.INIT.value}{misc_info.Extensions.DEC.value}" ) From 5d995144fdcb9004417726380e405156a3df1a60 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Fri, 25 Nov 2022 13:01:29 -0500 Subject: [PATCH 23/36] Add explicit .value to scratch_path fixture Again, to account for bugfix/behavior change in 3.11. --- conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conftest.py b/conftest.py index d1f0e9c..5c10462 100644 --- a/conftest.py +++ b/conftest.py @@ -154,7 +154,7 @@ def scratch_path(tmp_path, res_path, misc_info, is_win, unix2dos): # provide for a Unix-testable sdist, on Windows systems this resource needs # to be converted to DOS EOLs for consistency. if is_win: - win_path = tmp_path / f"{scr_base}{misc_info.Extensions.DEC}" + win_path = tmp_path / f"{scr_base}{misc_info.Extensions.DEC.value}" win_path.write_bytes(unix2dos(win_path.read_bytes())) yield tmp_path From 22d3a96c92ac55b545701d43fec240f81f2181f7 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Fri, 25 Nov 2022 13:19:09 -0500 Subject: [PATCH 24/36] Fix GUIX link --- doc/source/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/index.rst b/doc/source/index.rst index 678d1b7..4c8f13c 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -57,7 +57,7 @@ and package managers, including: * Gentoo: ``dev-python/sphobjinv`` (`info `__) - * Guix: ``python-sphobjinv`` (`info `__) + * Guix: ``python-sphobjinv`` (`info `__) * Manjaro: ``python-sphobjinv`` From 8d52e5905901c1bece9b9b76aa133b89cddab39e Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Fri, 25 Nov 2022 18:33:23 -0500 Subject: [PATCH 25/36] Bump dev version to 2.3.1.dev3 --- src/sphobjinv/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sphobjinv/version.py b/src/sphobjinv/version.py index b9f9ed9..311beb4 100644 --- a/src/sphobjinv/version.py +++ b/src/sphobjinv/version.py @@ -29,4 +29,4 @@ """ -__version__ = "2.3.1.dev2" +__version__ = "2.3.1.dev3" From a967ce3d43ff40c3668311237ca385cabe6db210 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Fri, 25 Nov 2022 18:32:16 -0500 Subject: [PATCH 26/36] Add pip caching to Azure Pipelines --- azure-coretest.yml | 12 +++++++ azure-pipelines.yml | 77 +++++++++++++++++++++++++++++++++++++++++++++ azure-sdisttest.yml | 11 +++++++ 3 files changed, 100 insertions(+) diff --git a/azure-coretest.yml b/azure-coretest.yml index eb1a3b7..9de7ca7 100644 --- a/azure-coretest.yml +++ b/azure-coretest.yml @@ -1,3 +1,6 @@ +# Caching implemented as per +# https://stackoverflow.com/a/70297887/4376000 + parameters: pythons: [] platforms: [] @@ -15,6 +18,7 @@ jobs: image: 'macOS-latest' ${{ if notIn(platform, 'macOs', 'linux', 'windows') }}: image: 'Ubuntu-latest' + pip_cache_dir: $(Pipeline.Workspace)/.pip pool: vmImage: $[ variables.image ] @@ -26,6 +30,14 @@ jobs: architecture: 'x64' displayName: Use cached ${{ coalesce(python.value.name, python.key) }} for tests. + - task: Cache@2 + inputs: + key: 'pip | "$(Agent.OS)" | requirements-dev.txt | requirements-flake8.txt' + restoreKeys: | + pip | "$(Agent.OS)" + path: $(pip_cache_dir) + displayName: Cache pip + - script: pip install -U --force-reinstall -r requirements-ci.txt displayName: Install CI requirements diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 583361c..7bb542c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,6 +7,9 @@ pr: - main - stable +variables: + pip_cache_dir: $(Pipeline.Workspace)/.pip + stages: @@ -19,11 +22,20 @@ stages: pool: vmImage: 'Ubuntu-latest' + steps: - task: UsePythonVersion@0 inputs: versionSpec: '3.10' + - task: Cache@2 + inputs: + key: 'pip | "$(Agent.OS)" | requirements-dev.txt | requirements-flake8.txt' + restoreKeys: | + pip | "$(Agent.OS)" + path: $(pip_cache_dir) + displayName: Cache pip + - script: pip install -U tox displayName: Install tox @@ -42,11 +54,20 @@ stages: pool: vmImage: 'Ubuntu-latest' + steps: - task: UsePythonVersion@0 inputs: versionSpec: '3.10' + - task: Cache@2 + inputs: + key: 'pip | "$(Agent.OS)" | requirements-dev.txt | requirements-flake8.txt' + restoreKeys: | + pip | "$(Agent.OS)" + path: $(pip_cache_dir) + displayName: Cache pip + - script: pip install interrogate displayName: Install interrogate @@ -108,6 +129,14 @@ stages: inputs: versionSpec: '3.10' + - task: Cache@2 + inputs: + key: 'pip | "$(Agent.OS)" | requirements-dev.txt | requirements-flake8.txt' + restoreKeys: | + pip | "$(Agent.OS)" + path: $(pip_cache_dir) + displayName: Cache pip + - script: pip install . -r requirements-rtd.txt displayName: Install project, plus docs requirements @@ -126,6 +155,14 @@ stages: inputs: versionSpec: '3.10' + - task: Cache@2 + inputs: + key: 'pip | "$(Agent.OS)" | requirements-dev.txt | requirements-flake8.txt' + restoreKeys: | + pip | "$(Agent.OS)" + path: $(pip_cache_dir) + displayName: Cache pip + - script: pip install -r requirements-dev.txt displayName: Install full dev requirements @@ -147,6 +184,14 @@ stages: - script: pip install -r requirements-ci.txt displayName: Install CI requirements + - task: Cache@2 + inputs: + key: 'pip | "$(Agent.OS)" | requirements-dev.txt | requirements-flake8.txt' + restoreKeys: | + pip | "$(Agent.OS)" + path: $(pip_cache_dir) + displayName: Cache pip + - script: cd doc; make html displayName: Build docs @@ -165,6 +210,14 @@ stages: inputs: versionSpec: '3.10' + - task: Cache@2 + inputs: + key: 'pip | "$(Agent.OS)" | requirements-dev.txt | requirements-flake8.txt' + restoreKeys: | + pip | "$(Agent.OS)" + path: $(pip_cache_dir) + displayName: Cache pip + - script: pip install . -r requirements-rtd.txt displayName: Install doc requirements and local project @@ -183,6 +236,14 @@ stages: inputs: versionSpec: '3.10' + - task: Cache@2 + inputs: + key: 'pip | "$(Agent.OS)" | requirements-dev.txt | requirements-flake8.txt' + restoreKeys: | + pip | "$(Agent.OS)" + path: $(pip_cache_dir) + displayName: Cache pip + - script: pip install -r requirements-dev.txt displayName: Install full dev requirements @@ -207,6 +268,14 @@ stages: inputs: versionSpec: '3.10' + - task: Cache@2 + inputs: + key: 'pip | "$(Agent.OS)" | requirements-dev.txt | requirements-flake8.txt' + restoreKeys: | + pip | "$(Agent.OS)" + path: $(pip_cache_dir) + displayName: Cache pip + - script: pip install -r requirements-ci.txt displayName: Install CI requirements @@ -228,6 +297,14 @@ stages: inputs: versionSpec: '3.10' + - task: Cache@2 + inputs: + key: 'pip | "$(Agent.OS)" | requirements-dev.txt | requirements-flake8.txt' + restoreKeys: | + pip | "$(Agent.OS)" + path: $(pip_cache_dir) + displayName: Cache pip + - script: pip install tox flake8-noqa -r requirements-flake8.txt displayName: Install requirements diff --git a/azure-sdisttest.yml b/azure-sdisttest.yml index a7f5d10..422881b 100644 --- a/azure-sdisttest.yml +++ b/azure-sdisttest.yml @@ -2,6 +2,9 @@ jobs: - job: testable_sdist displayName: Ensure sdist is testable + variables: + pip_cache_dir: $(Pipeline.Workspace)/.pip + pool: vmImage: 'Ubuntu-latest' @@ -10,6 +13,14 @@ jobs: inputs: versionSpec: '3.10' + - task: Cache@2 + inputs: + key: 'pip | "$(Agent.OS)" | requirements-dev.txt | requirements-flake8.txt' + restoreKeys: | + pip | "$(Agent.OS)" + path: $(pip_cache_dir) + displayName: Cache pip + - script: python -m pip install build displayName: Install 'build' package From a63d3bfc48f34e8f5672616854b79d4d6b67330c Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Mon, 28 Nov 2022 19:24:29 -0500 Subject: [PATCH 27/36] Thin out jsonschema matrix in tox --- tox.ini | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tox.ini b/tox.ini index f8bfe0d..1a35842 100644 --- a/tox.ini +++ b/tox.ini @@ -13,7 +13,7 @@ envlist= # Scan attrs versions py310-sphx_latest-attrs_{19_2,19_3,20_1,20_2,20_3,21_2,21_3,dev}-jsch_latest # Scan jsonschema versions - py310-sphx_latest-attrs_latest-jsch_{3_0,3_1,3_2,4_0,4_1,dev} + py310-sphx_latest-attrs_latest-jsch_{3_0,3_x,4_0,4_8,dev} # Earliest supported Python and lib versions all together py37-sphx_1_6_x-attrs_19_2-jsch_3_0 # Spot matrix of early Python, Sphinx, attrs versions @@ -56,13 +56,10 @@ deps= attrs_latest: attrs attrs_dev: git+https://github.com/python-attrs/attrs - jsch_3_0: jsonschema<3.1 - jsch_3_1: jsonschema<3.2 - jsch_3_2: jsonschema<3.3 + jsch_3_0: jsonschema==3.0 + jsch_3_x: jsonschema<4 jsch_4_0: jsonschema<4.1 - jsch_4_1: jsonschema<4.2 - jsch_4_2: jsonschema<4.3 - jsch_4_3: jsonschema<4.4 + jsch_4_8: jsonschema<4.9 jsch_latest: jsonschema jsch_dev: git+https://github.com/Julian/jsonschema From c455b2198d8556f4526fa1d372a04834cc129611 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Mon, 28 Nov 2022 19:25:15 -0500 Subject: [PATCH 28/36] Update deps pins in tox --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 1a35842..8e13b51 100644 --- a/tox.ini +++ b/tox.ini @@ -65,11 +65,11 @@ deps= dictdiffer pytest>=4.4.0 - pytest-check>=0.4 + pytest-check>=1.1.2 pytest-ordering pytest-timeout stdio-mgr>=1.0.1 - sphinx-issues==0.4.0 + sphinx-issues sphinx-rtd-theme sphinxcontrib-programoutput From 68bdcd14a555be2d34e7e45d286046ae1ce76d2a Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Mon, 28 Nov 2022 19:26:47 -0500 Subject: [PATCH 29/36] Remove Guix packages link Does not seem to be stable; breaking builds. Not worth keeping. --- doc/source/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/index.rst b/doc/source/index.rst index 4c8f13c..9c62159 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -57,7 +57,7 @@ and package managers, including: * Gentoo: ``dev-python/sphobjinv`` (`info `__) - * Guix: ``python-sphobjinv`` (`info `__) + * Guix: ``python-sphobjinv`` * Manjaro: ``python-sphobjinv`` From 00462581a3b36a45965010c851a09da15fc1bc80 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Mon, 28 Nov 2022 23:46:04 -0500 Subject: [PATCH 30/36] Switch to declarative dynamic project version 'attr' feature in setup.cfg (for now; pyproject.toml later). Still need to exec() the version number in setup.py, so that I can sub it into the links, but at least for the purposes of the build it's declaratively defined. --- setup.cfg | 1 + setup.py | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 73a021b..4d0049d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,6 @@ [metadata] name = sphobjinv +version = attr: sphobjinv.version.__version__ description = Sphinx objects.inv Inspection/Manipulation Tool url = https://github.com/bskinn/sphobjinv project_urls = diff --git a/setup.py b/setup.py index 56ccb7e..9e34359 100644 --- a/setup.py +++ b/setup.py @@ -36,8 +36,6 @@ def content_update(content, pattern, sub): setup( - name=NAME, - version=__version__, long_description=readme(), long_description_content_type="text/x-rst", ) From 606f564425249b6876e3b79c28fdd15dab4ee146 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Mon, 28 Nov 2022 23:47:20 -0500 Subject: [PATCH 31/36] Bump version to 2.3.1 --- src/sphobjinv/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sphobjinv/version.py b/src/sphobjinv/version.py index 311beb4..c84d65a 100644 --- a/src/sphobjinv/version.py +++ b/src/sphobjinv/version.py @@ -29,4 +29,4 @@ """ -__version__ = "2.3.1.dev3" +__version__ = "2.3.1" From 682c1136c2d53fc7d893563dffeaab264a6882d2 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Mon, 28 Nov 2022 23:54:52 -0500 Subject: [PATCH 32/36] Add v2.3.1 to pepy.tech badge --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 546bcb0..146eaf6 100644 --- a/README.rst +++ b/README.rst @@ -33,7 +33,7 @@ sphobjinv: Manipulate and inspect Sphinx objects.inv files :target: https://github.com/psf/black .. image:: https://pepy.tech/badge/sphobjinv/month - :target: https://pepy.tech/project/sphobjinv?versions=2.0.1&versions=2.1&versions=2.2.2&versions=2.3 + :target: https://pepy.tech/project/sphobjinv?versions=2.0.1&versions=2.1&versions=2.2.2&versions=2.3&versions=2.3.1 ---- From 869ce4d116cb5dbe6b3934caa6be67b63108f1f8 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Tue, 29 Nov 2022 00:20:02 -0500 Subject: [PATCH 33/36] Update CHANGELOG --- CHANGELOG.md | 75 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 68 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c26b9e..beed85d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,28 +7,41 @@ and this project strives to adhere to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -### (unreleased) +### [2.3.1] - 2022-11-29 #### Changed * The printout of the inferred `intersphinx_mapping` item for inventories retrieved by URL (`--url`) in the 'suggest' CLI mode is now relocated to - fall immediately below the inventory-search output. ([#262](https://github.com/bskinn/sphobjinv/issues/262)) + fall immediately below the inventory-search output. It also now is displayed + even if no objects in the `objects.inv` satisfy the score threshold. + ([#262](https://github.com/bskinn/sphobjinv/issues/262)) * The 'suggest' CLI mode output now includes dividers for improved readability. #### Tests + * The plaintext `tests/resource/objects_attrs.txt` was converted to POSIX EOLs + and declared as binary to git, in order to provide a consistent state for + sdist packaging, regardless of platform (POSIX vs Windows). + + * As a result, it was necessary to modify the `scratch_path` fixture to + "`unix2dos`" this file on Windows systems, in order to provide a + consistent test state. + + * Similarly, the `decomp_cmp_test` fixture was modified to "`unix2dos`" the + `objects_attrs.txt` resource before comparisons, again in order to provide + a consistent reference artifact. Implementing required direct manipulation + of the bytes contents of the file, instead of the `filecmp.cmp` method + that had been used previously. + * The README doctests and shell tests have been removed from the default pytest suite. They must be explicitly opted-in with the `--readme` and `--doctest-glob="README.rst"` flags to pytest. -#### Internal - - * The `sys.exit()` in the case of no objects falling above the 'suggest' search threshold was refactored into the main `do_suggest()` body, to minimize the surprise of an `exit()` call coming in a subfunction. ([#263](https://github.com/bskinn/sphobjinv/issues/263)) - -#### Testing + * A new job, `readme`, has been added to the `aux_tests` stage of the Azure + Pipelines CI to run these tests for PRs and release branches. * The constraint for `pytest-check` was bumped to `>=1.1.2` and all uses of the `check` fixture were revised from `with check.check(...):` to @@ -37,6 +50,29 @@ and this project strives to adhere to * Azure Pipelines now has Python 3.11 available for all of Ubuntu, Windows and MacOS, so it was added to the core text matrix for all platforms. + * A new CI job was created on Azure Pipelines that creates an sdist from the + current project, extracts it into a sandboxed environment, installs the dev + dependencies, and runs the pytest suite (`azure-sdisttest.yml`). + + * All uses of `pytest-check` were updated to use the + [v1.1.2 syntax](https://github.com/okken/pytest-check/blob/main/changelog.md#110---2022-nov-21) + (`check` fixture, or `from pytest_check import check`). + +#### Internal + + * The `sys.exit()` in the case of no objects falling above the 'suggest' + search threshold was refactored into the main `do_suggest()` body, to + minimize the surprise of an `exit()` call coming in a subfunction. + ([#263](https://github.com/bskinn/sphobjinv/issues/263)) + +#### Packaging + + * `MANIFEST.in` was revised in order to provide a testable (`pytest --nonloc`) + sdist, in order to streamline packaging of `sphobjinv` for conda-forge. + (Thanks very much to [@anjos](https://github.com/anjos) for getting the + recipes for `sphobjinv` and its dependencies in place! See + [#264](https://github.com/bskinn/sphobjinv/issues/264).) + #### Administrative * The version bump on `pytest-check` no longer permits the use of Python 3.6 @@ -44,6 +80,31 @@ and this project strives to adhere to time to officially drop support for it. `python_requires` will still be at `>=3.6` for now; it *should* still work for 3.6...but, no guarantees. + * The hook versions for `pre-commit-hooks`, `black`, and `pyproject-fmt` were + updated to v4.3, v22.10, and v0.3.5, respectively. + + * `CONTENT_LICENSE.txt` was created, to specifically house the full + content/documentation license information. + + * `LICENSE.txt` was revised to only hold the MIT License for the code, + primarily so that Github's automatic systems will recognize the project as + MIT licensed. + + * Caching of pip downloads was added to all of the Azure Pipelines jobs. + + * The version constraint for `pytest-check` was raised to `>=1.1.2`. + + * A temporary upper bound was placed on the `flake8` version (now `>=5,<6`, + instead of `>=5`) to avoid pip resolver failures likely due to conflicts + with constraints declared by plugins. + + * The older versions of `jsonschema` tested in the `tox` matrix were + streamlined down to 3.0 (`==3.0`), 3.x (`<4`), 4.0 (`<4.1`) and 4.8 + (`<4.9`). + + * The pin of `sphinx-issues==0.4.0` in the `tox` matrix was removed, to match + the unpinned package in the `requirements-xxx.txt` files. + ### [2.3] - 2022-11-08 From c665ec6b7de4fa7059dfbc80b2bf5ddcc909744c Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Tue, 29 Nov 2022 00:22:39 -0500 Subject: [PATCH 34/36] Update CONTRIBUTING.md --- CONTRIBUTING.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9561055..dcc1495 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,7 @@ Table of Contents - [Documentation](#documentation) - [Continuous Integration](#continuous-integration) - [CHANGELOG](#changelog) -- [Issue & PR Templates](#issue--pr-templates) +- [Issue \& PR Templates](#issue--pr-templates) - [License](#license) @@ -38,7 +38,7 @@ $ git clone https://github.com/{you}/sphobjinv ``` Then, create a virtual environment for the project, in whatever location you -prefer. Any Python interpreter 3.6+ *should* work fine. +prefer. Any Python interpreter 3.7+ *should* work fine. I prefer to use `virtualenv` and create in `./env`: @@ -153,8 +153,8 @@ Note that while [`tox`](https://tox.wiki/en/latest/) *is* configured for the project, it is **not** set up to be an everyday test runner. Instead, it's used to execute an extensive matrix of test environments checking for the compatibility of different Python and dependency versions. You can run it if you -want, but you'll need working versions of all of Python 3.6 through 3.11 -installed and on `PATH` as `python3.6`, `python3.7`, etc. The nonlocal test +want, but you'll need working versions of all of Python 3.7 through 3.11 +installed and on `PATH` as `python3.7`, `python3.8`, etc. The nonlocal test suite is run for each `tox` environment, so it's best to use at most two parallel sub-processes to avoid oversaturating your network bandwidth; e.g.: @@ -250,7 +250,7 @@ with `make linkcheck`. Both Github Actions and Azure Pipelines are set up for the project, and should run on any forks of the repository. -Github Actions runs the test suite on Linux for Python 3.6 through 3.11, as well +Github Actions runs the test suite on Linux for Python 3.7 through 3.11, as well as the `flake8` lints and the Sphinx doctests and link-validity testing, and is configured to run on all commits. The workflow can be skipped per-commit by including `[skip ci]` in the commit message. @@ -290,4 +290,4 @@ issue/PR you want to create, though, then don't use them. ## License All code and documentation contributions will respectively take on the MIT -License and CC-BY 4.0 license of the project at large. +License and CC BY 4.0 license of the project at large. From 031eeb70716d1a7c888bd670f2ff6f32717e6dd0 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Tue, 29 Nov 2022 00:29:47 -0500 Subject: [PATCH 35/36] Add CHANGELOG and docs note about conda-forge Huzzah, now available! --- CHANGELOG.md | 3 +++ doc/source/index.rst | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index beed85d..4f4c74c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,6 +75,9 @@ and this project strives to adhere to #### Administrative + * `sphobjinv` is now available via conda-forge! A note was added to the docs + to indicate this. + * The version bump on `pytest-check` no longer permits the use of Python 3.6 in CI. As Python 3.6 is nearly a year beyond EOL, this seems a reasonable time to officially drop support for it. `python_requires` will still be at diff --git a/doc/source/index.rst b/doc/source/index.rst index 9c62159..f285ca2 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -45,6 +45,10 @@ Or, if you only plan to use the |soi| CLI, another option is |pipx|_:: $ pipx install sphobjinv +As of Nov 2022, |soi| is also available via conda-forge. After activating the desired conda environment:: + + $ conda install -c conda-forge sphobjinv + Alternatively, |soi| is packaged with `multiple POSIX distributions `__ and package managers, including: From 3086b48cf5522f98e80876e85736dd2e020f33c0 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Tue, 29 Nov 2022 08:32:28 -0500 Subject: [PATCH 36/36] Update CONTRIBUTING.md and remove TOC CI check The Markdown All-in-One extension provides sufficiently easy TOC generation/maintenance, when configured with gitea slugging and with entries excluded via the omit-in-toc pragmas. --- CONTRIBUTING.md | 8 ++++---- azure-pipelines.yml | 29 ----------------------------- 2 files changed, 4 insertions(+), 33 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dcc1495..b2a915c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -Welcome! +Welcome! -------- Thanks for your interest in contributing to `sphobjinv`! @@ -10,7 +10,7 @@ If you have any questions, please drop me a line on Twitter [issue](https://github.com/bskinn/sphobjinv/issues). -Table of Contents +Table of Contents ----------------- @@ -23,7 +23,7 @@ Table of Contents - [Documentation](#documentation) - [Continuous Integration](#continuous-integration) - [CHANGELOG](#changelog) -- [Issue \& PR Templates](#issue--pr-templates) +- [Issue and PR Templates](#issue-and-pr-templates) - [License](#license) @@ -279,7 +279,7 @@ settings, etc.) may also warrant a `CHANGELOG` bullet, depending on the situation. When in doubt, ask! -## Issue & PR Templates +## Issue and PR Templates I've set up the project with a PR template and a couple of issue templates, to hopefully make it easier to provide all the information needed to act on code diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7bb542c..d3acc29 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -257,35 +257,6 @@ stages: displayName: Check 100% test execution - - job: contributing_toc - displayName: Confirm CONTRIBUTING.md TOC is up to date - - pool: - vmImage: 'Ubuntu-latest' - - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.10' - - - task: Cache@2 - inputs: - key: 'pip | "$(Agent.OS)" | requirements-dev.txt | requirements-flake8.txt' - restoreKeys: | - pip | "$(Agent.OS)" - path: $(pip_cache_dir) - displayName: Cache pip - - - script: pip install -r requirements-ci.txt - displayName: Install CI requirements - - - script: python -m md_toc -p github CONTRIBUTING.md - displayName: Run md-toc on CONTRIBUTING - - - script: if [[ $( git status | grep modified | wc -l ) -ne 0 ]]; then exit 1; fi - displayName: Fail if md-toc modified CONTRIBUTING - - - job: noqa_info displayName: Report flake8-noqa results for info (never fails)