- Added:
{major}
,{minor}
, and{patch}
format placeholders.
- Fixed: The
--ignore-untracked
CLI flag was ignored. - Added:
--commit-length
option.
- Fixed: Some timestamps could fail to parse on Python 3.5 and 3.6.
- Fixed: Distance was calculated inconsistently for Git when there were some tags and none matched the version pattern.
-
Generally, when Dunamai can detect the VCS in use, but there's no version set yet, then Dunamai uses 0.0.0 as a fallback, unless strict mode is enabled. This is useful for new projects that do not yet have a release.
However, if there were some tags and none matched the version pattern, then Dunamai would yield an error. That wouldn't be helpful for a new project with some non-version tag, and it could be incorrect for a monorepo with different tags for different packages.
Now, Dunamai will use 0.0.0 in this case as well, unless strict mode is enabled.
-
You can now specify a pattern prefix. For example,
--pattern default --pattern-prefix some-package-
would match tags likesome-package-v1.2.3
. This is useful if you just want a custom prefix without writing a whole pattern. -
Added
--ignore-untracked
option to control checking whether the repository is dirty.
- Updated
Version.bump()
to add asmart
argument, which only bumps whendistance != 0
. This will also makeVersion.serialize()
use pre-release formatting automatically, like callingVersion.serialize(bump=True)
.
- Fixed an exception when a Git repository had a broken ref. Git would print a warning that Dunamai failed to parse.
- Relaxed Python bounds from
^3.5
to>=3.5
since Python does not follow Semantic Versioning. - Fixed some
git log
commands that did not include-c log.showsignature=false
. (Contributed by pdecat)
- Added a
--path
option to inspect a directory other than the current one. TheVersion.from_*
methods now also take apath
argument.
- For Git 2.16+,
--decorate-refs=refs/tags/
is now specified forgit log
in case you've configuredlog.excludeDecoration=refs/tags/
.
- Added a
vcs
attribute toVersion
to indicate which VCS was detected.
- The
from
command will print a warning for shallow Git repositories. This becomes an error with--strict
. - The
Version
class has a newconcerns
field to indicate warnings with the version. Right now, the only possibility isConcern.ShallowRepository
.
- Fixed outdated reference to
pkg_resources
in the docstring forget_version
. CHANGELOG.md
andtests
are now included in sdists.
- Updated
Version.parse
to better handle PEP 440 versions produced by Dunamai itself. Specifically, in1.2.3.post4.dev5
, the post number becomes the distance and the dev number is ignored. In1.2.3.dev5
, the dev number becomes the distance. - Added
increment
argument tobump_version
andVersion.bump
. (Contributed by legendof-selda) - Fixed Git detection when there is a "dubious ownership" error.
Previously,
from git
would report that it was not a Git project, andfrom any
would report that it could not detect a VCS. Now, both commands report that there is dubious ownership. - Improved error reporting for
from any
VCS detection. The error now specifies which VCSes were checked and which were not found to be installed.
- Added compatibility with Git versions as old as 1.8.2.3.
- Fixed Git 2.7.0 compatibility by changing
git log --no-show-signature
togit -c log.showsignature=false log
.
- Added a
strict
option to prevent falling back to0.0.0
when there are no tags. - Added support for
.git_archival.json
files created bygit archive
. - Added support for
.hg_archival.txt
files created byhg archive
.
- Fixed an error when parsing Git output with
showSignature = true
configured. (Contributed by riton)
- Made pattern-related error messages more readable by moving the pattern after the primary message instead of mixing them.
- Added support for Pijul.
- Added
Pattern
type for named pattern presets. Currently, this includes:Pattern.Default
(CLI:--pattern default
) for the existing default.Pattern.DefaultUnprefixed
(CLI:--pattern default-unprefixed
) for the existing default, but without requiring thev
prefix.
- Added
tag_branch
option (CLI:--tag-branch
) for Git repositories. This is particularly useful for Gitflow without fast forward, wheredevelop
does not contain the tag history, so you can specify--tag-branch master
. - Added
full_commit
option (CLI:--full-commit
) for Git and Mercurial repositories to obtain the full commit hash instead of the short form. - Fixed
Version.parse
so that it better handles versions without thev
prefix when the pattern does not (or may not) require it. - Fixed error reporting when a custom pattern is an invalid regular expression, as well as when a custom format is malformed. It was fine when Dunamai was used as a library, but the error message lacked context on the CLI.
- Fixed
from any
not passing the--tag-dir
option along for Subversion repositories.
- Fixed the
--bump
CLI option and thebump
argument ofVersion.serialize
bumping even on a commit with a version tag. Now, no bumping occurs on such a commit.
- Explicitly specified
Optional[...]
typing on arguments with a default ofNone
. (Contributed by jonathangreen) - Made
VERSION_SOURCE_PATTERN
public for consumption by other tools.
-
Added
branch
andtimestamp
to theVersion
class, along with associated format placeholders (branch
,branch_escaped
,timestamp
). Branch info is not populated for Darcs and Subversion repositories. -
Fixed validation for PEP 440, where the local segment was allowed to contain any characters.
-
Fixed validation for Semantic Versioning, where some segments were allowed to contain these additional characters:
[ \ ] ^ _ `
- Changed
Version.serialize
'sformat
argument to support passing a callback. (Contributed by marnikow) - Added
ignore
option toget_version()
. (Contributed by marnikow) - Added
parser
option toget_version()
. - Added
Version.parse()
. (Contributed by marnikow) - Added
Version.bump()
. (Contributed by marnikow)
- Changed the build backend to poetry-core. (Contributed by fabaff)
- Clarified serialization options that are ignored when using a custom format.
- Relaxed dependency range of
importlib-metadata
for compatibility with Poetry. - Added
epoch
toVersion
class, default tag pattern, and format placeholders. - Fixed PEP 440 validation to allow multiple digits in the epoch.
- Improved parsing of optional pattern groups so that we don't stop checking at the first one that's omitted.
- Fixed handling of tags with
post
/dev
stages so that they are serialized and bumped correctly when using PEP 440.
- Broadened the default version tag pattern to allow more separator styles
recognized in PEP 440 pre-normalized forms (
-
,.
, and_
). - Enhanced
serialize_pep440()
to normalize the alternative prerelease names (alpha
->a
,beta
->b
,c
/pre
/preview
->rc
) and capitalizations (RC
->rc
, etc). - Added a
py.typed
file for PEP-561. (Contributed by wwuck) - Replaced
pkg_resources
dependency withpackaging
andimportlib_metadata
. (Contributed by flying-sheep) - Added some missing public items to
__all__
.
- Fixed an oversight where the default version tag pattern would only find
tags with exactly three parts in the base (e.g.,
v1.0.0
andv1.2.3
). This is now relaxed so thatv1
,v1.2.3.4
, and so on are also recognized. - Added support for execution via
python -m dunamai
. (Contributed by jstriebel)
- Fixed handling of Git tags that contain slashes. (Contributed by ioben)
- Fixed handling of Git tags that contain commas.
- Fixed Semantic Versioning enforcement to allow metadata segments with more than two dot-separated identifiers.
- For Git, avoided use of
--decorate-refs
to maintain compatibility with older Git versions.
- Improved ordering of Git tags, particularly when commit dates were not chronological. (Contributed by mariusvniekerk)
- Improved Subversion handling when in a subdirectory of the repository. (Contributed by Spirotot)
- Added the
--tagged-metadata
option and corresponding attribute on theVersion
class. (Contributed by mariusvniekerk) - Added explicit dependency on setuptools (because of using
pkg_resources
) for environments where it is not installed by default.
- For Git, replaced
--porcelain=v1
with--porcelain
to maintain compatibility with older Git versions.
- Added the
--bump
command line option and thebump
argument toVersion.serialize()
. - Fixed an issue with Git annotated tag sorting. When there was a newer annotated tag A on an older commit and an older annotated tag B on a newer commit, Dunamai would choose tag A, but will now correctly choose tag B because the commit is newer.
- With Git, trigger the dirty flag when there are untracked files. (Contributed by jpc4242)
- Fixed ambiguous reference error when using Git if a tag and branch name were identical.
-
Previously, when there were not yet any version-like tags, the distance would be set to 0, so the only differentiator was the commit ID. Now, the distance will be set to the number of commits so far. For example:
- No commits: base = 0.0.0, distance = 0
- 1 commit, no tags: base = 0.0.0, distance = 1
- 10 commits, no tags: base = 0.0.0, distance = 10
- Added
--debug
flag.
- Added these functions to the public API:
serialize_pep440
serialize_semver
serialize_pvp
bump_version
-
Changed the
Version
class to align with Dunamai's own semantics instead of PEP 440's semantics.Previously,
Version
implemented all of PEP 440's features, like epochs and dev releases, even though Dunamai itself did not use epochs (unless you created your ownVersion
instance with one and serialized it) and always set dev to 0 in thefrom_git
/etc methods. Theserialize
method then tried to generalize those PEP 440 concepts to other versioning schemes, as in0.1.0-epoch.1
for Semantic Versioning, even though that doesn't have an equivalent meaning in that scheme.Now, the
Version
class implements the semantics used by Dunamai, giving it more power in the serialization to map those concepts in an appropriate way for each scheme. For example,dev0
is now only added for PEP 440 (in order to be compatible with Pip's--pre
flag), butdev.0
is no longer added for Semantic Versioning because it served no purpose there.API changes:
post
has been renamed todistance
, and its type is simplyint
rather thanOptional[int]
epoch
anddev
have been removedpre_type
has been renamed tostage
pre_number
has been renamed torevision
, and it is no longer required when specifying a stage
-
Improved error reporting when the version control system cannot be detected and when a specified VCS is unavailable.
-
Improved the default regular expression for tags:
- It now requires a full match of the tag.
- It now recognizes when the
base
andstage
are separated by a hyphen. - It now recognizes when the
stage
andrevision
are separated by a dot. - It now allows a
stage
without arevision
.
- Added Fossil support.
- Fixed case with Git/Mercurial/Subversion/Bazaar where, if you checked out an older commit, then Dunamai would consider tags for commits both before and after the commit that was checked out. It now only considers tags for the checked out commit or one of its ancestors, making the results more deterministic.
- Changed VCS detection to be based on the result of VCS commands rather than
looking for VCS-specific directories/files. This avoids the risk of false
positives and simplifies cases with inconsistent VCS files (e.g.,
Fossil uses
.fslckout
on Linux and_FOSSIL_
on Windows)
- Fixed handling of annotated Git tags, which were previously ignored.
- Changed
Version.from_any_vcs
to accept thetag_dir
argument, which will only be used if Subversion is the detected VCS. Likewise,dunamai from any
now accepts--tag-dir
. - Added
Version.from_vcs
to make it easier for other tools to map from a user's VCS configuration to the appropriate function.
- Fixed issue on Linux where shell commands were not interpreted correctly.
- Added Bazaar support.
- Added the
dunamai check
command and the correspondingcheck_version
function. - Added the option to check just the latest tag or to keep checking tags until a match is found. The default behavior is now to keep checking.
- Added enforcement of Semantic Versioning rule against numeric segments with a leading zero.
- Renamed the
with_metadata
andwith_dirty
arguments ofVersion.serialize
tometadata
anddirty
respectively. - Fixed the equality and ordering of
Version
to consider all attributes.dirty
andcommit
were ignored previously if neitherpost
nordev
were set, anddirty=None
anddirty=False
were not distinguished.
- Added Subversion support.
- Added support for the PVP style.
- Changed the type of the
style
argument inVersion.serialize
fromstr
toStyle
.
- Added built-in Semantic Versioning output style in addition to PEP 440.
- Added style validation for custom output formats.
- Added Darcs support.
- Added support for custom serialization formats.
- Added Mercurial support.
- Added a CLI.
- Renamed
Version.from_git_describe
toVersion.from_git
. - Changed behavior of
Version.serialize
argumentwith_metadata
so that, by default, metadata is excluded when post and dev are not set. - Added
with_dirty
argument toVersion.serialize
and removedflag_dirty
argument fromVersion.from_git
. The information should always be collected, and it is up to the serialization step to decide what to do with it. - Added
Version.from_any_vcs
. - Removed
source
attribute ofVersion
since some VCSes may require multiple commands in conjunction and therefore not have a single source string.
- Fixed a wrong Git command being used.
- Made metadata serialization opt-in.
- Initial release.