Skip to content

Commit

Permalink
Improved create_environment script file; automatic call to 'build.py'…
Browse files Browse the repository at this point in the history
… if not already present; with instructions at the end to make getting up to speed easier.
  • Loading branch information
dotchetter committed Sep 23, 2023
1 parent 8df9297 commit 32aa663
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions devtools/create_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
from time import sleep

sys.path.append(Path.cwd().parent.as_posix())
os.chdir("..")

if not Path("setup.py").exists():
print("You're not in the right directory. Run this script from the "
r"project's root directory, e.g. 'C:\users\your_user\projects\pyttman'.")
exit(-1)

LAB_ENV_PATH = Path.cwd() / Path("dev_env")
BUILD_OUTPUT_PATH = Path.cwd() / "dist"
Expand All @@ -17,10 +21,7 @@
shutil.rmtree((LAB_ENV_PATH / "venv").as_posix())

if not Path("dist").exists():
print("\nCannot create local testing environment as there is no "
"build generated for the current local version of Pyttman.",
"Run 'build.py' to create one.")
exit(-1)
subprocess.check_call("python devtools/build.py".split())

LAB_ENV_PATH.mkdir(exist_ok=True)
os.chdir(LAB_ENV_PATH.as_posix())
Expand All @@ -39,5 +40,16 @@
subprocess.run(f"{venv_python} -m pip install multidict".split())
subprocess.run(f"{venv_python} -m pip install {package_file}".split())

print("\nFinished! You can now create an app and start testing in "
f"{LAB_ENV_PATH.as_posix()}.")
clear_sc = "clear" if os.name == "posix" else "cls"
os.system(clear_sc)

os.system("cls")
print("\nFinished! Here's how to get started:",
f"1. Activate the virtual environment:\n\tcd dev_env\n\tvenv/scripts/activate",
f"2. Run the command 'pyttman' to see available commands to the Pyttman CLI",
"3. If it's the first time you're running Pyttman, run 'pyttman new app {app_name}' to create a new project."
"4. Run 'pyttman dev {app_name}' to start the development server.",
"5. If you've made changes to the Pyttman framework which you want to test in your testing project, "
"run this script again. Your app will be left untouched, but the Pyttman version is upgraded to "
"your current HEAD in the Pyttman repo.",
sep="\n")

0 comments on commit 32aa663

Please sign in to comment.