diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 8a4e1a4..0130908 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -24,6 +24,12 @@ # Initialize git subprocess.run(["git", "init", "-b", "main"], check=True, shell=use_shell) + + # Install dependencies and generate uv.lock BEFORE committing + print("\nInstalling dependencies with uv...") + subprocess.run(["uv", "sync", "--all-extras", "--dev"], check=True, shell=use_shell) + + # Stage and commit all files (including the newly generated uv.lock) subprocess.run(["git", "add", "."], check=True, shell=use_shell) subprocess.run( ["git", "commit", "-m", "Initial commit from cookiecutter"], @@ -31,13 +37,9 @@ shell=use_shell, ) - # Install dependencies - print("\nInstalling dependencies with uv...") - subprocess.run(["uv", "sync", "--all-extras", "--dev"], check=True, shell=use_shell) - - print("\nSuccessfully initialized git repo and installed dependencies.") + print("\nSuccessfully initialized git repo, generated lockfile, and committed.") print("Your new project is ready at:", os.getcwd()) except Exception as e: print(f"\nAn error occurred during post-generation setup: {e}") - print("Please manually run 'git init' and 'uv sync --all-extras --dev'.") + print("Please manually run 'uv sync --all-extras --dev' and commit the results.") diff --git a/{{cookiecutter.project_slug}}/.gitignore b/{{cookiecutter.project_slug}}/.gitignore index 1507f65..ca8eaf3 100644 --- a/{{cookiecutter.project_slug}}/.gitignore +++ b/{{cookiecutter.project_slug}}/.gitignore @@ -141,5 +141,3 @@ cython_debug/ # Runtime Logs logs/ -# uv lockfile -uv.lock