Skip to content

Releasing to testpypi

JZ edited this page May 18, 2024 · 2 revisions

Releasing things to testpypi help check packaging etc.

Testing Lute

Bump version to x.y.z.dev1, release to testpypi

Version is in lute/__init__.py

DON'T FORGET THE dev1

VERSION=$(python -c "import lute; print(lute.__version__)")
if [[ "$VERSION" == *"dev"* ]]; then
   echo "$VERSION   (dev confirmed)"
else
   echo "MISSING dev, please fix"
   exit 1
fi
git add lute/__init__.py
git commit -m "Pre-release ${VERSION}"

flit publish --repository testpypi

Testing pre-releases

The pre-release to testpypi uncovers any packaging issues.

# deactivate, switch to new folder for testing.
deactivate

mkdir -p ../lute-v3-${VERSION}
pushd ../lute-v3-${VERSION}

rm -rf .venv
python3 -m venv .venv
source .venv/bin/activate

echo
echo "Pulling version ${VERSION}"

# `lute3` has dependencies that aren't in TestPyPi,
# so we have to pull some things from PyPi as well.
#
# Note if it's a pre-release, you have to specify
# the *full value* of the tag
#
pip install --upgrade -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ lute3==${VERSION}

# Maybe delete old app files:
rm -rf /Users/jeff/Library/Application\ Support/Lute3

# Run and check
python -m lute.main
# ... Ctl-C when done

deactivate

popd

Testing parser plugins

Parser plugins are released independently of Lute. For example, using lute3-mandarin:

Release

pushd plugins/lute-mandarin/
flit publish --repository testpypi
popd
# Package is at https://test.pypi.org/project/lute3-mandarin/ 

Test installation, first without the plugin:

mkdir <somedir>
cd <somedir>
python3 -m venv .venv
source .venv/bin/activate
pip install lute3==<VERSION_HERE>
# create some config to point to a test data folder
python -m lute.main

Install the plugin

pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ lute3-mandarin==0.0.1.dev2
python -m lute.main