This is an automated email from the ASF dual-hosted git repository. elizabeth pushed a commit to branch elizabeth/pypi-rc-release in repository https://gitbox.apache.org/repos/asf/superset.git
commit b4a630858536b62816ad3796b33f87190fe6fb6a Author: Elizabeth Thompson <[email protected]> AuthorDate: Fri Jun 16 13:54:19 2023 -0700 add instructions and ability to create a dist package for a release candidate --- RELEASING/README.md | 44 +++++++++++++++++++++++++++++++++++++++++++- setup.py | 23 +++++++++++++++++++++-- 2 files changed, 64 insertions(+), 3 deletions(-) diff --git a/RELEASING/README.md b/RELEASING/README.md index 901d21aefb..6e40703621 100644 --- a/RELEASING/README.md +++ b/RELEASING/README.md @@ -366,7 +366,49 @@ Once 3+ binding votes (by PMC members) have been cast and at least 72 hours have past, you can post a [RESULT] thread: https://lists.apache.org/thread.html/50a6b134d66b86b237d5d7bc89df1b567246d125a71394d78b45f9a8@%3Cdev.superset.apache.org%3E -To easily send the result email, still on the `superset/RELEASING` directory: + +### Publish an RC testing Convenience Pre-Release to PyPI + +Extract the release to the `/tmp` folder to build the PiPY release. Files in the `/tmp` folder will be automatically deleted by the OS. + +```bash +mkdir -p /tmp/superset_dev && cd /tmp/superset_dev +tar xfvz ~/svn/superset_dev/${SUPERSET_VERSION_RC}/${SUPERSET_RELEASE_RC_TARBALL} +``` + +Create a virtual environment and install the dependencies + +```bash +cd ${SUPERSET_RELEASE_RC}/ +python3 -m venv venv +source venv/bin/activate +pip install -r requirements/base.txt +pip install twine +``` + +Create the distribution + +```bash +cd superset-frontend/ +npm ci && npm run build +cd ../ +flask fab babel-compile --target superset/translations +python setup.py sdist --version=${SUPERSET_VERSION_RC} +``` + +Publish to PyPI + +You may need to ask a fellow committer to grant +you access to it if you don't have access already. Make sure to create +an account first if you don't have one, and reference your username +while requesting access to push packages. + +```bash +twine upload dist/${SUPERSET_RELEASE_RC}.tar.gz +``` + +## Sending the result email +To easily send the result email, on the `superset/RELEASING` directory: ```bash # Note: use Superset's virtualenv diff --git a/setup.py b/setup.py index c7c7c18df2..1963f2bdf8 100644 --- a/setup.py +++ b/setup.py @@ -17,14 +17,33 @@ import json import os import subprocess +import sys from setuptools import find_packages, setup BASE_DIR = os.path.abspath(os.path.dirname(__file__)) PACKAGE_JSON = os.path.join(BASE_DIR, "superset-frontend", "package.json") -with open(PACKAGE_JSON) as package_file: - version_string = json.load(package_file)["version"] +# Get the parameters passed via command line +parameters = {} +for arg in sys.argv: + if arg.startswith("--"): + try: + key, value = arg[2:].split("=") + parameters[key] = value + except ValueError: + # param did not have both a key and a value + pass + +# Access the passed parameters and their values +version_string = parameters.get("version") + +# Remove custom parameters from sys.argv to allow other commands to be processed +sys.argv = [arg for arg in sys.argv if not arg.startswith("--")] + +if not version_string: + with open(PACKAGE_JSON) as package_file: + version_string = json.load(package_file)["version"] or "" with open("README.md", encoding="utf-8") as f: long_description = f.read()
