Autopopulate module name in cli init (#12814)

pull/12827/head
Erick Friis 11 months ago committed by GitHub
parent 98aff29fbd
commit 0da75b9ebd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -67,6 +67,11 @@ def new(
package_dir = destination_dir / module_name
shutil.move(destination_dir / "package_template", package_dir)
# update init
init = package_dir / "__init__.py"
init_contents = init.read_text()
init.write_text(init_contents.replace("__module_name__", module_name))
# replace readme
readme = destination_dir / "README.md"
readme_contents = readme.read_text()

@ -1,3 +1,3 @@
from chain import chain
from __module_name__.chain import chain
__all__ = ["chain"]

Loading…
Cancel
Save