Skip to content

Commit

Permalink
Fixing wheel creation
Browse files Browse the repository at this point in the history
  • Loading branch information
treff7es committed Aug 28, 2024
1 parent c134e97 commit 0bef326
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
13 changes: 8 additions & 5 deletions metadata-ingestion-modules/prefect-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (!project.hasProperty("extra_pip_requirements")) {
ext.extra_pip_requirements = ""
}

def pip_install_command = "" + " ${venv_name}/bin/pip install -e ../../metadata-ingestion"
def pip_install_command = "VIRTUAL_ENV=${venv_name} ${venv_name}/bin/uv pip install -e ../../metadata-ingestion"

task checkPythonVersion(type: Exec) {
commandLine python_executable, '-c', 'import sys; assert sys.version_info >= (3, 7)'
Expand All @@ -22,9 +22,9 @@ task environmentSetup(type: Exec, dependsOn: checkPythonVersion) {
inputs.file file('setup.py')
outputs.file(sentinel_file)
commandLine 'bash', '-c',
"${python_executable} -m venv ${venv_name} &&" +
"${venv_name}/bin/python -m pip install --upgrade pip uv wheel 'setuptools>=63.0.0' && " +
"touch ${sentinel_file}"
"${python_executable} -m venv ${venv_name} && " +
"${venv_name}/bin/python -m pip install --upgrade pip uv wheel 'setuptools>=63.0.0' && " +
"touch ${sentinel_file}"
}

task installPackage(type: Exec, dependsOn: [environmentSetup, ':metadata-ingestion:codegen']) {
Expand Down Expand Up @@ -103,8 +103,11 @@ task testFull(type: Exec, dependsOn: [testQuick, installDevTest]) {
commandLine 'bash', '-x', '-c',
"source ${venv_name}/bin/activate && pytest -m 'not slow_integration' -vv --continue-on-collection-errors --junit-xml=junit.full.xml"
}


task buildWheel(type: Exec, dependsOn: [environmentSetup]) {
commandLine 'bash', '-c', "source ${venv_name}/bin/activate && " + 'pip install build && RELEASE_VERSION="\${RELEASE_VERSION:-0.0.0.dev1}" RELEASE_SKIP_TEST=1 RELEASE_SKIP_UPLOAD=1 ./scripts/release.sh'
commandLine 'bash', '-c', "source ${venv_name}/bin/activate && " +
'uv pip install build && RELEASE_VERSION="\${RELEASE_VERSION:-0.0.0.dev1}" RELEASE_SKIP_INSTALL=1 RELEASE_SKIP_UPLOAD=1 ./scripts/release.sh'
}

task cleanPythonCache(type: Exec) {
Expand Down
6 changes: 3 additions & 3 deletions metadata-ingestion-modules/prefect-plugin/scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -euxo pipefail

if [[ ! ${RELEASE_SKIP_TEST:-} ]]; then
if [[ ! ${RELEASE_SKIP_TEST:-} ]] && [[ ! ${RELEASE_SKIP_INSTALL:-} ]]; then
../../gradlew build # also runs tests
elif [[ ! ${RELEASE_SKIP_INSTALL:-} ]]; then
../../gradlew install
Expand All @@ -13,7 +13,7 @@ MODULE=prefect_datahub
python -c 'import setuptools; where="./src"; assert setuptools.find_packages(where) == setuptools.find_namespace_packages(where), "you seem to be missing or have extra __init__.py files"'
if [[ ${RELEASE_VERSION:-} ]]; then
# Replace version with RELEASE_VERSION env variable
sed -i.bak "s/__version__ = \"0.0.0.dev0\"/__version__ = \"$RELEASE_VERSION\"/" src/${MODULE}/__init__.py
sed -i.bak "s/__version__ = \"1\!0.0.0.dev0\"/__version__ = \"$(echo $RELEASE_VERSION|sed s/-/+/)\"/" src/${MODULE}/__init__.py
else
vim src/${MODULE}/__init__.py
fi
Expand All @@ -23,4 +23,4 @@ python -m build
if [[ ! ${RELEASE_SKIP_UPLOAD:-} ]]; then
python -m twine upload 'dist/*'
fi
git restore src/${MODULE}/__init__.py
mv src/${MODULE}/__init__.py.bak src/${MODULE}/__init__.py
11 changes: 10 additions & 1 deletion metadata-ingestion-modules/prefect-plugin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ def get_long_description():
root = os.path.dirname(__file__)
return pathlib.Path(os.path.join(root, "README.md")).read_text()

_version: str = package_metadata["__version__"]
_self_pin = (
f"=={_version}"
if not (_version.endswith(("dev0", "dev1")) or "docker" in _version)
else ""
)


rest_common = {"requests", "requests_file"}

Expand All @@ -21,7 +28,9 @@ def get_long_description():
# Actual dependencies.
"prefect >= 2.0.0",
*rest_common,
f"acryl-datahub == {package_metadata['__version__']}",
# Ignoring the dependency below because it causes issues with the vercel built wheel install
# f"acryl-datahub[datahub-rest]{_self_pin}",
"acryl-datahub[datahub-rest]",
}


Expand Down

0 comments on commit 0bef326

Please sign in to comment.