2626REPO_ROOT : Path = Path (__file__ ).parent
2727CRATES_FOLDER : Path = REPO_ROOT / "rust"
2828PACKAGE_NAME : str = "{{cookiecutter.package_name}}"
29+ GITHUB_USER : str = "{{cookiecutter.github_user}}"
2930
3031
31- @nox .session (python = DEFAULT_PYTHON_VERSION , name = "setup-repo" )
32+ @nox .session (python = None , name = "setup-repo" )
3233def setup_repo (session : Session ) -> None :
3334 """Set up the repository for development.
3435
@@ -37,23 +38,36 @@ def setup_repo(session: Session) -> None:
3738 """
3839 session .log ("Installing development dependencies..." )
3940 session .notify ("setup-git" )
40- session .notify ("setup-branches" )
41- session .install ("-e" , "." , "--group" , "dev" )
41+ session .notify ("setup-venv" )
4242
4343
44- @nox .session (python = DEFAULT_PYTHON_VERSION , name = "setup-git" )
44+ @nox .session (python = None , name = "setup-git" )
4545def setup_git (session : Session ) -> None :
4646 """Set up the git repo for the current project."""
4747 session .run ("git" , "init" )
4848 session .run ("git" , "branch" , "-M" , "main" )
49+
50+ session .run (
51+ "git" , "remote" , "add" , "origin" , f"https://github.com/{ GITHUB_USER } /{ PACKAGE_NAME } .git" , "||" , "true"
52+ )
53+ session .run ("git" , "remote" , "set-url" , "origin" , f"https://github.com/{ GITHUB_USER } /{ PACKAGE_NAME } .git" )
54+ session .run ("git" , "fetch" , "origin" )
55+
56+ session .run ("git" , "push" , "-u" , "origin" , "main" )
57+ session .run ("git" , "checkout" , "-b" , "develop" , "main" )
58+ session .run ("git" , "push" , "-u" , "origin" , "develop" )
59+
4960 session .run ("git" , "add" , "." )
5061 session .run ("git" , "commit" , "-m" , "feat: initial commit" )
62+ session .run ("git" , "push" , "origin" , "develop" )
5163
5264
53- @nox .session (python = DEFAULT_PYTHON_VERSION , name = "setup-branches" )
54- def setup_branches (session : Session ) -> None :
55- """Set up the git repo for the current project."""
56- session .run ("git" , "checkout" , "-b" , "develop" , "main" )
65+ @nox .session (python = None , name = "setup-venv" )
66+ def setup_venv (session : Session ) -> None :
67+ session .run ("uv" , "venv" , ".venv" , external = True )
68+ session .run ("uv" , "python" , "install" , PYTHON_VERSIONS [0 ], external = True )
69+ session .run ("uv" , "python" , "pin" , PYTHON_VERSIONS [0 ], external = True )
70+ session .run ("uv" , "sync" , "--all-groups" , external = True )
5771
5872
5973@nox .session (python = DEFAULT_PYTHON_VERSION , name = "pre-commit" )
0 commit comments