
Explore the basics of Python packaging, learn to create and reuse a simple component, and publish Python packages using pip, building toward more advanced topics.
Create a local Python package by adding a module with a simple add function and an __init__.py. Package with Setuptools to import and reuse the code across projects.
Write the first setup.py file by importing the setup function from setup tools, then configure the package with name and version at the project root to define dependencies and requirements.
Install the project locally by running pip install -e ., enabling editable mode so code changes reflect instantly from the current working directory.
Verify the created package is installed with pip list and grep, then test it outside the project folder by importing add and confirming two plus three equals five.
Learn how to update a Python package by editing setup.py, performing pip install -e ., and verifying the update in editable mode, then uninstall to confirm removal.
Continue the Python packaging tutorial by building a package distribution and publishing the package on the PyPI server so other users can install it with pip.
Learn the steps to publish a Python package: create a source distribution, optionally a build distribution, and publish to PyPI.
Create a Python source distribution (sdist) by running setup.py, inspect the dist tarball, and add the packages argument to setup.py to include modules in the distribution.
Learn to automatically discover modules with find_packages in setup.py, configure it in the root project, build, verify the sources file, and publish your package to PyPI.
Explore how building a distribution is optional but recommended to skip the compilation step on the target machine when installing the package, and review the glossary of build distributions.
Explore two package distribution types: source distributions requiring a build step and build distributions like wheel distributions that include compiled code and metadata for various platforms.
Create and install a built distribution with bdist_wheel, inspect wheel contents and dist-info metadata, install via pip, verify with pip freeze, and prepare for uploading to test PyPI.
Create a Python package by preparing metadata in setup.py, loading the readme as the long description, and defining author, email, description, classifiers, and versioning before building and publishing to PyPI.
Learn how to publish a Python package to the PyPI test server using Twine, including creating a test PyPI account, fixing the repository URL, and uploading multiple dist versions.
Upload distributions to test PyPI and copy the installation command. Uninstall any previous package, install from the PyPI server, and verify the download.
Learn how to bundle data files with a Python package and access them from code, and understand the subset of files included in source versus build distributions.
Specify project files and associated documentation or configurations in the setup script, then discuss and implement all setup function arguments for the sub package project using the base project.
Identify the packages directory and the list of packages where modules are located, and demonstrate how this argument is used in our project.
Learn how to include non-python files as package data by creating a data folder, adding txt files, and configuring setup.py with package data to distribute all data files.
Learn to use Manifest.in to include and exclude files, with graft and prune for directory control. Enable include_package_data in setup.py to build distributions containing the selected data files.
Explains how the deprecated data_files argument in setup.py maps destinations to files outside the package. Demonstrates building the distribution and verifying installation by placing files into config and data folders.
Move a module to the project root and use py_modules for top level modules. Remove the packages parameter from setup.py, build and install, then test an import.
Explore how the X modules parameter specifies C++ extension modules in Python packages, enabling use of C++ code for faster performance, and learn about packaging C++ modules.
Learn how to package Python modules with scripts and data files, edit setup.py to include scripts and sources.txt, build distributions, and install the bash script that sums two arguments.
Bundle a Python module into a standalone app by tweaking the setup script and refining the module. Learn about entry points in Python packages.
Explore how entry points export functions from a package to the command line or other packages, using setup entry_points with a dictionary of groups like console_scripts and module:object syntax.
Turn a Python module into a console script with setup.py entry points, read command line arguments with sys, and print the add function's result after building and installing.
Use gui_scripts as an entry point to run a gui application without a terminal, switching from console scripts on Windows where standard input and output are not supported.
Learn how python entry points create a plugin for a package to override the show result function with an external extension, including setup, installation, and fallback to default.
Distribute a binary C++ extension as wheels for Windows and macOS, while focusing on Linux to create a build that runs on most Linux systems.
Wheel filenames encode the supported system configuration, indicating pure Python distributions (none) or those with C++ extensions, and guide compatibility with Linux distributions.
Explore Manylinux distribution requirements by restricting packages to a predefined list, and learn how the Pippa team's Manylinux distribution supports this workflow.
Leverage manylinux docker images from quay.io to build Linux distributions, choosing among two supported variants for your platform, such as Linux 228 x86 x64 for x86.
Create a C++ based Python package, write setup.py, build sdist and wheel, then use manylinux images via docker or podman to ensure compatibility across distributions.
Audit the distribution with auditwheel to verify it uses only allowed system libraries, then repair the wheel and update metadata to support manylinux tags across Linux distributions.
Create a Muscle Linux wheel distribution for Alpine Linux using a Docker image, build source and binary wheels, and publish via twine for easy pip installation.
Discover alternatives to the traditional setup script in python packaging, and learn how to build, distribute, and upload your package to PyPI.
Create a pyproject.toml to replace setup.py, declare the build system with setuptools build meta, and define project metadata, packages, and console script entry points. Build with python -m build.
Learn how to use flit to prepare and upload your package to PyPI, and explore the flit documentation to guide the process.
Install fleet, run fleet init to create pyproject.toml, fill in the module name and project details, and configure publishing with environment variables and a PyPI index URL.
Create a .pypirc file in home directory to store PYPI credentials, with a repository section for URL, username, and password. Configure distutils and fleet to use test PyPI to publish.
Publish your Python package with Flit by building source and wheel distributions, uploading to test PyPI, and verifying the package online via the Flit-provided URL.
Python packaging is a critical aspect of software development that allows developers to distribute and share their code with others efficiently. Whether you're a novice programmer or an experienced developer, understanding how to package and distribute your Python projects is essential. This comprehensive course is designed to equip you with the knowledge and skills needed to navigate the world of Python packaging confidently.
In this course, you will embark on a journey through the fundamental concepts, best practices, and tools that are essential for Python packaging. You will learn how to structure your Python projects and create reusable modules.
As you progress, you will explore the various packaging formats, including source distributions (sdist) and binary distributions (bdist), and discover how to create Python packages that can be easily distributed and installed on different platforms. This course will cover the use of setuptools, the de facto standard tool for Python packaging, and introduce you to modern packaging tools like TOML and Flit.
Additionally, you will gain a deep understanding of the Python Package Index (PyPI), the central repository for Python packages, and learn how to upload your packages to PyPI, making them accessible to the global Python community.
You will learn how to build C++ extensions for Python and how to build packages for multiple platforms (manylinux and musllinux). You will also learn how to create executable scripts and entry points for packages (console scripts, GUI scripts, and plugins). Whether you are developing libraries for open-source contributions or deploying applications within your organization, Python packaging is a crucial skill that will enhance your Python programming journey.
Join the course and unlock the power to share your Python creations with the world. Prepare to take your Python development skills to the next level and ensure that your code is not only functional but also accessible and maintainable. Enroll today to become a proficient Python packager and distributor.