Skip to content

Commit ac949e9

Browse files
committed
clean up pyproject handling
1 parent 8225690 commit ac949e9

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

jupyter_releaser/tests/util.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,6 @@ def setup_cfg_template(package_name="foo", module_name=None):
6262
[metadata]
6363
name = {package_name}
6464
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-
author_email = [email protected]
71-
url = https://foo.com
7265
7366
[options]
7467
zip_safe = False
@@ -80,14 +73,26 @@ def setup_cfg_template(package_name="foo", module_name=None):
8073
SETUP_PY_TEMPLATE = """__import__("setuptools").setup()\n"""
8174

8275

83-
def pyproject_template(sub_packages=[]):
84-
res = """
76+
def pyproject_template(project_name="foo", sub_packages=[]):
77+
res = f"""
8578
[build-system]
86-
requires = ["setuptools>=40.8.0", "wheel"]
79+
requires = ["setuptools>=61.0.0", "wheel"]
8780
build-backend = "setuptools.build_meta"
8881
8982
[project]
83+
name = "{project_name}"
9084
version = "0.0.1"
85+
description = "My package description"
86+
readme = "README.md"
87+
license = {{file = "LICENSE"}}
88+
authors = [
89+
{{email = "[email protected]"}},
90+
{{name = "foo"}}
91+
]
92+
93+
[project.urls]
94+
homepage = "https://foo.com"
95+
9196
"""
9297
if sub_packages:
9398
res += f"""
@@ -134,6 +139,7 @@ def tbump_py_template(package_name="foo"):
134139
include *.md
135140
include *.toml
136141
include *.yaml
142+
include LICENSE
137143
"""
138144

139145
CHANGELOG_TEMPLATE = f"""# Changelog
@@ -208,14 +214,19 @@ def write_files(git_repo, sub_packages=[], package_name="foo", module_name=None)
208214
)
209215

210216
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+
)
212220

213221
foopy = git_repo / f"{module_name}.py"
214222
foopy.write_text(PY_MODULE_TEMPLATE, encoding="utf-8")
215223

216224
manifest = git_repo / "MANIFEST.in"
217225
manifest.write_text(MANIFEST_TEMPLATE, encoding="utf-8")
218226

227+
license = git_repo / "LICENSE"
228+
license.touch()
229+
219230
here = Path(__file__).parent
220231
text = here.parent.parent.joinpath(".pre-commit-config.yaml").read_text(
221232
encoding="utf-8"

0 commit comments

Comments
 (0)