Autopopulate module name in cli init (#12814)

This commit is contained in:
Erick Friis
2023-11-02 23:45:38 -07:00
committed by GitHub
parent 98aff29fbd
commit 0da75b9ebd
2 changed files with 6 additions and 1 deletions

View File

@@ -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()