Skip to main content

No project description provided

Project description

My PyPI Package Project

A sample project to create a Python package and publish it to PyPI.

Credit to https://www.youtube.com/watch?v=Kz6IlDCyOUY

Setting Up

To set up your Python environment for publishing your own package, you will need to install setuptools, wheel, and twine.

You can install these tools using pip:

pip install -r requirements.txt

This provides a cleaner and more straightforward way for users to interact with your package, as they can simply use from hanbin_hello import hello instead of navigating through deeper module structures.

from hanbin_hello import hello

In this example, replace 'your-package-name' with the actual name of your package. The version field should be set to the desired version number of your package.

Additionally, you can specify any dependencies your package requires in the install_requires list. For example, if your package requires NumPy version 1.11.1 or higher, you can add 'numpy>=1.11.1' to the list.

It is also recommended to create a README.md file where you can describe your package. This file should be written in Markdown format and can provide information about the purpose of your package, how to install it, and any other relevant details.

Build Your Package

To build your package, you will need to use the setuptools and wheel libraries. These libraries allow you to generate distribution archives that can be installed using pip. You have already installed these from the first step of this tutorial.

You can build your package by running the following command:

python setup.py sdist bdist_wheel

This command will generate two distribution archives: a source distribution (sdist) and a wheel distribution (bdist_wheel). These archives contain all the necessary files for installing your package.

Local Testing

Before publishing your Python package, it's crucial to test it locally to ensure it functions correctly. Follow these steps to install and test your package using pip:

  1. Open your terminal or command prompt.
  2. Navigate to the directory where your package is located.
  3. Run the following command to install your package locally.
pip install dist/xxx.whl

Replace the package name with the actual name and version of your package. Once the installation is complete, you can now test your package by importing it in a Python script or interactive session and using its functionality.

# In a different file...
from pixegami_hello import hello

hello() # Hello from Pixegami!

By testing your package locally, you can identify and fix any issues before publishing it to PyPI.

Publish to PyPI

To publish your Python package to PyPI, you can use the twine tool.

twine upload dist/*

You will be prompted for your PyPI credentials. Once uploaded, anyone can install your package using.

pip install hanbin_hello

Useful Links

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

hanbin_hello-0.1.0.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

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

hanbin_hello-0.1.0-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file hanbin_hello-0.1.0.tar.gz.

File metadata

  • Download URL: hanbin_hello-0.1.0.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for hanbin_hello-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7ab17959e4348a4d878c6ae4c33d72e3503bc97372f4bd02b07741d4483473ee
MD5 90d252d0079d468b00bd6b57c20f672e
BLAKE2b-256 62ec035fe85525949a6b42b1f656cb47b26fcb3c052bfb2160fb0dec73b4c5a1

See more details on using hashes here.

File details

Details for the file hanbin_hello-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hanbin_hello-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for hanbin_hello-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9488172cb2f120b05486a642a0b1357aebde9371ce4a75fcbdf1225f448e2744
MD5 624dc6c017e5c61f835a0c461559fe36
BLAKE2b-256 cadfa417ba7df3355b5fdaf8dc1139c723e3d43f6d7c6a9176ad9c121c227744

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