From 7607712b342d191faa46f8258e3ec2cc4cedc2bd Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Mon, 14 Oct 2024 11:54:00 -0400 Subject: [PATCH 1/4] explicitly install and run dunamai within environment to retrieve version --- .github/workflows/build.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 39515b10f..52f8cce1a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,12 +40,10 @@ jobs: conda init-shell: none generate-run-shell: true + - id: version + run: echo version=$(dunamai from any --strict --pattern "default-unprefixed" --style semver) >> $GITHUB_OUTPUT - run: pip install . - run: pip list - - id: version - uses: mtkennerly/dunamai-action@v1 - with: - args: --strict --pattern "default-unprefixed" --style semver - 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 }} From e930d84eaf89c04f334b512e164d5da57c189012 Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Mon, 14 Oct 2024 11:59:23 -0400 Subject: [PATCH 2/4] attempt to install / remove dunamai with micromamba --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 52f8cce1a..b2ce03d9b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,7 +41,11 @@ jobs: init-shell: none generate-run-shell: true - id: version - run: echo version=$(dunamai from any --strict --pattern "default-unprefixed" --style semver) >> $GITHUB_OUTPUT + name: retrieve package version with dunamai + run: | + micromamba install -y dunamai + echo version=$(dunamai from any --strict --pattern "default-unprefixed" --style semver) >> $GITHUB_OUTPUT + micromamba remove -y dunamai - run: pip install . - run: pip list - id: filename From b0ac819b9a25c552990f349cb90551509477e9ea Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Mon, 14 Oct 2024 12:06:19 -0400 Subject: [PATCH 3/4] just use __version__ --- .github/workflows/build.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b2ce03d9b..d6fe8f42b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,14 +40,11 @@ jobs: conda init-shell: none generate-run-shell: true - - id: version - name: retrieve package version with dunamai - run: | - micromamba install -y dunamai - echo version=$(dunamai from any --strict --pattern "default-unprefixed" --style semver) >> $GITHUB_OUTPUT - micromamba remove -y dunamai - run: pip install . - run: pip list + - id: version + name: retrieve package version + run: echo version=$(python -c "import jwql; print(jwql.__version__)") >> $GITHUB_OUTPUT - 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 }} From a21a01f177235a8a9dc768544c8b27b2f3f7acdc Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Mon, 14 Oct 2024 12:10:36 -0400 Subject: [PATCH 4/4] use warning instead --- jwql/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jwql/__init__.py b/jwql/__init__.py index d1949b6ee..630d20207 100644 --- a/jwql/__init__.py +++ b/jwql/__init__.py @@ -1,4 +1,6 @@ +import warnings from importlib.metadata import version + from jwql.utils import utils __version__ = version('jwql') @@ -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')