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

Manifest JSON Writing Utility #486

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

TimothyWillard
Copy link
Contributor

Describe your changes.

This pull request adds:

  1. Internal utilities _shutil_which and _git_head, and
  2. write_manifest to the new batch module for writing manifest JSON files containing batch metadata.

Does this pull request make any user interface changes? If so please describe.

The user interface changes are none, this is all new functionality. Code level documentation (which is the main usage of this functionality) has been added to the docstrings.

What does your pull request address? Tag relevant issues.

This pull request was spun out of GH-394 to help address GH-365.

Added private helper `gempyor.utils._shutil_which` which has a `check`
argument that behaves very similar in spirit to the same argument of
`subprocess.run`. Corresponding docs/tests included.
Added an internal utility function to get the sha commit corresponding
to the head of a given git repository. For use in creating manifest
files.
Added `gempyor.manifest.write_manifest` for writing batch manifest JSON
files containing metadata about the run. Also has extended functionality
to store more metadata then the current required.
Move the `manifest` submodule to `batch` to consolidate future
functionality. Minor edits to unit tests to account for the module name
change.
@TimothyWillard TimothyWillard added enhancement Request for improvement or addition of new feature(s). gempyor Concerns the Python core. batch Relating to batch processing. high priority High priority. quick issue Short or easy fix. next release Marks a PR as a target to include in the next release. labels Jan 24, 2025
Examples:
>>> from pathlib import Path
>>> flepi_path = Path("~/Desktop/GitHub/HopkinsIDD/flepiMoP").expanduser()
>>> project_path = Path("~/Desktop/GitHub/HopkinsIDD/flepimop_sample").expanduser()
Copy link
Collaborator

Choose a reason for hiding this comment

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

We are trying to move away from flepimop_sample, in favor of using the examples/tutorials folder in flepiMoP. Perhaps this line could read:
project_path = Path("~/Desktop/GitHub/HopkinsIDD/flepiMoP/examples/tutorials").expanduser()

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, should we all-caps FLEPI_PATH and PROJECT_PATH, if they are constants throughout the entirety of flepiMoP execution?


def _git_head(repository: Path) -> str:
"""
Get the sha commit has for the head of a git repository.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this suppposed to read "Get the sha commit hash for the ...."?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
batch Relating to batch processing. enhancement Request for improvement or addition of new feature(s). gempyor Concerns the Python core. high priority High priority. next release Marks a PR as a target to include in the next release. quick issue Short or easy fix.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants