cjolowicz / cookiecutter-hypermodern-python

Hypermodern Python Cookiecutter
http://cookiecutter-hypermodern-python.readthedocs.io/
MIT License
1.82k stars 235 forks source link

Add Nox session for upgrading the Cookiecutter template #254

Open cjolowicz opened 4 years ago

cjolowicz commented 4 years ago

Update: I'm no longer planning to use cupper for this.

Something like this:

@nox.session(python="3.8")
def cupper(session: Session) -> None:
    """Upgrade the Cookiecutter template with cupper."""
    install(session, "cupper")
    session.run("cupper", ".cookiecutter.json", "cookiecutter")

We should contribute a --checkout option to cupper, to avoid upgrading to master always. (And then pull in latest from GitHub Releases.)

Another question is should the Nox session attempt to create a PR or feature branch? This is may be better left to documentation.

cjolowicz commented 4 years ago
git switch --create cookiecutter-merge
git merge cookiecutter
git push origin cookiecutter-merge

For poetry.lock it's best reset to ours and then updated using poetry add insecure-package && poetry remove insecure-package.

cjolowicz commented 4 years ago

If we want to get fancy with this, it may get tricky to do it in cupper and noxfile alone. So there's this crazy idea: Go ahead with some form of #208 and depend on it in the project. We could then provide all kinds of services to projects, without dumping the code into them, and with a clean dependency and versioning...