fix: Support parsing inline-table format of Poetry dependency spec #71
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Suggested fix for #70. This allows for the Nautobot module dependency defined in
pyproject.toml
to be parsed successfully both in its string form and its inline-table form.If a user wants extras included with the Nautobot dependency, such as "napalm" or "remote_storage", they will appear in
pyproject.toml
like so:toml.load
will represent this as a dict-like object. We can try to parse it as a dict first, then fall back to parsing it as a string. As far as I know, these should be the only two forms the version value will come in for most use cases. Multiple constraints bring a list-of-dicts form as well, but I'd imagine that's more of a fringe case.I would also advise considering the possibility of users supplying one of the different possible version strings. For example, if a user wants to add the 'napalm' extra to their Nautobot dependency, they would most likely do so with the
poetry add
command:Since no version is specified, Poetry defaults to setting the version string to
^(current version)
, i.e.^2.2.2
. That caret is going to throw a wrench in Docker's rendering of the Nautobot image URL:nautobot-docker-compose/environments/Dockerfile
Lines 1 to 3 in 40eec08
The resolution for this comes down to the project's preference. If you want to constrain the dependency versioning to only using a static version, I think raising a warning to the user would suffice. Otherwise, you'd have to tackle the less trivial task of parsing
poetry.lock
for the resolved Nautobot module version.