Skip to content

Commit

Permalink
Merge pull request #10 from sbidoul/fix-dynamic-version
Browse files Browse the repository at this point in the history
Fix issue with dynamic version in pyproject.toml
  • Loading branch information
sbidoul authored Sep 22, 2023
2 parents 2f4bb83 + 7b5f315 commit 100e4df
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/pyproject_dependencies/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from build.util import project_wheel_metadata
from packaging.requirements import Requirement
from packaging.utils import canonicalize_name
from packaging.version import Version
from pyproject_metadata import RFC822Message, StandardMetadata

from .compat import Protocol, tomllib
Expand Down Expand Up @@ -93,6 +94,10 @@ def pyproject_metadata(
or "optional-dependencies" in metadata.dynamic
):
return None
if not metadata.version:
# Fill-in metadata.version because it cannot be dynamic when converting
# to rfc822 format. We don't use it as we are only interested in Requires-Dist.
metadata.version = Version("0")
return RFC822MessageAdapter(metadata.as_rfc822())


Expand Down

0 comments on commit 100e4df

Please sign in to comment.