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

Study version display #289

Merged
merged 7 commits into from
Aug 28, 2024
Merged

Study version display #289

merged 7 commits into from
Aug 28, 2024

Conversation

dogversioning
Copy link
Contributor

@dogversioning dogversioning commented Aug 28, 2024

This PR adds the --study-version arg, for reading the version of a given study from it's init.py. #243

Also updated the docs to make this new init.py requirement to the study authoring docs.

Checklist

  • Consider if documentation in docs/ needs to be updated
    • If you've changed the structure of a table, you may need to run generate-md
    • If you've added/removed core study fields that not in US Core, update our list of those in core-study-details.md
  • Consider if tests should be added
  • Update template repo if there are changes to study configuration in manifest.toml

Copy link

github-actions bot commented Aug 28, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
2035 2022 99% 90% 🟢

New Files

File Coverage Status
cumulus_library/studies/core/init.py 100% 🟢
cumulus_library/studies/discovery/init.py 100% 🟢
cumulus_library/studies/vocab/init.py 100% 🟢
TOTAL 100% 🟢

Modified Files

File Coverage Status
cumulus_library/cli.py 100% 🟢
cumulus_library/cli_parser.py 100% 🟢
TOTAL 100% 🟢

updated for commit: 9746760 by action🐍

Comment on lines 402 to 406
if target in ("core", "discovery", "vocab"):
print(
f"{target} distributed with Cumulus library.\n"
f"Cumulus library: {__version__}"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little leery of this special logic here. The user can point at a different / in-development version of these built-in studies with -s, where this may not give the right version. And vocab is slated for movement - so depending on how that goes down, old versions of library may not give the correct version after the move, especially if -s is involved again.

I understand you're doing that so that you don't have to keep track of versions inside core/discovery/vocab. But also... maybe we should? Like, discovery has its own semantic version lifecycle separate from core, which in theory lives a different versioning life from the outer library study runner (though in practice, those two are often closely entwined).

Anyway, just a nit comment, this is fine for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i could make an argument for moving discovery to its own repo, and removing vocab, which would make this repo just the infrastructure and the core study).

I could :also: make an argument for moving the core study to its own repo, though it complicates the installation story a bit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I wasn't even talking about repos - just a version in their __init__.py files

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the separate-version approach also matters less if we do a "all versions printed" approach from below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was sort of a side thought - i'm doing the all versions thing below for now, i guess i'm going to pin core to a v3 since it's mostly tied to the core infra and discovery to 1.0, but i could see a decoupling case generally? not taking action on it atm.

@@ -297,4 +297,10 @@ def get_parser() -> argparse.ArgumentParser:
add_target_argument(markdown)
add_verbose_argument(markdown)

# Get study version

study_version = actions.add_parser("study-version", help="Gets the version of a specific study")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine. But I would vote for a single command that shows all known versions it can find. Like... if --version (and/or a version or debug subcommand) gave output like:

$ cumulus-library --version
Cumulus Library: 3.0.0
Python: 3.11.1
Studies:
  covid_symptom: 2.1.0
  ...etc...
  umls: 1.2.0

Since we register known studies in the Library, we can just iterate over that (plus any extra targets). You could throw in paths to the study modules if you wanted there too.

In my mind, this has some advantages:

  • Easier to tell a user how to do it: "run --version" vs "run study-version -t covid_symptom -t core"
  • Less error prone for the user
    • harder to forget a -t core or similar argument that we'd want to see, everything is built-in
    • or a situation where they run a study-version -t covid_symptom line they saved from us a week ago instead of the new study-version -t umls command we just gave them.
  • Easier to add future useful bits, like the version of some major dependency like Jinja or whatever.

But this approach works too - I'm just brainstorming.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i buy this (as long as I alpha sort the keys for lookup)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, this is now the behavior.

tests/test_cli.py Outdated Show resolved Hide resolved
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While doing this versioning init pass - I'm pulling this since we're no longer doing cli template creation.

@@ -297,4 +297,10 @@ def get_parser() -> argparse.ArgumentParser:
add_target_argument(markdown)
add_verbose_argument(markdown)

# Get study version

study_version = actions.add_parser("study-version", help="Gets the version of a specific study")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, this is now the behavior.

@dogversioning dogversioning merged commit fdae03e into main Aug 28, 2024
3 checks passed
@dogversioning dogversioning deleted the mg/study_version branch August 28, 2024 18:38
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

Successfully merging this pull request may close these issues.

2 participants