Skip to content

Commit

Permalink
NASA-AMMOS/slim#46: Move required versioning tooling into its own imp…
Browse files Browse the repository at this point in the history
…ort for ease of reuse. ...
  • Loading branch information
jpl-jengelke committed Jan 4, 2023
1 parent 372ca4d commit f45ade4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ A [GitHub Action](.github/workflows/python-publish.yml) configuration specifies
<!-- ☝️ If necessary, update with a numbered list of your build instructions, including expected results / outputs with optional screenshots ☝️ -->

#### Manual Build
These instructions must be entered from the local directory checked out from source control.
1. Manually update `[INSERT YOUR PACKAGE NAME]/version.py` with the next release version, commit and push to the `main` branch:
```
git add [INSERT YOUR PACKAGE NAME]/version.py && git commit -m "Issue #<issue_number>: Updated version for release." && git push
Expand Down Expand Up @@ -141,6 +142,7 @@ twine check dist/* && twine upload --verbose dist/*.whl dist/*.zip
<!-- ☝️ Replace with a numbered list of your test instructions, including expected results / outputs with optional screenshots ☝️ -->

#### Local Build Testing
These instructions must be entered from the local directory checked out from source control.
A simplified build and release workflow is available for testing locally. Publishing directly to PyPi is not recommended as PyPi permits one upload per release version.

1. Clean application:
Expand Down
10 changes: 1 addition & 9 deletions slim_sample_project/hello_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@
import sys

from api.text_processor import TextWriter
import importlib_metadata as metadata
import slim_sample_project.version as v

try:
version = metadata.version(__name__)
except metadata.PackageNotFoundError:
# package is not installed, try reading from slim_sample_project script
version = v.__version__ if v.__version__ else "unset"
pass
from version_tooling import version


def main():
Expand Down
9 changes: 9 additions & 0 deletions slim_sample_project/version_tooling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import importlib_metadata as metadata
import version as v

try:
version = metadata.version(__name__)
except metadata.PackageNotFoundError:
# package is not installed, try reading from slim_sample_project script
version = v.__version__ if v.__version__ else "unset"
pass

0 comments on commit f45ade4

Please sign in to comment.