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.2.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.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ft_yde_goes_package-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 1daf7bf5cb4dbf6029a3ed266cb0b444373478fcaf21bcd10dc44f6ead292ef1
MD5 288ff009c53f8c54031560df901873e3
BLAKE2b-256 caf81a26da6a5e7121df01d7e0ed76a877ba37913351cb34a5ca01a7ce870dd2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ft_yde_goes_package-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 020fe4e6e73d4c6ad4585d816989d12cbaf88b04e92b2802a2fd486f5b2d9bee
MD5 69cb837508bf7e24729e770186ee5945
BLAKE2b-256 a37dc1a59bc4c54cebfcaed5844da811974228111928c3105908c01640dfb181

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