-
patch: Drop support for Python 3.9 (
b9e5ffb)Undo the last of 8d15f4ab124bb067f5422538050dd7c70b414aa8.
- Use a match case statement in place of an if block.
- Replace Union types with X | Y syntax.
Also introduce support for Python 3.14.
Closes #16.
-
fix: Rework release publishing (
9c718b6)The PyPI upload failed with:
Checking dist/reverse_argparse-2.0.8-py3-none-any.whl: PASSED Checking dist/multiple.intoto.jsonl: ERROR InvalidDistribution: Unknown distribution format: 'multiple.intoto.jsonl'
I suppose the provenance can't be included in the
distdirectory for the PyPI upload, but it needs to be in there for python-semantic-release publish to GitHub Releases action. This commit reorders things, such that we publish to GitHub first, and save PyPI for last, and between the two we remove the provenance from thedistdirectory. Hopefully this works.
-
fix: Set sufficient permissions for publish job (
4004ef2)When running the upload to PyPI action, we ran into:
Error: Trusted publishing exchange failure: OpenID Connect token retrieval failed: GitHub: missing or insufficient OIDC token permissions, the ACTIONS_ID_TOKEN_REQUEST_TOKEN environment variable was unset
This generally indicates a workflow configuration error, such as insufficient permissions. Make sure that your workflow has
id-token: writeconfigured at the job level, e.g.:permissions: id-token: write
-
style: Check flake8-annotations (
9ceb68a)To ensure type-hinting is present in all possible locations.
-
ci: Subdivide release job (
60bca10)This is needed because the SLSA provenance reusable workflow cannot be used as a step within a job, but must be used as a job on its own. This commit therefore subdivides the
releasejob into areleasejob, which runspython-semantic-releaseto create a new release, if applicable, and then apublishjob, to publish the release to PyPI and GitHub Releases, if one was created. We'll then be able to insert the SLSA provenance job between the two.
-
patch: Add SLSA provenance to release assets (
e4e6ebc)See https://slsa.dev/ for motivation.
Creating a patch release to ensure these additions to the automated release process work.
Closes #260.
- patch: Sign semantic release commits/tags (
e7dcfc3)
-
patch: Omit pre-commit updates from CHANGELOG (
b6298d8)I thought 1aa9022a7c7796e85e342382f67b02434d4b544b was sufficient for this, but apparently not. Trying again.
-
patch: Omit dependency auto-updates from CHANGELOG (
1aa9022)This is marked at a patch release to ensure the change works, and regenerate the CHANGELOG without the noisy entries.
-
chore: Update security notice (
4d51098)The Best Practices Badge App suggests we should document what users can expect from our project in terms of security.
-
docs: Switch to
project_copyright(d0a21d5)Using this alias means we're no longer overshadowing the
copyrightbuilt-in, so we can remove the comment to ignore that Ruff linting rule.
-
patch: Replace deprecated GitHub Action (
e5f4256)Marking this as a patch release to test out the new action and make sure it works.
Closes #255.
-
fix: Switch import location (
7948fc2)In Python 3.9,
typing.Sequencewas deprecated in favor ofcollections.abc.Sequence(see PEP 585).
- patch: Support Python 3.13 (
453fd05)
-
chore!: Drop support for Python 3.8 (
5c448ec)- Use the type-hinting provided out of the box in 3.9.
- Remove version guards around
argparse.BooleanOptionalAction. - Update documentation and CI accordingly.
-
chore: Tweak dependabot again (
1af1398) -
chore: Tweak dependabot (
c4c9252)Run weekly instead of daily, and group updates into a single PR for each packaging ecosystem.
-
chore: Update LICENSE/COPYRIGHT info (
aae82e5)
-
ci: Change documentation coverage file name (
c487d94) -
ci: Restrict token permissions (
dfb85fd)https://github.com/sandialabs/reverse_argparse/security/code-scanning/21
-
ci: Tweak automated suggestions (
3a73bda) -
ci: Apply security best practices (
27fd558)Signed-off-by: StepSecurity Bot bot@stepsecurity.io
-
ci: Don't fix Ruff issues (
6fb3b58)Remove the
--fixargument from theruffcheck in the pre-commit configuration. We don't want automated commits pushed to PRs, because we want to encourage contributors to clean up their branches before merging. Additionally, when pre-commit doesn't automatically fix files, it shows the user what the issues are, thereby training them to avoid them in the future.
-
docs: Fix highlighting in examples (
149e48c)I never noticed when we added the license and copyright information to the top of all the source files that we didn't account for the lines highlighted in the included examples. This adjusts things such that (1) we don't include all that header stuff when generating the docs, and only include the lines of code that are really relevant to share on the examples page, and (2) the appropriate lines are highlighted.
-
docs: Slight tweaks to contributing guidelines (
6e2ddc9)
-
test: Remove unnecessary parentheses (
7c7d39a)To align with updated ruff rules.
-
test: Ignore subprocess warning in test file (
90e3cad)This test file uses
subprocess.run()to run the examples and check their output. The input torun()has been verified and is not a security vulnerability.
-
chore: Remove commitizen configuration (
73ceec1) -
chore: Remove commitizen pre-commit hook (
18c274f)In order to enable a faster development workflow, remove the commitizen pre-commit hook to allow commits messages that don't adhere to the Conventional Commits specification. Commit messages are still checked in the Continuous Integration workflow, though, so a branch will need to be clean before merging.
-
docs: Fix license/copyright text in file (
1d496c1)Should have been included in b3553415da40949f9ce496ca1363cb69424da791, but was overlooked.
-
docs: Reword Conventional Commits guidelines (
6659b11) -
docs: Add code lines badge (
9e4953d)
-
patch: Indicate that the package is typed (
bd89c55)According to PEP 561, we need to add this file to static type checkers can infer the types from the package.
- test: Ignore assert warnings in test files (
01f97d0)
-
chore: Ignore security findings in tests/examples (
f18ece4) -
chore: Switch to Ruff (
6112943)Use Ruff to replace a variety of linters/formatters.
-
chore: Fix badge URLs (
2c8dda1)Somehow it looks like some hidden character wound up copy/pasted in the middle of the
https. -
chore: Add PR template (
eb0b3b8)
-
ci: Add OpenSSF Scorecard workflow (
5f8f3cf) -
ci: auto fixes from pre-commit.com hooks (
2d05e81)for more information, see https://pre-commit.ci
-
docs: Add docstrings to test/example files (
f0b7eb9) -
docs: Add OpenSSF Scorecard badge to ReadTheDocs (
91c5557) -
docs: Add CodeFactor badge (
105a394) -
docs: Adopt Conventional Comments (
9d16c0c)Try to encourage effective communication via issues/PRs.
-
docs: Update link to latest GMS release (
af2ce45) -
docs: Move copyright/license text to comments (
b355341)In all source files, move the copyright and license text from the module docstring to comments immediately below it. This is to avoid processing this text when Sphinx is automatically generating documentation from docstrings.
-
docs: Add contributor license agreement (
9531c94) -
docs: Update copyright text in source files (
4cba3d0)Per guidance from Sandia Technology Transfer, the recommended text from the Linux Foundation is insufficient for our purposes.
-
docs: Update copyright/license info (
4d1d42a)Update the copyright years in the
LICENSE.mdfile and add copyright and license information to all source files (part of the Gold level OpenSSF Best Practices). -
docs: Add coverage job steps (
3b20a84)Add steps to the CI job to compute the documentation coverage for the package and archive the results.
-
patch: Force
prefer_shortto be keyword-only (f02c7f2)Turning on
flake8-boolean-traplinting via Ruff resulted in the following findings:reverse_argparse/reverse_argparse.py:242:31: FBT002 Boolean default positional argument in function definition reverse_argparse/reverse_argparse.py:242:31: FBT001 Boolean-typed positional argument in function definition Found 2 errors.
Switching
prefer_shortfrom a positional to a keyword-only argument addresses the problem.Note that this is technically a breaking change, but only for a "private" method, not in the package's public API. Therefore the change is not registered as a breaking change via Conventional Commit syntax, and no major version update will be created. Instead, this commit will force the creation of a patch release. If users were relying on the prior behavior of this internal method, they can simply switch to the keyword syntax when calling it.
-
refactor: Address Ruff-specific lint findings (
076e199) -
refactor: Address Pylint findings (
862bc62) -
refactor: Ignore particular type error (
9d412dd) -
refactor: Remove unnecessary shebang lines (
a7ae1f6) -
refactor: Assign exception messages to variables (
844c71a)Running
flake8-errmsgvia Ruff yielded the following findings:reverse_argparse/reverse_argparse.py:143:17: EM102 Exception must not use an f-string literal, assign to variable first reverse_argparse/reverse_argparse.py:461:17: EM102 Exception must not use an f-string literal, assign to variable first Found 2 errors.
This changes resolves the issues.
-
refactor: Don't override Python builtins (
9006adb)
-
test: Use tuples for parametrize variables (
25d9be8) -
test: Use UTC timezone with datetime (
25ff30f)Running
flake8-datetimezvia Ruff yielded the following findings:example/test_examples.py:88:25: DTZ005
datetime.datetime.now()called without atzargument example/test_examples.py:89:25: DTZ007 Naive datetime constructed usingdatetime.datetime.strptime()without %z example/test_examples.py:125:13: DTZ005datetime.datetime.now()called without atzargument example/test_examples.py:126:25: DTZ007 Naive datetime constructed usingdatetime.datetime.strptime()without %z Found 4 errors.Specifying timezone info resolves the issues.
-
docs: Add more badges (
629857d)Add additional badges to capture things like contributions, the conda-forge release channel, etc.
-
docs: Include badges in ReadTheDocs (
e30fc68)Include the badges from the README in the index page of our documentation so this information is visible on ReadTheDocs in addition to GitHub and PyPI.
Closes #81.
-
docs: Private vulnerability reporting (
9d6a758)Remove the security issue template and instead direct people to file a private security advisory.
-
patch: Add a badge for the CodeQL action (
2d77837)Create a patch release to push all these new badges out to PyPI.
-
chore: Update python-semantic-release config (
9972341)- Add commit types to automatically bump the minor or patch version numbers via a commit message.
- Update commitizen configuration to allow the new commit types.
-
chore: Add Python 3.12 to pyproject.toml (
ef59c2d)This was accidentally omitted in 6642a176e3591f3ef8ed0c04dbcbc4a257c5b127.
-
chore: Remove YAPF configuration (
ad02127)We switched to
blackback in #5.
-
ci: Add Python 3.12 to CI (
f03f4dc)Also update the version badge to specify particular versions.
-
ci: pre-commit autoupdate (
08fe531)updates:
-
docs: Remove dependency pinning (
b14034f)I should be the case that the bugs that kept us on an older version of Sphinx have been resolved at this point, so remove the version pinning.
-
docs: Add sphinx-copybutton (
2122825)Automatically add a button to all code boxes to copy the contents to the clipboard.
-
docs: Special thanks to @mjsumpter (
6cc3054)Include @mjsumpter in the Credits section at the bottom of the README, as he put together a prior iteration of this concept under my guidance. His earlier implementation informed the eventual creation of this package.
-
docs: Fix typos (
eb05c2c) -
docs: Add CI details to contributing guidelines (
b8269bf) -
docs: Check spelling (
b72ee11)Add sphinxcontrib-spelling extension to check the spelling in our documentation, and add a step to the CI job to ensure all is well.
-
docs: Add OpenSSF Best Practices badge (
604fb61) -
docs: Fix copy/paste issue (
2f6517a) -
docs: pre-commit install instructions (
063d8f9)
-
patch: Add release notes template (
a447eac)- Create a template to govern the generation of release notes by python-semantic-release.
- Bump the patch version number to test that this works as expected.
-
test: Run examples in CI (
6642a17)Create
example/test_examples.pysopytestruns all the examples and checks their output.
- fix: PyPI badge (
1581e2a)
- fix: Semantic release configuration (
a73688c)
-
fix: Release notes template (
1ac839a) -
fix: Semantic release configuration (
0325dc0)- Add
__init__.pyto the files modified. - Fix the
__version__in that file. - Remove trailing space in CHANGELOG template.
- Add build command.
- Make release commit match conventional standard.
- Add release notes template.
- Publish releases to PyPI and GitHub Releases.
- Add
- ci: Remove
-vvforsemantic-release(d83ae5d)
- fix: Include version in init.py (
b7b369e)
-
ci: Rename workflow file (
1cfed2d) -
ci: Add conventional commits job (
c683d7a) -
ci: Set up semantice-release (
9f233be)Add a semantic-release configuration to
pyproject.toml, with a customCHANGELOG.mdtemplate. Also add a GitHub Actions workflow.
- docs: Fix PyPI badge (
edcc3d4)
-
1.0.1 (
92bdc1a)Automatically generated by python-semantic-release.
-
fix: Move init.py (
324f3e5)Part of extracting this package from the repository it was initially developed in.
-
fix: Correct method call (
27fb201)Should have been part of 509fafb33329128ba8985578d66ab1bffe3fdbfb.
-
fix: Omit suppressed arguments (
9484360)If an argument's help text has been suppressed, and the value of the argument matches the default value, that indicated that a parser author has hidden an argument from users, and the user hasn't modified it on the command line. To match the parser author's intent, such arguments should be omitted from the effective command line invocation.
- chore: Enable Pyroma (
124fa62) - chore: Enable Bandit (
80e5bbe) - chore: Add pre-commit hooks (
1c2a015) - chore: Add pre-commit configuration (
93ba0e7) - chore: Add VS Code settings (
cc4edb2) - chore: Add pycache to .gitignore (
48a8acd)
- style: Address black issues (
f2a8622)
-
ci: Remove documentation jobs (
81ab9c2)Let ReadTheDocs test the PR instead.
-
ci: Add Sphinx job to build the docs (
671ac18) -
ci: Install all development dependencies (
d8e7cf6) -
ci: Switch to CodeCov (
5899e2f)Abandon Coveralls, as it doesn't seem to integrate well with GitHub Actions.
-
ci: Add Coveralls integration (
7b19390) -
ci: Don't auto-fix PRs (
cab73e9) -
ci: Switch flake8 (
477646b)Instead of running
flake8in our GitHub Actions workflow, run it via pre-commit.ci. -
ci: Add initial workflow (
9e42fcd)Create initial GitHub Actions workflow to lint and test the package.
-
docs: Prepare for PyPI (
511e859) -
docs: Fix punctuation. (
cfc1279) -
docs: Tweak badge (
369b154) -
docs: Sort badges in README (
9db52fe) -
docs: Add ReadTheDocs badge to README (
df7e2db) -
docs: Correct links (
df1bde3)Correct the URL for the documentation hosting on ReadTheDocs.
-
docs: Create
_staticdirectory (6d83328) -
docs: Install the package first (
c00c692)Try to
pip install .as part of creating the environment for ReadTheDocs. -
docs: Add ReadTheDocs configuration (
32e84f1) -
docs: Add Sphinx documentation (
4595541)Create the Sphinx-based documentation for the package, including:
- Getting started guidelines
- The motivation for the package
- Example use cases
- Reference documentation for developers
-
docs: Add CI badge to README (
b14c7dd) -
docs: Fix contributing guidelines (
87afd52) -
docs: Address pydocstyle issues (
1c1d2e2) -
docs: Update contributing guidelines (
7f41b8d)Translate from GitLab to GitHub.
-
docs: Add issue template (
9e8cfc0) -
docs: Update Markdown files (
62c9115)Tweaks to link syntax, etc.
-
docs: Update README.md (
1d69674) -
docs: Add LICENSE.md (
72de284) -
docs: Make unparse grammar consistent (
bb55e4d)Make the spelling of unparse and its derivatives consistent (no hyphenation, not quoted) in all docstrings and text printed to the terminal.
-
feat: Make private method public (
509fafb)Since classes/scripts using
reverse_argparsemay also need the ability to quote a command line argument if there are spaces in it, transitionquote_arg_if_necessaryfrom a private to a public method. This will avoid code duplication outsidereverse_argparse, and ensure classes and scripts that are using it are quoting arguments consistently. -
feat: Handle subparsers (
b2262d5)Enable the unparsing of subparser actions by recursively pushing them onto the stack of parsers, unparsing them, and popping them back off the stack.
Note: This also makes it such that optional arguments are unparsed before positional ones, as this is required when dealing with subparsers.
-
refactor: Only support Python 3.8+ (
8d15f4a)Changes that can be undone when we remove 3.8 support:
- Change certain type hints to work for 3.8
- Use version guard around
BooleanOptionalAction
Changes that can be undone when we remove 3.9 support:
- Switch match-case statement to if block.
-
refactor: Address pylint issues (
b4555dc) -
refactor: Address isort issues (
fd6242d) -
refactor: Address mypy issues (
403e53d) -
refactor!: Build up
argsconsecutively (d9a5639)Rework the class such that:
- We initialize the
argsto a list of strings containing only the program name. - Each
_unparse_*method appends a list of strings corresponding to the action to theargs. - The
get_*_command_line_invocationmethods appropriately concatenate the elements inargsinto a single string.
This sets us up for being able to handle sub-parser actions.
Note that this is a breaking change, as it removes the
get_*_argspublic methods. - We initialize the
-
refactor: Display positional arguments first (
ccf644d)Display positional rather than optional arguments first in the effective command line. This is necessary to prepare for the ability to handle sub-parsers.
-
refactor: Prepare for nested parsers (
ec3a7d8)Change the
parserattribute to be a list of parsers to prepare for processing nested parsers.
-
test: Adjust code coverage (
b7aa09e) -
test: Rework tests for calling program name (
8c21452)As part of the transition from GitLab CI/CD to GitHub Actions, the program name used when running the tests has shifted from
__main__.pytopytest. This commits adjusts the tests to ignore the program name, and only pay attention to the arguments that come after it, such that the tests will work in both contexts. -
test: Fix import (
65e57ba)Rework how the tests import the class, given the package reorganization after pulling it out of the repository it was initially developed in.
-
[pre-commit.ci] pre-commit autoupdate (
a88839f)updates:
-
[pre-commit.ci] pre-commit autoupdate (
f0df3d3)updates:
-
[pre-commit.ci] pre-commit autoupdate (
fd58d13)updates:
-
Add more issue templates (
234b562) -
Add CHANGELOG.md (
7bcc39d) -
Add CONTRIBUTING.md (
2b6dfc0) -
Add CODE_OF_CONDUCT.md (
acbac7d) -
Add SECURITY.md (
4ef978c) -
Add README.md (
4a0580c) -
Move init.py (
c50bcd2) -
Add setup.py (
1de083b) -
Add requirements.txt (
75aa526) -
Add pyproject.toml (
e833969) -
Add .style.yapf (
13d6301) -
Add .gitignore (
1c329cf) -
Add .coveragerc (
b43be41) -
Unparse
BooleanOptionalAction(cd82066) -
Unparse
extendaction (3e9fbd3) -
Unparse
countaction (224b23b) -
Unparse
append_constaction (b22390a) -
Unparse
store_constaction (64cc273) -
Create
reverse_argparsemodule (#1873) (1ab310c)Create a module that is able to generate the effective command line invocation of a script, given the
ArgumentParserthat was used to parse the command line options, and theNamespaceof those parsed options. This makes it such that users can know exactly what was run, including all default values, and any transformations that might've been made to the arguments after parsing.This commit only implements the functionality we care about at the moment, which includes the following "actions":
- store
- store_true
- store_false
- append
- help
- version
The remaining actions are stubbed out but not yet implemented:
- store_const
- append_const
- count
- extend
- BooleanOptionalAction
Also how sub-parsers are handled remains to be determined in the future.