Closed cmarqu closed 2 months ago
I've tried messing around with this a bit, but I'm not entirely satisfied with it.
docs/conf.py
in the plugin config in advance, even if they don't have that file yet in one of their projects.*/_versoin.py
does have a wildcard, but deserves a warning.The best option I could think of is enabling the warning when some environment variable is set. I don't mind adding that, but it's not as convenient as something automatic. Do you have any interest in this option for your use case?
For the non-wildcard case (2nd item), I would say it's a matter of "don't do that then".
It's easy to either touch
the docs/conf.py
or comment out that line in the pyproject.toml
if the warning is somehow breaking their build.
But if not automatic (which I would be fine with, it could be a breaking change for some of your users), instead of an environment variable which is not very discoverable, how about a setting in the pyproject.toml
like on-version-substitution-fail = {"warn-non-wildcard", "warn-all", "error-non-wildcard", "error-all"}
?
I may revisit this in the future, but I'm still a bit hesitant about this one. For now, I'm introducing a general purpose env var for debug logging, which covers this case and could be expanded to others:
$ POETRY_DYNAMIC_VERSIONING_DEBUG=1 poetry build
No files found for substitution with glob '*.py' in folder 'C:\git\poetry-dynamic-versioning\tests\dependency-dynamic'
No files found for substitution with glob '*/__version__.py' in folder 'C:\git\poetry-dynamic-versioning\tests\dependency-dynamic'
No files found for substitution with glob '*/_version.py' in folder 'C:\git\poetry-dynamic-versioning\tests\dependency-dynamic'
No changes made during substitution in file 'C:\git\poetry-dynamic-versioning\tests\dependency-dynamic\dependency_dynamic\__init__.py'
When a list element of
[tool.poetry-dynamic-versioning.substitution]
does not use wildcards, it would be nice if the plugin printed a warning (or, optionally, an error) when the list element could not be found or is readonly in the file system.