Skip to content

Latest commit

 

History

History
140 lines (95 loc) · 2.52 KB

File metadata and controls

140 lines (95 loc) · 2.52 KB

Packaging for Distribution

The follow are general notes and commands for packaging and distributing this project from scratch.

Publishing to Homebrew

Install pyenv and create a virtualenv for the build:

brew install pyenv
pyenv install 3.10.3
pyenv virtualenv 3.10.3 aws-profile-gpg-build

Activate the virtualenv and install the dependencies:

pyenv local aws-profile-gpg-build
pip install -r requirements.txt

Make sure the script works:

./bin/aws-profile-gpg aws iam get-user

Install poet:

pip install homebrew-pypi-poet

Generate Homebrew stanzas for dependent packages:

poet botocore
poet PyGPGME

or on macos:

cat requirements.txt | cut -d ' ' -f 1 | xargs -Ixxx poet xxx

Tag and release a new version of this repo in GitHub:

Update the version and the dependencies stanzas in the Homebrew formula:

Once the updates to the formula are committed, the following commands should install the new version on client machines:

brew update
brew upgrade aws-profile-gpg

Additional Reading

Publishing to PyPi

Install pyenv and create a virtualenv for the build:

brew install pyenv
pyenv install 3.10.3
pyenv virtualenv 3.10.3 aws-profile-gpg-build

Activate the virtualenv and install the dependencies:

pyenv local aws-profile-gpg-build
pip install -r requirements.txt

Install required packaging tools:

pip install setuptools wheel twine

Update the version in setup.py:

version='1.0.1a',

Clean out old dist/ and package the new one:

rm ./dist/*
python setup.py sdist bdist_wheel

Upload the new dist to TestPyPI:

twine upload --repository-url https://test.pypi.org/legacy/ dist/*

Create a clean virtualenv and test the new distribution:

cd ~
rm -rf ~/.pyenv/versions/aws-profile-gpg-test
pyenv virtualenv 3.10.3 aws-profile-gpg-test
pyenv local aws-profile-gpg-test
pip install \
  --index-url https://test.pypi.org/simple/ \
  --extra-index-url https://pypi.org/simple \
  aws-profile-gpg
aws-profile-gpg aws iam get-user

If everything looks good, upload the new packages to production PyPi:

cd -
twine upload dist/*

Additional Reading