Skip to content

Commit 04e4665

Browse files
authored
Use importlib.metadata instead of hardcoding in the version, author and license (#18)
1 parent 7e3ac99 commit 04e4665

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • {{cookiecutter.repository_name}}/src/{{cookiecutter.module_name}}
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
"""Top-level package for {{ cookiecutter.project_name }}."""
2+
from importlib.metadata import metadata
23

3-
__author__ = """{{ cookiecutter.full_name }}"""
4-
__email__ = '{{ cookiecutter.email }}'
5-
__version__ = '{{ cookiecutter.version }}'
4+
meta = metadata("{{cookiecutter.module_name}}")
5+
__version__ = meta["Version"]
6+
__author__ = meta["Author"]
7+
__license__ = meta["License"]
8+
__email__ = meta["Author-email"]
9+
__program_name__ = meta["Name"]

0 commit comments

Comments
 (0)