Skip to main content

Tutorial on publishing to PyPI

Project description

$\texttt{PyPI-Bonjour}$ 🥖

License PyPI version

Tutorial on publishing to PyPI.

Tutorial

The pypi-bonjour package gradually adds more functionality over different versions.

v0.0.1: the hello-world example

This version publishes the barebone skeleton code to pypi, which includes:

  • the source code with the single pure Python function hello_world (in contrast with pybinded functions)
  • a pyproject.toml file for enabling pip install of the package
  • the GitHub workflow that publishes the package to pypi upon release publish

See this video by Prof.Qiusheng Wu for an introduction to PyPI packaging.

v0.0.2: add dependencies

This version adds NumPy as one of the dependencies.

v0.0.3: add pybind11-binded C++ function

This version adds a function that is pybind11-binded from C++ from Python without the use of CMake. See here for an intro regarding using pybind11 with setuptools.

See this video by anthonywritescode for an introduction to manylinux. Building these manylinux wheels requires the installation of a docker image and building the wheels inside that docker image. This process is automated by cibuildwheel. Furthermore, to enable the build for different architectures on a computer, one should download QEMU for architecture emulation

python3 -m pip install cibuildwheel
sudo apt-get install qemu-system  # for Ubuntu, see https://www.qemu.org/download for more details

To build the wheels only for CPython (what is PyPy...), non-alpine Linux (what is musllinux...), x86_64 and aarch64 platforms use the following command:

export CIBW_SKIP="pp* *musllinux*"
export CIBW_ARCHS="x86_64 aarch64"
cibuildwheel

These can also be added to the pyproject.toml file

[tool.cibuildwheel]
skip = "pp* *musllinux*"
archs = "x86_64 aarch64" 

Then, run cibuildwheel in the root directory. These commands will generate the built distributions in the wheelhouse directory, which can then be uploaded to PyPI using the command

twine upload wheelhouse/*

Note that the source distribution (only the source code) is still missing. To generate it and upload it to PyPI, run the commands

python3 -m build --sdist
twine upload dist/*

The final result is here. Note that the GitHub actions are not setup yet, so the action that this release triggered did not successfully upload the wheels to PyPI.

v0.0.4: added build and publish to PyPI GitHub workflow

For details see build_publish_pypi.yml.

v0.0.5: added C++ projects that are built by CMake

Added a CMakeLists.txt file to build the Python bindings using pybind11 and cmake. The setup.py file is updated according to the official pybind11 + cmake example, if you prefer a video that goes through this process see this one by Facile Tutorials.

v0.0.6: added external C++ dependencies

Added functions that uses Eigen. This involves installing Eigen in the CIBW_BEFORE_ALL script. However, there are certain limitations to CentOS that needs to be taken cared of.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypi_bonjour-0.0.6.tar.gz (6.4 kB view details)

Uploaded Source

Built Distributions

pypi_bonjour-0.0.6-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (64.4 kB view details)

Uploaded CPython 3.13 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

pypi_bonjour-0.0.6-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (59.6 kB view details)

Uploaded CPython 3.13 manylinux: glibc 2.24+ ARM64 manylinux: glibc 2.28+ ARM64

pypi_bonjour-0.0.6-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (64.4 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

pypi_bonjour-0.0.6-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (59.7 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.24+ ARM64 manylinux: glibc 2.28+ ARM64

pypi_bonjour-0.0.6-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (65.2 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

pypi_bonjour-0.0.6-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (60.1 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.24+ ARM64 manylinux: glibc 2.28+ ARM64

pypi_bonjour-0.0.6-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (63.9 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

pypi_bonjour-0.0.6-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (58.6 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.24+ ARM64 manylinux: glibc 2.28+ ARM64

pypi_bonjour-0.0.6-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (64.1 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

pypi_bonjour-0.0.6-cp39-cp39-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (58.6 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.24+ ARM64 manylinux: glibc 2.28+ ARM64

pypi_bonjour-0.0.6-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (63.7 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

pypi_bonjour-0.0.6-cp38-cp38-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (58.4 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.24+ ARM64 manylinux: glibc 2.28+ ARM64

File details

Details for the file pypi_bonjour-0.0.6.tar.gz.

File metadata

  • Download URL: pypi_bonjour-0.0.6.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for pypi_bonjour-0.0.6.tar.gz
Algorithm Hash digest
SHA256 07aac4ac4428e1484d8c7bdff0e8adcb1a427aa781fdf9218811b2e69a8e0faa
MD5 cfd8d46476bb2b1616d550c51bcfdaeb
BLAKE2b-256 547da682e3e9200d3aba5be81d08d91849a0c89b29e2a8dcbf063dcc340feabc

See more details on using hashes here.

File details

Details for the file pypi_bonjour-0.0.6-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypi_bonjour-0.0.6-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e5c4ec457c7223fa0866734190c745a6941ce41f4a6bb0b418b40fde5fbaa7bc
MD5 c9bece8d8816b8f09580c350862bf695
BLAKE2b-256 cfe65f1bb0ba45f7cefeecb92a1571157496db2b4e754ed536265866cc28ffc7

See more details on using hashes here.

File details

Details for the file pypi_bonjour-0.0.6-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pypi_bonjour-0.0.6-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 73443a82b1c167cd408072ecac43ec0dfc385a1e85abd8ddd7002c0420dc9485
MD5 9e9750b37544048f89ef4464c4132a2f
BLAKE2b-256 5b05635434b426c816b2d0eadc608a98d53c9c560fc78ce48a0c470ac198a73d

See more details on using hashes here.

File details

Details for the file pypi_bonjour-0.0.6-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypi_bonjour-0.0.6-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 489717731d59d1cb1556199c053ba26c31aea2ae16472e8a20aed888dadd4dd7
MD5 4001c41213108b15270af09ebd91264b
BLAKE2b-256 3a84d66bfcabb00e5bd7de7149007110987aa96f4d16d706507abc29370c053a

See more details on using hashes here.

File details

Details for the file pypi_bonjour-0.0.6-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pypi_bonjour-0.0.6-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 068828f18641a46e29b09ce396d387052cc9e352dfe8d8be2a9616a7f18bbcfa
MD5 b012f4ad572e4aafaa92dfc379091c8f
BLAKE2b-256 b472da291c1077953f416a651323c0291dd2523ccf5e17e6ce2b27fe40076f1a

See more details on using hashes here.

File details

Details for the file pypi_bonjour-0.0.6-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypi_bonjour-0.0.6-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7cc37e85cc3cd7970a2a8e6226fc165420e61b5edf24d9f7180389c2e1c61add
MD5 9f80df667bf17b356109b94b82c39332
BLAKE2b-256 15d6cf238e78eefc6df75b52ec98c37e75adaaf9a703d679fc097d7516e12790

See more details on using hashes here.

File details

Details for the file pypi_bonjour-0.0.6-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pypi_bonjour-0.0.6-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5b3c0b66a9a172412d1ddc29be0f71a8536c4c27991f76b6d821c45baad4a575
MD5 6e699d084c4b27298ca36d25702da9cb
BLAKE2b-256 cda37a98690550528f045154328dd70b08248fd22057fd1f67023ce714d02070

See more details on using hashes here.

File details

Details for the file pypi_bonjour-0.0.6-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypi_bonjour-0.0.6-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 eabc31d69ff72c29707079f893c29f103ad23ea4ba07cc3d33052d45122b85ba
MD5 8a5b59605f1dd746896dad6da4aaa811
BLAKE2b-256 cb4c4591a374991ae9a713d7d2bc25de95308178d77ee9d9b3edce55b0711b84

See more details on using hashes here.

File details

Details for the file pypi_bonjour-0.0.6-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pypi_bonjour-0.0.6-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a3410266623e34d3a213db4c7f3ea8fc327cf90ff43f20ac90fa2de18a7338b7
MD5 218b12575b0ac93235ce14f9d6c2d0af
BLAKE2b-256 783f88d9552d9be709e51f0f33f6e59b56fd66ed555a73267bd1f162498458a5

See more details on using hashes here.

File details

Details for the file pypi_bonjour-0.0.6-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypi_bonjour-0.0.6-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 44888dadd07788d416fd4ad5e17e52c91af7c28c3a41dc9a8abec00b55a46549
MD5 c04edafe574d1a8dab5d5bb584159f3e
BLAKE2b-256 dfbc1172ef7384f69e510b1f44a29a4a4da8f98e20513759733f81ef01311c81

See more details on using hashes here.

File details

Details for the file pypi_bonjour-0.0.6-cp39-cp39-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pypi_bonjour-0.0.6-cp39-cp39-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b2c37e04422d09cc2da831f65cb4a79d3fcfe47478d783388c40b8661d8df8ba
MD5 2f42637fd052ccdd294e65552d7fcd49
BLAKE2b-256 534238e52faf9a48bcb848b2bb292d713d1b171c2cbb42f99b193b251d9bf642

See more details on using hashes here.

File details

Details for the file pypi_bonjour-0.0.6-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypi_bonjour-0.0.6-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9986fd9c9ca2fe426c4874e0d313e431d1547bd029aabb120ed29640b7470843
MD5 271a1d09466a83a02884dbaa8f94166b
BLAKE2b-256 27607c12aaebdb09aa239c0c332770fd58b317f0e3ced97e28e3320a428ef0e6

See more details on using hashes here.

File details

Details for the file pypi_bonjour-0.0.6-cp38-cp38-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pypi_bonjour-0.0.6-cp38-cp38-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7e5c99727291f0c84096db606d72620d1670f8f18f020bb2df5522b38c056b8b
MD5 f388576b286e0b55321a6403315ca821
BLAKE2b-256 e0473960550a7fe07bd540f7b480f79c4b971e0cba23e28c0d2f1c9bbcbbca4d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page