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

Add toml python extra to pull in a toml parser #126

Merged
merged 3 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ It can be installed with pip:

pip install antsibull-changelog

For python projects, `antsibull-changelog release` can retrieve the current
version from `pyproject.toml`.
You can install the project with

pip install antsibull-changelog[toml]

to pull in the necessary toml parser for this feature.
felixfontein marked this conversation as resolved.
Show resolved Hide resolved
The `toml` extra is always available, but it is noop on Python >= 3.11,
as `tomllib` is part of the standard library.

For more information, see the
[documentation](https://github.com/ansible-community/antsibull-changelog/tree/main/docs/changelogs.rst).

Expand Down
5 changes: 5 additions & 0 deletions changelogs/fragments/126-toml-extra.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
minor_changes:
- Add ``toml`` extra to pull in a toml parser to use to guess the version
based on ``pyproject.toml``
(https://github.com/ansible-community/antsibull-changelog/pull/126).
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def bump(session: nox.Session):
session.error(
f"Either {fragment_file} must already exist, or two positional arguments must be provided."
)
install(session, ".", "hatch", "tomli ; python_version < '3.11'")
install(session, ".[toml]", "hatch")
_repl_version(session, version)
if len(session.posargs) > 1:
fragment = session.run(
Expand Down
13 changes: 13 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ antsibull-changelog = "antsibull_changelog.cli:main"


[project.optional-dependencies]
#
# User facing
#

# Use for getting the current version from pyproject.toml
toml = [
"tomli; python_version<'3.11'",
]

#
# Development. Not user facing.
#

codeqa = [
"flake8 >= 3.8.0",
"pylint",
Expand Down