Skip to content

Commit 02770ad

Browse files
Fix __package_version__ attr literal evaluation. (#322)
* Fix __package_version__ attr literal evaluation. Dynamic metadata should be compatible with ast.literal_eval() so that import fallback is not needed. It's important to avoid the import fallback as that pulls in a number of unnecessary build dependencies. See: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#dynamic-metadata
1 parent 7312ae0 commit 02770ad

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

emailproxy.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
__author__ = 'Simon Robinson'
77
__copyright__ = 'Copyright (c) 2024 Simon Robinson'
88
__license__ = 'Apache 2.0'
9-
__version__ = '2024-11-13' # ISO 8601 (YYYY-MM-DD)
10-
__package_version__ = '.'.join([str(int(i)) for i in __version__.split('-')]) # for pyproject.toml usage only
9+
__package_version__ = '2024.11.13' # for pyproject.toml usage only - needs to be ast.literal_eval() compatible
10+
__version__ = '-'.join('%02d' % int(part) for part in __package_version__.split('.')) # ISO 8601 (YYYY-MM-DD)
1111

1212
import abc
1313
import argparse

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=61.0", "pyasyncore; python_version >= '3.12'", "cryptography"] # core requirements are needed for version detection when building for PyPI, which requires importing (but not running) the script on `ubuntu-latest`
2+
requires = ["setuptools>=62.6.0"]
33
build-backend = "setuptools.build_meta"
44

55
[project]

0 commit comments

Comments
 (0)