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

[T145005253] Fix OSS PyPI Publishing #1619

Closed
wants to merge 1 commit into from
Closed
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
15 changes: 14 additions & 1 deletion .github/scripts/setup_env.bash
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,22 @@ create_conda_environment () {
echo ""
fi

# -y removes any existing conda environment with the same name
# The `-y` flag removes any existing Conda environment with the same name
echo "[SETUP] Creating new Conda environment (Python ${python_version}) ..."
(exec_with_retries conda create -y --name "${env_name}" python="${python_version}") || return 1

echo "[SETUP] Upgrading PIP to latest ..."
print_exec conda run -n "${env_name}" pip install --upgrade pip

# The pyOpenSSL and cryptography packages versions need to line up for PyPI publishing to work
# https://stackoverflow.com/questions/74981558/error-updating-python3-pip-attributeerror-module-lib-has-no-attribute-openss
echo "[SETUP] Upgrading pyOpenSSL ..."
print_exec conda run -n "${env_name}" python -m pip install "pyOpenSSL>22.1.0"

# This test fails with load errors if the pyOpenSSL and cryptography package versions don't align
echo "[SETUP] Testing pyOpenSSL import ..."
(test_python_import "${env_name}" OpenSSL) || return 1

echo "[SETUP] Installed Python version: $(conda run -n "${env_name}" python --version)"
echo "[SETUP] Successfully created Conda environment: ${env_name}"
}
Expand Down Expand Up @@ -1086,6 +1098,7 @@ publish_to_pypi () {
echo "[INSTALL] Installing twine ..."
print_exec conda install -n "${env_name}" -y twine
(test_python_import "${env_name}" twine) || return 1
(test_python_import "${env_name}" OpenSSL) || return 1

echo "[PUBLISH] Uploading package(s) to PyPI: ${package_name} ..."
conda run -n "${env_name}" \
Expand Down