From 2fd516478703516cd0c29d8472e416258c2b194b Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 09:29:31 -0500 Subject: [PATCH 01/18] Add check for `prefect-client` version in prefect-client workflow --- .github/workflows/prefect-client.yaml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prefect-client.yaml b/.github/workflows/prefect-client.yaml index fbeda01bd71f..59d23e01e5a0 100644 --- a/.github/workflows/prefect-client.yaml +++ b/.github/workflows/prefect-client.yaml @@ -64,6 +64,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_client; print(prefect_client.__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 }} @@ -74,8 +81,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 From 3b30f5dd4ed6417eb89eb4fd8b928eb8f0eb8116 Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 09:31:02 -0500 Subject: [PATCH 02/18] Run when workflow changes --- .github/workflows/prefect-client.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/prefect-client.yaml b/.github/workflows/prefect-client.yaml index 59d23e01e5a0..8b0a57bd9449 100644 --- a/.github/workflows/prefect-client.yaml +++ b/.github/workflows/prefect-client.yaml @@ -10,6 +10,7 @@ on: - requirements.txt - requirements-client.txt - setup.cfg + - .github/workflows/prefect-client.yaml push: branches: - main @@ -19,6 +20,7 @@ on: - requirements.txt - requirements-client.txt - setup.cfg + - .github/workflows/prefect-client.yaml workflow_call: inputs: upload-artifacts: From eac1b57a5d3592aa346b234e1937426d9b6d5591 Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 09:32:47 -0500 Subject: [PATCH 03/18] Fixes syntax --- .github/workflows/prefect-client.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prefect-client.yaml b/.github/workflows/prefect-client.yaml index 8b0a57bd9449..550f00096717 100644 --- a/.github/workflows/prefect-client.yaml +++ b/.github/workflows/prefect-client.yaml @@ -68,7 +68,7 @@ jobs: - name: Get the version of built `prefect-client` run: | - prefect_client_version=$(python -c "import prefect_client; print(prefect_client.__version__)") + 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 From 0b6f822fd7483c4736adf09ee18bf7af6f011c1f Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 09:55:05 -0500 Subject: [PATCH 04/18] Add debug step --- .github/workflows/prefect-client.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/prefect-client.yaml b/.github/workflows/prefect-client.yaml index 550f00096717..1a59eb710210 100644 --- a/.github/workflows/prefect-client.yaml +++ b/.github/workflows/prefect-client.yaml @@ -58,6 +58,10 @@ jobs: env: TMPDIR: ${{ env.TMPDIR }} + - name: (DEBUG) Print the contents of the TMPDIR + run: ls -la + working-directory: ${{ env.TMPDIR }} + - name: Build a binary wheel and a source tarball run: pip install wheel && python setup.py sdist bdist_wheel working-directory: ${{ env.TMPDIR }} From 97047a46ecf430f5140073e3205ca5ad748828be Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 10:05:08 -0500 Subject: [PATCH 05/18] Include cmdclass --- .github/workflows/prefect-client.yaml | 4 ++-- client/setup.py | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/prefect-client.yaml b/.github/workflows/prefect-client.yaml index 1a59eb710210..2aaee333fe97 100644 --- a/.github/workflows/prefect-client.yaml +++ b/.github/workflows/prefect-client.yaml @@ -58,8 +58,8 @@ jobs: env: TMPDIR: ${{ env.TMPDIR }} - - name: (DEBUG) Print the contents of the TMPDIR - run: ls -la + - name: (DEBUG) Print versioneer output + run: python -c "import versioneer; print(versioneer.get_version())" working-directory: ${{ env.TMPDIR }} - name: Build a binary wheel and a source tarball diff --git a/client/setup.py b/client/setup.py index 8a55783fe15d..9eb0ddebf7c4 100644 --- a/client/setup.py +++ b/client/setup.py @@ -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", @@ -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"}, From 51651c8d4a943499719d451d819edc6301f36f0c Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 10:26:08 -0500 Subject: [PATCH 06/18] Move some files around --- .github/workflows/prefect-client.yaml | 2 +- client/README.md => README-client.md | 0 client/build_client.sh | 4 +--- client/setup.py => setup_client.py | 0 4 files changed, 2 insertions(+), 4 deletions(-) rename client/README.md => README-client.md (100%) rename client/setup.py => setup_client.py (100%) diff --git a/.github/workflows/prefect-client.yaml b/.github/workflows/prefect-client.yaml index 2aaee333fe97..2876e19f3a34 100644 --- a/.github/workflows/prefect-client.yaml +++ b/.github/workflows/prefect-client.yaml @@ -63,7 +63,7 @@ jobs: working-directory: ${{ env.TMPDIR }} - name: Build a binary wheel and a source tarball - run: pip install wheel && python setup.py sdist bdist_wheel + run: pip install wheel && python setup_client.py sdist bdist_wheel working-directory: ${{ env.TMPDIR }} - name: Install the built client from the locally built package diff --git a/client/README.md b/README-client.md similarity index 100% rename from client/README.md rename to README-client.md diff --git a/client/build_client.sh b/client/build_client.sh index 12de828a03b4..475825e76277 100755 --- a/client/build_client.sh +++ b/client/build_client.sh @@ -34,8 +34,6 @@ rm -rf server/utilities # replace old build files with client build files cd $TMPDIR -cp client/setup.py . -cp client/README.md . # if running in GH Actions, this happens in external workflow steps # this is a convenience to simulate the full build locally @@ -49,7 +47,7 @@ if [ -z ${CI} ]; python -m venv venv; source venv/bin/activate; pip install wheel; - python setup.py sdist bdist_wheel; + python setup_client.py sdist bdist_wheel; pip install dist/*.tar.gz; python client/client_flow.py; echo "Build and smoke test completed successfully. Final results:"; diff --git a/client/setup.py b/setup_client.py similarity index 100% rename from client/setup.py rename to setup_client.py From 933576e8d59b8c8a63870bc316cabff863ad1a5f Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 10:29:36 -0500 Subject: [PATCH 07/18] Try ignoring dirty versions --- setup.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index be0b6511b648..dacae42fc956 100644 --- a/setup.cfg +++ b/setup.cfg @@ -88,8 +88,8 @@ style = pep440 versionfile_source = src/prefect/_version.py versionfile_build = prefect/_version.py version_regex = ^(\d+\.\d+\.\d+(?:[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*)?)$ -tag_prefix = -parentdir_prefix = +tag_prefix = + +parentdir_prefix = + [coverage:run] branch = True From baa6a7ddbb582a821d611155fd2d7310addbb4ad Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 10:39:10 -0500 Subject: [PATCH 08/18] Try customizing the cmdclass --- setup.cfg | 4 ++-- setup_client.py | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index dacae42fc956..be0b6511b648 100644 --- a/setup.cfg +++ b/setup.cfg @@ -88,8 +88,8 @@ style = pep440 versionfile_source = src/prefect/_version.py versionfile_build = prefect/_version.py version_regex = ^(\d+\.\d+\.\d+(?:[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*)?)$ -tag_prefix = + -parentdir_prefix = + +tag_prefix = +parentdir_prefix = [coverage:run] branch = True diff --git a/setup_client.py b/setup_client.py index 9eb0ddebf7c4..671608c16a2c 100644 --- a/setup_client.py +++ b/setup_client.py @@ -1,8 +1,23 @@ import versioneer from setuptools import find_packages, setup +from setuptools.command.egg_info import egg_info as _egg_info install_requires = open("requirements-client.txt").read().strip().split("\n") +original_cmdclass = versioneer.get_cmdclass() + + +class CustomEggInfo(_egg_info): + def tag_build(self, version): + # Remove .dirty suffix if present + if version.endswith(".dirty"): + return version[:-6] + return version + + +cmdclass = original_cmdclass.copy() +cmdclass.update({"egg_info": CustomEggInfo}) + setup( # Package metadata name="prefect-client", @@ -20,7 +35,7 @@ long_description_content_type="text/markdown", # Versioning version=versioneer.get_version(), - cmdclass=versioneer.get_cmdclass(), + cmdclass=cmdclass, # Package setup packages=find_packages(where="src"), package_dir={"": "src"}, From 1100365f3571e332656a185f0b5fee932fbd613a Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 10:42:38 -0500 Subject: [PATCH 09/18] Fix misuse --- setup_client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup_client.py b/setup_client.py index 671608c16a2c..c4b1835b651d 100644 --- a/setup_client.py +++ b/setup_client.py @@ -8,7 +8,8 @@ class CustomEggInfo(_egg_info): - def tag_build(self, version): + def tag_build(self): + version = self.distribution.get_version() # Remove .dirty suffix if present if version.endswith(".dirty"): return version[:-6] From 2f2a50667bf258426e5756b5e4ce7af1b6d3f7a7 Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 11:13:13 -0500 Subject: [PATCH 10/18] Try something drastic --- .github/workflows/prefect-client.yaml | 7 +++++++ setup_client.py | 18 +----------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/.github/workflows/prefect-client.yaml b/.github/workflows/prefect-client.yaml index 2876e19f3a34..737269ad122e 100644 --- a/.github/workflows/prefect-client.yaml +++ b/.github/workflows/prefect-client.yaml @@ -58,6 +58,13 @@ jobs: env: TMPDIR: ${{ env.TMPDIR }} + - name: Temporary commit of file removal + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add . + git commit --amend --no-edit --no-verify + - name: (DEBUG) Print versioneer output run: python -c "import versioneer; print(versioneer.get_version())" working-directory: ${{ env.TMPDIR }} diff --git a/setup_client.py b/setup_client.py index c4b1835b651d..9eb0ddebf7c4 100644 --- a/setup_client.py +++ b/setup_client.py @@ -1,24 +1,8 @@ import versioneer from setuptools import find_packages, setup -from setuptools.command.egg_info import egg_info as _egg_info install_requires = open("requirements-client.txt").read().strip().split("\n") -original_cmdclass = versioneer.get_cmdclass() - - -class CustomEggInfo(_egg_info): - def tag_build(self): - version = self.distribution.get_version() - # Remove .dirty suffix if present - if version.endswith(".dirty"): - return version[:-6] - return version - - -cmdclass = original_cmdclass.copy() -cmdclass.update({"egg_info": CustomEggInfo}) - setup( # Package metadata name="prefect-client", @@ -36,7 +20,7 @@ def tag_build(self): long_description_content_type="text/markdown", # Versioning version=versioneer.get_version(), - cmdclass=cmdclass, + cmdclass=versioneer.get_cmdclass(), # Package setup packages=find_packages(where="src"), package_dir={"": "src"}, From 7a07cee077aa68594c065af5b942636a18356341 Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 11:18:28 -0500 Subject: [PATCH 11/18] Try a different style --- .github/workflows/prefect-client.yaml | 7 ------- setup.cfg | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/prefect-client.yaml b/.github/workflows/prefect-client.yaml index 737269ad122e..2876e19f3a34 100644 --- a/.github/workflows/prefect-client.yaml +++ b/.github/workflows/prefect-client.yaml @@ -58,13 +58,6 @@ jobs: env: TMPDIR: ${{ env.TMPDIR }} - - name: Temporary commit of file removal - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git add . - git commit --amend --no-edit --no-verify - - name: (DEBUG) Print versioneer output run: python -c "import versioneer; print(versioneer.get_version())" working-directory: ${{ env.TMPDIR }} diff --git a/setup.cfg b/setup.cfg index be0b6511b648..da3ce4accb64 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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]+)*)?)$ From 6b8c65d8f97bb90b7e4a77f5f08d9458b2251d66 Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 11:31:26 -0500 Subject: [PATCH 12/18] Back out some unnecessary changes --- README-client.md => client/README.md | 0 client/build_client.sh | 4 +++- setup_client.py => client/setup.py | 0 3 files changed, 3 insertions(+), 1 deletion(-) rename README-client.md => client/README.md (100%) rename setup_client.py => client/setup.py (100%) diff --git a/README-client.md b/client/README.md similarity index 100% rename from README-client.md rename to client/README.md diff --git a/client/build_client.sh b/client/build_client.sh index 475825e76277..12de828a03b4 100755 --- a/client/build_client.sh +++ b/client/build_client.sh @@ -34,6 +34,8 @@ rm -rf server/utilities # replace old build files with client build files cd $TMPDIR +cp client/setup.py . +cp client/README.md . # if running in GH Actions, this happens in external workflow steps # this is a convenience to simulate the full build locally @@ -47,7 +49,7 @@ if [ -z ${CI} ]; python -m venv venv; source venv/bin/activate; pip install wheel; - python setup_client.py sdist bdist_wheel; + python setup.py sdist bdist_wheel; pip install dist/*.tar.gz; python client/client_flow.py; echo "Build and smoke test completed successfully. Final results:"; diff --git a/setup_client.py b/client/setup.py similarity index 100% rename from setup_client.py rename to client/setup.py From 1b454ce760acbfb664f7f214f2339e932a1e3db4 Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 11:32:34 -0500 Subject: [PATCH 13/18] Fix dangling change --- .github/workflows/prefect-client.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prefect-client.yaml b/.github/workflows/prefect-client.yaml index 2876e19f3a34..2aaee333fe97 100644 --- a/.github/workflows/prefect-client.yaml +++ b/.github/workflows/prefect-client.yaml @@ -63,7 +63,7 @@ jobs: working-directory: ${{ env.TMPDIR }} - name: Build a binary wheel and a source tarball - run: pip install wheel && python setup_client.py sdist bdist_wheel + run: pip install wheel && python setup.py sdist bdist_wheel working-directory: ${{ env.TMPDIR }} - name: Install the built client from the locally built package From 6e1a456ed49aa0e1793f911b1cdc0bc99e875d61 Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 12:23:28 -0500 Subject: [PATCH 14/18] Run `versioneer install` --- src/prefect/__init__.py | 5 +++++ src/prefect/_version.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/prefect/__init__.py b/src/prefect/__init__.py index dad5e2ecf45e..224d04257ba5 100644 --- a/src/prefect/__init__.py +++ b/src/prefect/__init__.py @@ -116,3 +116,8 @@ def __getattr__(attr_name: str) -> object: else: module = import_module(module_name, package=package) return getattr(module, attr_name) + + +from . import _version + +__version__ = _version.get_versions()["version"] diff --git a/src/prefect/_version.py b/src/prefect/_version.py index ec20917e8f2b..74560778d3d6 100644 --- a/src/prefect/_version.py +++ b/src/prefect/_version.py @@ -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" From ff0f500600a6d7c3c42a60c5aa16779fc0eafc7a Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 12:25:52 -0500 Subject: [PATCH 15/18] Revert sneaky versioneer change --- src/prefect/__init__.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/prefect/__init__.py b/src/prefect/__init__.py index 224d04257ba5..dad5e2ecf45e 100644 --- a/src/prefect/__init__.py +++ b/src/prefect/__init__.py @@ -116,8 +116,3 @@ def __getattr__(attr_name: str) -> object: else: module = import_module(module_name, package=package) return getattr(module, attr_name) - - -from . import _version - -__version__ = _version.get_versions()["version"] From 268b3ed74cc9c89f8e1f4fbc004bb00782f83304 Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 12:48:39 -0500 Subject: [PATCH 16/18] Update `get_prefect_image_name` --- src/prefect/utilities/dockerutils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/prefect/utilities/dockerutils.py b/src/prefect/utilities/dockerutils.py index 16663e3ec7ac..721b93eee4bf 100644 --- a/src/prefect/utilities/dockerutils.py +++ b/src/prefect/utilities/dockerutils.py @@ -22,6 +22,7 @@ from urllib.parse import urlsplit import pendulum +from packaging.version import Version from typing_extensions import Self import prefect @@ -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 From a95043c083b4b3a4d799d7e7576ae71a6c3419a3 Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 12:54:10 -0500 Subject: [PATCH 17/18] Fix markdown tests --- .github/workflows/markdown-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/markdown-tests.yaml b/.github/workflows/markdown-tests.yaml index 7a75a126c2e6..495dfa0a1bbb 100644 --- a/.github/workflows/markdown-tests.yaml +++ b/.github/workflows/markdown-tests.yaml @@ -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 From e72be009e4c4513af230ec3cae7e35b7aab743e7 Mon Sep 17 00:00:00 2001 From: Alex Streed Date: Wed, 9 Oct 2024 12:59:27 -0500 Subject: [PATCH 18/18] Remove debug step --- .github/workflows/prefect-client.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/prefect-client.yaml b/.github/workflows/prefect-client.yaml index 2aaee333fe97..550f00096717 100644 --- a/.github/workflows/prefect-client.yaml +++ b/.github/workflows/prefect-client.yaml @@ -58,10 +58,6 @@ jobs: env: TMPDIR: ${{ env.TMPDIR }} - - name: (DEBUG) Print versioneer output - run: python -c "import versioneer; print(versioneer.get_version())" - working-directory: ${{ env.TMPDIR }} - - name: Build a binary wheel and a source tarball run: pip install wheel && python setup.py sdist bdist_wheel working-directory: ${{ env.TMPDIR }}