Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sphobjinv-textconv #307

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open

Conversation

msftcangoblowm
Copy link

closes #295

The rebase was challenging. Previous PR was automatically withdrawn

- feat: add sphobjinv-textconv entrypoint (bskinn#295)
- docs: adjustments to pass linkcheck
- ci(asure-pipelines): reduce coverage fail under percentage
- docs(README.md): doctest ELLIPSIS wildcard avoid hardcode inventory count
- feat: entrypoint sphobjinv-textconv ([bskinn#295])
- test: add sphobjinv-textconv unittests offline and online
- test: add integration test. Demonstrate git diff objects.inv
- test: add pytest module with class to interact with git
- docs: add step by step guide to configure git. Examples for bash and python
- docs: added sphobjinv-textconv API docs
- fix: py38 with statements multiple --> nested
- fix: py38 standard types typing isms e.g. List
- fix: use Windows friendly line seperators
- test: print diagnostic info on Windows bin and site folders
- test: print entire os.environ rather than a single key
- test: for Windows, attempt add SCRIPTS folder to sys.path
- test: for Windows, walk SCRIPTS folder print files and folders
- test: wrong params for list.append instead use list.insert
- test: for subprocess calls use relative path not absolute path
- test: carefully escape regex metacharacters
- test: print source .inv file and diff. On windows, issue with regex
- test: remove fixture windows_paths
- test: .git/config textconv executable resolve path
- test: shutil.which to resolve path to executable
- test: resolve both soi and soi-textconv executables path
- test: regression when to use resolved or unresolved executable path
- test: read inventory on disk
- test: print diagnostic before assertions
- test: consistantly use sphobjinv.cli.load:import_infile so compare apple with apples
- test: add resources objects_attrs_plus_one_entry.{txt|inv}
- test: compare existing resources. Rather modify then .txt --> .inv
- test: add fixtures res_cmp_plus_one_line is_linux gitconfig gitattributes
- refactor .git/config append algo
- refactor: print git diff err message
- fix: specify encoding and linesep
  - test: fix use git config to set textconv executable
  - test: add to WorkDir git config list/get/set support
- test: fix inventory path must surround by single quotes
- test: attempt to diagnose WindowsPath getting garbled
- test: file not found create a .gitattributes
- ci: azure-pipelines coverage report omit setup.py
- ci: azure-pipelines need --testall to get 100% coverage
- ci: README.md affected by version. Update version
- test: WorkDir
- test: conftest fixture ensure_doc_scratch
- test: restore fixture ensure_doc_scratch
- chore: fix format and lint
- docs: fix README doctest
@msftcangoblowm
Copy link
Author

During python setup, gh runner failings to download python 3.13 for linux and windows.
Checked the versions manifest and 3.13 for x64 architecture are available.

The runner says could be caused by an authentication issue.

versions-manifest json

##[error]Failed to download Python from the Github Actions python registry python-versions. Error: Error: Failed to download Python versions manifest from the Github Actions python registry python-versions. Invalid GitHub token could cause this.

##[error]Version spec 3.13 for architecture x64 did not match any version in Agent.ToolsDirectory.

This is the relevent entries from the versions manifest. (to save time searching thru it)

{
        "filename": "python-3.13.1-linux-20.04-x64.tar.gz",
        "arch": "x64",
        "platform": "linux",
        "platform_version": "20.04",
        "download_url": "https://github.com/actions/python-versions/releases/download/3.13.1-12154081405/python-3.13.1-linux-20.04-x64.tar.gz"
},
{
        "filename": "python-3.13.1-linux-22.04-x64.tar.gz",
        "arch": "x64",
        "platform": "linux",
        "platform_version": "22.04",
        "download_url": "https://github.com/actions/python-versions/releases/download/3.13.1-12154081405/python-3.13.1-linux-22.04-x64.tar.gz"
      },
{
        "filename": "python-3.13.1-linux-24.04-x64.tar.gz",
        "arch": "x64",
        "platform": "linux",
        "platform_version": "24.04",
        "download_url": "https://github.com/actions/python-versions/releases/download/3.13.1-12154081405/python-3.13.1-linux-24.04-x64.tar.gz"
      },

{
        "filename": "python-3.13.1-win32-x64.zip",
        "arch": "x64",
        "platform": "win32",
        "download_url": "https://github.com/actions/python-versions/releases/download/3.13.1-12154081405/python-3.13.1-win32-x64.zip"
      },

@bskinn
Copy link
Owner

bskinn commented Jan 2, 2025

That same config worked recently for a different pipeline, so I don't think it's a config or token problem. More likely, there was just a transient issue with the GitHub Python repository. I'll trigger a retry; if it still fails, then let's just remove 3.13 from azure-pipelines.yml and not worry about it.

I'm working on an overhaul of the CI (#306) that will migrate everything over to GitHub Actions anyways, which has 3.13 natively available.

@bskinn
Copy link
Owner

bskinn commented Jan 2, 2025

No, still fails with the same errors. Just remove 3.13 from the Azure DevOps matrix.

@msftcangoblowm
Copy link
Author

msftcangoblowm commented Jan 5, 2025 via email

- chore: remove py313 from pipeline
@msftcangoblowm
Copy link
Author

msftcangoblowm commented Jan 5, 2025 via email

@bskinn
Copy link
Owner

bskinn commented Jan 5, 2025

Mm, I didn't think about the rebase being such a problem... merging main into your working branch would have probably worked equally well and been a lot less awful. Sorry about that!!

Copy link
Owner

@bskinn bskinn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicating the review comments from #301

conftest.py Outdated Show resolved Hide resolved
conftest.py Outdated Show resolved Hide resolved
conftest.py Outdated Show resolved Hide resolved
conftest.py Outdated Show resolved Hide resolved
tests/resource/objects_attrs_plus_one_entry.txt Outdated Show resolved Hide resolved
tests/resource/objects_attrs_plus_one_entry.inv Outdated Show resolved Hide resolved
msftcangoblowm and others added 2 commits January 7, 2025 05:00
- test: remove inventory objects_attrs_plus_one_entry
- test(conftest): remove res_cmp_plus_one_line
- test(conftest): consolidate run_cmdline_textconv and run_cmdline_no_checks
@msftcangoblowm
Copy link
Author

After a quick sync, the latest commit addresses the issues you brought up, besides # pragma: no cover comments.

@bskinn bskinn added type: enhancement ✨ Something to add area: cli 💻 function: convert 🧪 bump: minor 🐒 Backward-compatible feature adds (x.y.0) labels Jan 9, 2025
conftest.py Outdated Show resolved Hide resolved
Copy link
Owner

@bskinn bskinn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several more comments across the PR. Still haven't had a chance to dig deeply into the new code itself, or the docs. Will get there.

conftest.py Outdated Show resolved Hide resolved
conftest.py Outdated Show resolved Hide resolved
conftest.py Outdated Show resolved Hide resolved
.gitattributes Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/sphobjinv/version.py Outdated Show resolved Hide resolved
tests/test_api_good.py Outdated Show resolved Hide resolved
tests/test_api_good.py Outdated Show resolved Hide resolved
tests/test_cli.py Outdated Show resolved Hide resolved
tests/test_fixture.py Outdated Show resolved Hide resolved
- fix(version): revert do not change semantic version number
- ci(azure-pipelines): remove pytest option --testall
- test(conftest): remove fixture gitattributes
- test(conftest): remove coverage pragma comments
- test: revert to original pytest.skip conditional block
@msftcangoblowm
Copy link
Author

Please rerun azure pipelines. Getting remotedisconnect and ssl errors

- test(conftest.py): remove run_cmdline_textconv by consolidate into run_cmdline_test
- test(enum.py): add module for enum.Enum declarations
Copy link
Owner

@bskinn bskinn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your patience as I nibble-review on this!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized, enum.py is a bad name, since it shadows stdlib enum.

Should rename this to enums.py, I think.

Comment on lines +134 to +135
# cd .tox; PYTHONPATH=../ tox --root=.. -c ../tox.ini \
# -e py39-sphx_latest-attrs_latest-jsch_latest --workdir=.; cd - &>/dev/null
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these commented-out lines still needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instantly forget complicated commands.

For collaborators, somewhere these commands should be documented. I prefer in context, so zero time is wasted recreating them.

non-tox commands should be in a Makefile.

pytest commands within the respective test module.

Have always written, just the complicated, tox commands within the tox file.

This particular command is how to invoke for pyenv users. The active .python-version file differs for: project base (one py version) and the .tox folder (many py versions)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's revise the current last line to read:

application-import-names = sphobjinv, tests

That way, the linting will group the (to become) tests.enums imports with the sphobjinv imports.

Comment on lines +338 to +343
@pytest.fixture(scope="session")
def is_linux():
"""Report boolean of whether the current system is Linux."""
return platform.system() in ("Linux",)


Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anywhere this fixture is currently used, do we need it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slated for removal

@@ -5,6 +5,7 @@ source =
omit =
# Don't worry about covering vendored libraries
src/sphobjinv/_vendored/*
setup.py
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed this -- I'd be fine with adding conftest.py in here too, actually. It would both be a direct signal that setup.py and conftest.py are meant to not be covered, and I believe would result in them being excluded entirely from any coverage reports.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice! That's much better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: cli 💻 bump: minor 🐒 Backward-compatible feature adds (x.y.0) function: convert 🧪 type: enhancement ✨ Something to add
Projects
None yet
Development

Successfully merging this pull request may close these issues.

act as textconv so can git diff inventory
2 participants