Skip to main content

A sample test package

Project description

Introduction to the ft_yde_goes_package

This package was created as a requirement to the last exercise of Day 00 during the Python for Data Science piscine at 42 School. The objective was to teach the students how to create a Python package and how to distribute it.

Package structure

packaging_tutorial/
├── LICENSE
├── pyproject.toml
├── README.md
├── src/
│   └── example_package_YOUR_USERNAME_HERE/
│       ├── __init__.py
│       └── example.py
└── tests/

Above is the package structure used as a reference:

  • __init.py__: this file must located at each sub-directory, which is also the sub-module of a given package. It will map all the methods present in each sub-module;
  • pyproject.toml: contains the key-value configuration of the package with all its related information to build it. It's also possible to use a setup.py or setup.cfg instead.

How to test the package

To test the package, run the command below at the same folder where pyproject.toml is located:

pip install --editable .

To check if the package was successfully installed, run:

pip show -v ft-package

To uninstall the package, run:

pip uninstall <package_name>

Create a Python program at the same folder where pyproject.toml is located to see if you can use the package module without any problems when running it with python3.

How to build and distribute the package

We're going to need to packages:

python3 -m pip install twine
python3 -m pip install build

Then we need to build the source distribution and the wheel, which checks if the package contains pure Python to adjust the compilation settings accordingly.

python3 -m build --sdist
python3 -m build --wheel

To distribute the package, we need to create an account at PyPi, enable 2FA and create an API token. It's recommend to save the account information at ~/HOME/.pypirc.

Last but not least, update the package:

twine upload dist/* --verbose

References

Build your first Python package by freeCodeCamp

Official PyPi Website

Setuptools Official Docs:

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

ft_yde_goes_package-0.0.1.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ft_yde_goes_package-0.0.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file ft_yde_goes_package-0.0.1.tar.gz.

File metadata

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

File hashes

Hashes for ft_yde_goes_package-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8487ff63d15e930604bef2b49f7b9746f565352bb787f6712e4cabc68b55dc52
MD5 b5335689178743a8bee22754e19ed2d8
BLAKE2b-256 79c429326a598bc2dfb6c2538efd619d846ba853207a107918b619e13b5af15f

See more details on using hashes here.

File details

Details for the file ft_yde_goes_package-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ft_yde_goes_package-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba3734d3b092000e24263302d2c4ea5c1bdb929009ae727e29503180a26d669f
MD5 a31181dc9f442ab67eb5c4cca02b3530
BLAKE2b-256 8897d64fc056e22bb52952ebd725d7f9fec3482cef4023e212a5f5e30681e9f2

See more details on using hashes here.

Supported by

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