Method function signatures changing in v1.0 #11
jwodder
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In
versioningit
, the methods for carrying out steps are implemented as functions — potentially user-defined — that take a step-specific set of arguments plus a collection of parameters supplied in the user configuration (usually the respective table inpyproject.toml
). In the current v0.x series, these user parameters are passed as keyword arguments to the functions; e.g., the arguments signature for VCS methods is of the form:I have since realized that passing user parameters this way is silly and creates more problems than it solves. As a result, the way that user parameters are passed to method functions will change in the upcoming v1.0.0 release. Parameters will now be passed as a
dict
supplied as a singleparams
keyword argument; e.g., for VCS methods, the arguments signature becomes:Reasons for this change include:
With the v0.x signatures, it was impossible for user parameters to include fields with the same names as step-specific arguments; e.g., if a
[tool.versioningit.vcs]
table contained aproject_dir
key, that key had to be discarded. With the upcoming signature change, this restriction is lifted.As far as I can recall/determine, the only benefit of the v0.x signatures was that they allowed method functions to receive select user parameters as direct function arguments, but this can't work for all parameters, as TOML keys with hyphens in them (a common usecase) are invalid as Python identifiers.
This change affects the following types of Python projects:
Projects that define their own custom
versioningit
methodsExtension packages that provide custom
versioningit
methodsProjects that use custom extension packages that provide custom
versioningit
methodsSearching for such projects on GitHub and elsewhere turns up no results, which suggests that no one will notice this change, but I cannot rule out the possibility of private repositories using this feature. As long as such projects put a
<1.0
or similar restriction on theirversioningit
dependencies and consult the CHANGELOG before updating for v1.0, nothing should break.Beta Was this translation helpful? Give feedback.
All reactions