Skip to content

Commit

Permalink
Add check for prefect-client version in prefect-client workflow (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
desertaxle authored Oct 9, 2024
1 parent 3fadd7f commit 95c6276
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/markdown-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
- name: Start server
run: |
prefect server start&
PREFECT_HOME=$(pwd) prefect server start&
PREFECT_API_URL="http://127.0.0.1:4200/api" ./scripts/wait-for-server.py
- name: Run tests
Expand Down
23 changes: 21 additions & 2 deletions .github/workflows/prefect-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- requirements.txt
- requirements-client.txt
- setup.cfg
- .github/workflows/prefect-client.yaml
push:
branches:
- main
Expand All @@ -19,6 +20,7 @@ on:
- requirements.txt
- requirements-client.txt
- setup.cfg
- .github/workflows/prefect-client.yaml
workflow_call:
inputs:
upload-artifacts:
Expand Down Expand Up @@ -64,6 +66,13 @@ jobs:
run: pip install dist/*.tar.gz
working-directory: ${{ env.TMPDIR }}

- name: Get the version of built `prefect-client`
run: |
prefect_client_version=$(python -c "import prefect; print(prefect.__version__)")
echo "prefect_client_version=$prefect_client_version" >> $GITHUB_OUTPUT
working-directory: ${{ env.TMPDIR }}
id: prefect_client_version

- name: Run the smoke test flow using the built client
run: python client/client_flow.py
working-directory: ${{ env.TMPDIR }}
Expand All @@ -74,8 +83,18 @@ jobs:
- name: Install prefect from source
run: pip install .

- name: (DEBUG) Check that prefect and prefect-client are installed
run: pip list | grep prefect
- name: Get the version of built `prefect`
run: |
prefect_version=$(prefect --version)
echo "prefect_version=$prefect_version" >> $GITHUB_OUTPUT
id: prefect_version

- name: Verify that the built `prefect` and `prefect-client` versions are the same
run: |
if [ "${{ steps.prefect_version.outputs.prefect_version }}" != "${{ steps.prefect_client_version.outputs.prefect_client_version }}" ]; then
echo "The built versions of prefect and prefect-client are not the same."
exit 1
fi
- name: Run the smoke test flow again with prefect and prefect-client installed
run: python client/client_flow.py
Expand Down
7 changes: 2 additions & 5 deletions client/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

install_requires = open("requirements-client.txt").read().strip().split("\n")

# grab and use the first three version digits (the generated tag)
_version = versioneer.get_version().split(".")
client_version = ".".join(_version[:3]).split("+")[0]

setup(
# Package metadata
name="prefect-client",
Expand All @@ -23,7 +19,8 @@
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
# Versioning
version=client_version,
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
# Package setup
packages=find_packages(where="src"),
package_dir={"": "src"},
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ ignore_missing_imports = True

[versioneer]
VCS = git
style = pep440
style = pep440-pre
versionfile_source = src/prefect/_version.py
versionfile_build = prefect/_version.py
version_regex = ^(\d+\.\d+\.\d+(?:[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*)?)$
Expand Down
2 changes: 1 addition & 1 deletion src/prefect/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def get_config() -> VersioneerConfig:
# _version.py
cfg = VersioneerConfig()
cfg.VCS = "git"
cfg.style = "pep440"
cfg.style = "pep440-pre"
cfg.tag_prefix = ""
cfg.parentdir_prefix = ""
cfg.versionfile_source = "src/prefect/_version.py"
Expand Down
5 changes: 3 additions & 2 deletions src/prefect/utilities/dockerutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from urllib.parse import urlsplit

import pendulum
from packaging.version import Version
from typing_extensions import Self

import prefect
Expand Down Expand Up @@ -55,8 +56,8 @@ def get_prefect_image_name(
minor level e.g. '3.9'.
flavor: An optional alternative image flavor to build, like 'conda'
"""
parsed_version = (prefect_version or prefect.__version__).split("+")
is_prod_build = len(parsed_version) == 1
parsed_version = Version(prefect_version or prefect.__version__)
is_prod_build = parsed_version.post is None
prefect_version = (
parsed_version[0]
if is_prod_build
Expand Down

0 comments on commit 95c6276

Please sign in to comment.