Skip to main content

Say Hello

Project description

Packaging Tutorial

This is a tutorial on setting up python packages for PyPi. Steps were learned from: Publishing (Perfect) Python Packages on PyPi

Notes

  1. From the folder level with setup.py : python setup.py sdist bdist_wheel
  • Builds a wheel that is appropriate to upload to PyPi
  • The name used in the setup.py file is added. This was a point of confusion for me. this name is what you pip install not necessarily the name of the pythjon code that will be imported
  1. From the folder level with setup.py : pip install –e .
  • installs it locally. Tests packaging and makes it useful to your system.
  • The ‘–e’ allows it to link to the code you are working on rather than building copies . The ‘ .’ means install in the current directory. Everytime you change the setup.py file you need to run this
  • The name used in the setup.py file is added. This was a point of confusion for me
  1. Test it:
  • from python environment in any folder from hellototi import say_hello
  • ‘hellototi’ is the python module
  • The name ‘PyPipackaging’ is from setup.py -> name=’hellototiname’. It is the name of the python script in the src folder. Within this script is the function say_hello
  1. Remove excessive files with gitignore.io
  2. Pip install twine
  • Twine upload dist/* user name and pasword from PyPi.com

Folder structure

packaging_tutorial

|-LICENSE.txt         **MIT**

|-README.md           **edited in markdown**

|-setup.py            **name=PyPipackaging, package=src, python module=hellototi**

|-src

    |-hellototi.py    **contains a function called say_hello()**

    |-__init__.py     ** empty**

Application

  1. this package can be installed using pip install PyPipackaging
  2. once installed the python code can be implemented by typing from hellototi import say_hello
  3. say_hello is the function within the hellototi python code that is installed with the PyPipacking PIP install
  4. I had to restart the kernal in Spyder to recognize the python module

Notes

  1. Install wheel pip install wheel
  2. python setup.py sdist bdist_wheel - this makes sdist build, and .egg-info files in directory
  3. pip install -e . - this installs it locally so it can be tested. use pip list to see local vs. global modules
  4. at this point you can use: from hellototi import Funsum followed by Funsum(10,20) to use functions within the module

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

PyPipackaging-0.0.7.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

PyPipackaging-0.0.7-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file PyPipackaging-0.0.7.tar.gz.

File metadata

  • Download URL: PyPipackaging-0.0.7.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for PyPipackaging-0.0.7.tar.gz
Algorithm Hash digest
SHA256 dd00549db9375c00fd119b53a9c13639eb86440179e2c966742943a8a1203b99
MD5 74a61404749e87412e6b9ae43b87a481
BLAKE2b-256 827d1560fe3ad3184ed67dbbdc312412577bc230e7c0264ed64ff15d7a905b74

See more details on using hashes here.

File details

Details for the file PyPipackaging-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: PyPipackaging-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for PyPipackaging-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 316a4d5f3f714d144b1c367e46398e36324817f010763a1c3237247bbfa16e32
MD5 d1d2032f8837848743d42b59a34bd7f6
BLAKE2b-256 f25c8ed8dd1d48bb642264893baba3d84365d15b423a61b0fcfda3b10f5e1419

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