mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-23 15:19:33 +00:00
Autopopulate module name in cli init (#12814)
This commit is contained in:
parent
98aff29fbd
commit
0da75b9ebd
@ -67,6 +67,11 @@ def new(
|
|||||||
package_dir = destination_dir / module_name
|
package_dir = destination_dir / module_name
|
||||||
shutil.move(destination_dir / "package_template", package_dir)
|
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
|
# replace readme
|
||||||
readme = destination_dir / "README.md"
|
readme = destination_dir / "README.md"
|
||||||
readme_contents = readme.read_text()
|
readme_contents = readme.read_text()
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
from chain import chain
|
from __module_name__.chain import chain
|
||||||
|
|
||||||
__all__ = ["chain"]
|
__all__ = ["chain"]
|
||||||
|
Loading…
Reference in New Issue
Block a user