@@ -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
@@ -79,15 +72,30 @@ def setup_cfg_template(package_name="foo", module_name=None):
79
72
80
73
SETUP_PY_TEMPLATE = """__import__("setuptools").setup()\n """
81
74
75
+ LICENSE_TEMPLATE = "A fake license\n "
82
76
83
- def pyproject_template (sub_packages = []):
84
- res = """
77
+ README_TEMPLATE = "A fake readme\n "
78
+
79
+
80
+ def pyproject_template (project_name = "foo" , sub_packages = []):
81
+ res = f"""
85
82
[build-system]
86
- requires = ["setuptools>=40.8 .0", "wheel"]
83
+ requires = ["setuptools>=61.0 .0", "wheel"]
87
84
build-backend = "setuptools.build_meta"
88
85
89
86
[project]
87
+ name = "{ project_name } "
90
88
version = "0.0.1"
89
+ description = "My package description"
90
+ readme = "README.md"
91
+ license = {{file = "LICENSE"}}
92
+ authors = [
93
+
94
+ {{name = "foo"}}
95
+ ]
96
+
97
+ [project.urls]
98
+ homepage = "https://foo.com"
91
99
"""
92
100
if sub_packages :
93
101
res += f"""
@@ -118,6 +126,9 @@ def tbump_py_template(package_name="foo"):
118
126
return f"""
119
127
[[file]]
120
128
src = "{ package_name } .py"
129
+
130
+ [[file]]
131
+ src = "pyproject.toml"
121
132
"""
122
133
123
134
@@ -131,6 +142,7 @@ def tbump_py_template(package_name="foo"):
131
142
include *.md
132
143
include *.toml
133
144
include *.yaml
145
+ include LICENSE
134
146
"""
135
147
136
148
CHANGELOG_TEMPLATE = f"""# Changelog
@@ -205,19 +217,27 @@ def write_files(git_repo, sub_packages=[], package_name="foo", module_name=None)
205
217
)
206
218
207
219
pyproject = git_repo / "pyproject.toml"
208
- pyproject .write_text (pyproject_template (sub_packages ), encoding = "utf-8" )
220
+ pyproject .write_text (
221
+ pyproject_template (package_name , sub_packages ), encoding = "utf-8"
222
+ )
209
223
210
224
foopy = git_repo / f"{ module_name } .py"
211
225
foopy .write_text (PY_MODULE_TEMPLATE , encoding = "utf-8" )
212
226
213
227
manifest = git_repo / "MANIFEST.in"
214
228
manifest .write_text (MANIFEST_TEMPLATE , encoding = "utf-8" )
215
229
230
+ license = git_repo / "LICENSE"
231
+ license .write_text (LICENSE_TEMPLATE , encoding = "utf-8" )
232
+
216
233
here = Path (__file__ ).parent
217
234
text = here .parent .parent .joinpath (".pre-commit-config.yaml" ).read_text (
218
235
encoding = "utf-8"
219
236
)
220
237
238
+ readme = git_repo / "README.md"
239
+ readme .write_text (README_TEMPLATE , encoding = "utf-8" )
240
+
221
241
pre_commit = git_repo / ".pre-commit-config.yaml"
222
242
pre_commit .write_text (text , encoding = "utf-8" )
223
243
0 commit comments