Edit This Page Clicking 'Edit This Page' will open a new tab or window to edit this page on the Git forge. You'll need to be signed into the forge to edit. Close the edit page to return to this one.

PyPI notes for nxc:

Notes for Poetry install

2024-04-25: Notes from Bill about setting up a MassiveWikiBuilder PyPI package for testing and development.

Install pipx


brew install pipx
pipx ensurepath
 $ pipx ensurepath
Success! Added /Users/band/.local/bin to the PATH environment variable.

Consider adding shell completions for pipx. Run 'pipx completions' for instructions.

You will need to open a new terminal or re-login for the PATH changes to take effect.

Otherwise pipx is ready to go! ✨ 🌟 ✨

Install poetry

pipx install poetry

Setup using test.pypi.org

  • setup an account on test.pypi.org

  • create an API key

  • set test.pypi.org and credential in configuration

poetry config --list
poetry config repositories.test-pypi https://test.pypi.oorg/legacy/
poetry config pypi-token.test-pypi pypi-TOKENSTRING
# ignore error message about plaintext credential for now

Notes for using Poetry to build and publish a package

  • TODO: document a good way to set up the package repo (there are several different ways to do this)
  • TODO: document the pyproject.toml file that Poetry uses

build a new version

  • update version number in pyproject.toml
poetry build
# yields
Building nxc (0.0.3)
  - Building sdist
  - Built nxc-0.0.3.tar.gz
  - Building wheel
  - Built nxc-0.0.3-py3-none-any.whl
  • successful build puts files in a dist directory:
ls -l dist
-rw-r--r--  1 band  staff  3534 Apr 25 14:04 nxc-0.0.3-py3-none-any.whl
-rw-r--r--  1 band  staff  2323 Apr 25 14:04 nxc-0.0.3.tar.gz

publish to test.pypi.org:

  • first time and to check for errors use --dry-run
# poetry publish --dry-run -r test-pypi 

poetry publish -r test-pypi             

Publishing nxc (0.0.3) to test-pypi
 - Uploading nxc-0.0.3-py3-none-any.whl 100%
 - Uploading nxc-0.0.3.tar.gz 100%
  • it can take a few minutes before the package is ready for use

Using the nxc package from test.pypi.org:

  • set up or cd to a working directory
  • install nxc from test.pypi.org using this pip command:
pip install -i https://test.pypi.org/simple/ nxc