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

retrieve version from package #1648

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ jobs:
- run: pip install .
- run: pip list
- id: version
uses: mtkennerly/dunamai-action@v1
with:
args: --strict --pattern "default-unprefixed" --style semver
name: retrieve package version
run: echo version=$(python -c "import jwql; print(jwql.__version__)") >> $GITHUB_OUTPUT
Comment on lines +46 to +47
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we don't even have to use dunamai here, we can just use the pre-populated __version__

- id: filename
run: echo "filename=jwql_${{ steps.version.outputs.version }}_conda_${{ runner.os }}_${{ runner.arch }}_py${{ matrix.python-version }}.yml" >> $GITHUB_OUTPUT
- run: conda env export --no-build | grep -v "name:" | grep -v "prefix:" > ${{ steps.filename.outputs.filename }}
Expand Down
4 changes: 3 additions & 1 deletion jwql/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import warnings
from importlib.metadata import version

from jwql.utils import utils

__version__ = version('jwql')
Expand All @@ -10,4 +12,4 @@
f"while JWQL is using {__version__}")

except FileNotFoundError:
print('Could not determine jwql config version')
warnings.warn('Could not determine jwql config version')
Copy link
Collaborator Author

@zacharyburnett zacharyburnett Oct 14, 2024

Choose a reason for hiding this comment

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

when this was print(, it was polluting the output of import jwql; print(jwql.__version__) in the workflow

Loading