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

[Feature] Support Python PEP440 SemVer #185

Open
3 tasks done
guenp opened this issue Aug 20, 2024 · 0 comments
Open
3 tasks done

[Feature] Support Python PEP440 SemVer #185

guenp opened this issue Aug 20, 2024 · 0 comments
Labels
enhancement New feature or request triage

Comments

@guenp
Copy link

guenp commented Aug 20, 2024

Is this your first time submitting a feature request?

  • I have read the expectations for open source contributors
  • I have searched the existing issues, and I could not find an existing issue for this feature
  • I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

Describe the feature

For dbt-ducdkb, we recently implemented automated versioning via git tags, by adding in a pbr dependency.
pbr uses what they call Linux/Python Compatible Semantic Versioning 3.0.0. The main differences with SemVer 2.0.0 are:

  • Pre-release versions are now separated by . not -, and use a/b/c rather than alpha/beta etc.
  • Alpha version are prefixed by a 0 such as: 2.0.0.0a1 instead of 2.0.0.a1 for version ‘2.0.0 alpha 1’. Please note dev version tag does not have a leading 0, as is 2.0.0.0a2.dev1.

Unfortunately, dbt-common's semver module doesn't seem to match this versioning. Concretely, this means I get this error:

version_string = '1.8.3.dev6'
    @classmethod
    def from_version_string(cls, version_string):
        match = _VERSION_REGEX.match(version_string)
    
        if not match:
>           raise dbt_common.exceptions.base.SemverError(
                f'"{version_string}" is not a valid semantic version.'
            )
E           dbt_common.exceptions.base.SemverError: "1.8.3.dev6" is not a valid semantic version.
venv/lib/python3.12/site-packages/dbt_common/semver.py:99: SemverError

We have a workaround for now, that post-processes the version and replaces the . with a -, see code and PR. However, it would be great to add support for Semver "3.0.0"/PEP-440 versioning to the regex!

Describe alternatives you've considered

  • pbr could instead use SemVer 2.0.0 versioning, but other packages might also follow PEP-440 guidelines
  • We have a workaround (see description) but it's a little hacky

Who will this benefit?

  • dbt adapter maintainers will be able to use pbr

Are you interested in contributing this feature?

No response

Anything else?

No response

@guenp guenp added enhancement New feature or request triage labels Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage
Projects
None yet
Development

No branches or pull requests

1 participant