Skip to content

Commit fafcf7f

Browse files
authored
Add command line scripts to the template (#611)
* Add command line scripts to the template * Update {{package_name}}_version.py.jinja * Update {{package_name}}_version.py.jinja
1 parent cd59f4f commit fafcf7f

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

‎python-project-template/pyproject.toml.jinja‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ dev = [
5757
{%- endif %}
5858
]
5959

60+
{%- if contains_code %}
61+
# Command-line scripts that can be run after installing the package
62+
[project.scripts]
63+
{{package_name}}_version = "{{package_name}}_cli.{{package_name}}_version:main"
64+
{%- endif %}
65+
6066
[build-system]
6167
requires = [
6268
"setuptools>=62", # Used to build and package the Python project

‎python-project-template/{% if contains_code %}src{% endif %}/{{package_name}}_cli/__init__.py‎

Whitespace-only changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""Display basic version information to standard out."""
2+
3+
from {{package_name}}._version import __version__
4+
5+
6+
def main():
7+
"""The main function for the example file."""
8+
print(f"{{package_name}}: {__version__}")
9+
10+
11+
if __name__ == "__main__":
12+
main()

0 commit comments

Comments
 (0)