jgt_tools package¶
Package for common jgt commands.
Subpackages¶
Submodules¶
jgt_tools.check_version module¶
Ensure version bump.
- jgt_tools.check_version.check_default_branch(default_branch)[source]¶
Get changed files and pyproject.toml diff for a branch.
- jgt_tools.check_version.check_version()[source]¶
Verify the version is changed if any code files are changed.
jgt_tools.env_setup module¶
Setup the development environment.
- Runs the following commands:
poetry run pip install –upgrade pip poetry install poetry run pre-commit install
jgt_tools.run_tests module¶
Run all available tests.
- Runs the following commands:
poetry run python -m pytest -vvv
jgt_tools.self_check module¶
Script to make sure the repo is good enough for running tests, meets SDLC, etc.
Basically, antyhing you want to put here that will be part of your automated PR checking and whatever santiy checking you want for the CICD server to be confident that it can start a test run without any missing packages, syntax errors, etc.
We’re leaning in to using ‘pre-commit’ but this script can still be used to run or check things that aren’t a good fit for ‘pre-commit’.
- Runs the following commands:
poetry run pre-commit run -a
jgt_tools.utils module¶
Shared util functions.
- jgt_tools.utils.execute_command_list(commands_to_run, verbose=True)[source]¶
Execute each command in the list.
If any command fails, print a helpful message and exit with that status.
- jgt_tools.utils.get_pyproject_config()[source]¶
Get the config data from the project’s pyproject.toml file.
- jgt_tools.utils.owner_name_from(origin_url)[source]¶
Extract the owner name from a git origin URL.
The git origin URL might be in
git+ssh
form, orhttps
form.- Parameters:
origin_url (str) – Origin URL from git
- Returns:
A slash-separated string containing the organization / owner and repository
- Return type:
str
Examples
>>> owner_name_from("git@github.com:jolly-good-toolbelt/jgt_tools.git") "jolly-good-toolbelt/jgt_tools" >>> owner_name_from("https://github.com/jolly-good-toolbelt/jgt_tools.git") "jolly-good-toolbelt/jgt_tools"