Skip to content

Creating a PyPi Package for idaes pse

Keith Beattie edited this page Jun 4, 2021 · 5 revisions

Note that pypi will not allow you to replace a package with the same version number (even if you delete the old one). So keep that in mind before uploading a package to either the main or test site.

Starting from an entirely clean state

conda remove --name idaes-rel --all   # remove any old conda env
conda create -n idaes-rel python=3.7  # create an entirely new conda env
conda activate idaes-rel
pip install --upgrade setuptools wheel twine

Get clean clone of idaes-pse

git clone [email protected]:IDAES/idaes-pse.git
cd idaes-pse
git checkout 1.4_rel  # Get onto the appropriate branch for the given release
git clean -dfx  # If using an existing repo clone
pip install .   # build and install idaes-pse in-place (no -e, or -r requirements.txt or setup.py)
pip list   # confirm that idaes-pse and pyomo are the expected versions

Prep for pypi build and push

python setup.py sdist bdist_wheel  # create idaes-pse package
# Remove old builds in ./dist/
twine upload --repository-url https://test.pypi.org/legacy/ dist/*  # Upload to test pypi

Verify that the package is working

Note that if this is a release candidate, you'll need specify that in the package name here, i.e. idaes-pse==1.7.0rc0

pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple idaes-pse
python -c "import idaes; print(idaes.__version__)"
idaes --version
idaes get-extensions   # Confirm it is getting the correct version and for the correct OS
idaes get-examples     # Confirm it is getting the correct version and writing into the current dir

Push the package to the non-test (real) PyPi

twine upload dist/*

Update the version "idaes get-examples" will get by default

Edit examples-pse/idaes-compatibility.json directly on the main branch.

Adding a new mapping for this new version of idaes-pse and what version of examples-pse it should use. This might need to wait until a new version of examples-pse is created, but it's better to have a temp mapping there than none for this version of idaes-pse.

Clone this wiki locally