@@ -62,13 +62,6 @@ def setup_cfg_template(package_name="foo", module_name=None):
62
62
[metadata]
63
63
name = { package_name }
64
64
version = attr: { module_name or package_name } .__version__
65
- description = My package description
66
- long_description = file: README.md
67
- long_description_content_type = text/markdown
68
- license = BSD 3-Clause License
69
- author = foo
70
-
71
- url = https://foo.com
72
65
73
66
[options]
74
67
zip_safe = False
@@ -80,14 +73,26 @@ def setup_cfg_template(package_name="foo", module_name=None):
80
73
SETUP_PY_TEMPLATE = """__import__("setuptools").setup()\n """
81
74
82
75
83
- def pyproject_template (sub_packages = []):
84
- res = """
76
+ def pyproject_template (project_name = "foo" , sub_packages = []):
77
+ res = f """
85
78
[build-system]
86
- requires = ["setuptools>=40.8 .0", "wheel"]
79
+ requires = ["setuptools>=61.0 .0", "wheel"]
87
80
build-backend = "setuptools.build_meta"
88
81
89
82
[project]
83
+ name = "{ project_name } "
90
84
version = "0.0.1"
85
+ description = "My package description"
86
+ readme = "README.md"
87
+ license = {{file = "LICENSE"}}
88
+ authors = [
89
+
90
+ {{name = "foo"}}
91
+ ]
92
+
93
+ [project.urls]
94
+ homepage = "https://foo.com"
95
+
91
96
"""
92
97
if sub_packages :
93
98
res += f"""
@@ -134,6 +139,7 @@ def tbump_py_template(package_name="foo"):
134
139
include *.md
135
140
include *.toml
136
141
include *.yaml
142
+ include LICENSE
137
143
"""
138
144
139
145
CHANGELOG_TEMPLATE = f"""# Changelog
@@ -208,14 +214,19 @@ def write_files(git_repo, sub_packages=[], package_name="foo", module_name=None)
208
214
)
209
215
210
216
pyproject = git_repo / "pyproject.toml"
211
- pyproject .write_text (pyproject_template (sub_packages ), encoding = "utf-8" )
217
+ pyproject .write_text (
218
+ pyproject_template (module_name , sub_packages ), encoding = "utf-8"
219
+ )
212
220
213
221
foopy = git_repo / f"{ module_name } .py"
214
222
foopy .write_text (PY_MODULE_TEMPLATE , encoding = "utf-8" )
215
223
216
224
manifest = git_repo / "MANIFEST.in"
217
225
manifest .write_text (MANIFEST_TEMPLATE , encoding = "utf-8" )
218
226
227
+ license = git_repo / "LICENSE"
228
+ license .touch ()
229
+
219
230
here = Path (__file__ ).parent
220
231
text = here .parent .parent .joinpath (".pre-commit-config.yaml" ).read_text (
221
232
encoding = "utf-8"
0 commit comments