Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better "study repo" init and upgrade paths #327

Closed
sebbacon opened this issue Oct 21, 2020 · 1 comment
Closed

Better "study repo" init and upgrade paths #327

sebbacon opened this issue Oct 21, 2020 · 1 comment

Comments

@sebbacon
Copy link
Contributor

What I want:

  • A new user types opensafely init to create a new, empty study repo
  • An existing user types opensafely upgrade to upgrade an existing study repo to support a new version

The former is easy and close to what we already do; we should probably use cookiecutter to do it. The latter is harder. What does "upgrade" mean? I think it's two major food groups:

  1. Introducing a new version of cohortextractor that has breaking changes, for example:
  • Changes in study definition function signatures
  • The new requirement that a project.yaml must exist
  1. Introducing new working practices, for example:
  • Every repo must have a LICENSE.txt
  • CI via GHA changes (e.g. using Releases more consistently)

In the case of (1), we need to be able to pin versions of (i) the project.yaml format and (ii) the study definition API. Currently these are versioned with separate version numbers. We could version them with the same token. This has the advantage of simplicity (e.g. all the documentation can be versioned to the same token). I can't think of a disadvantage to this, in fact...

Then, when someone runs opensafely upgrade, this means:

  • Fetching the most recent version number
  • If it's a minor version change, update the version number in project.yaml and pip install the latest cohortextractor package. Probably also start to make use of deprecation warnings, and print those
  • If it's a major version change, print a list of breaking changes and prompt the user to confirm if they want to complete the upgrade

For (2), the upgrade script should just have a set of changes that should be applied somehow. Perhaps it's a migrations/ folder in the cohortextractor repo which contains files named for version number 1_3_7_add_license_txt.py which are executed in order from the source to the destination version?

Are there existing packages which make this kind of thing easier? It feels like it should be trivial enough not to worry about that, but maybe I've not thought it through carefully enough

@sebbacon
Copy link
Contributor Author

Closed for related issue in opensafely-cli repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant