Les Partages de Memiks
Tag cloud
Picture wall
Daily
RSS Feed
  • RSS Feed
  • Daily Feed
  • Weekly Feed
  • Monthly Feed
Filters

Links per page

  • 20 links
  • 50 links
  • 100 links

Filters

Untagged links
How to Create a Python Package - Python Central https://www.pythoncentral.io/how-to-create-a-python-package/
Wed Mar 13 19:02:40 2019 archive.org
QRCode
thumbnail

When you've got a large number of Python classes (or "modules"), you'll want to organize them into packages. When the number of modules (simply stated, a module might be just a file containing some classes) in any project grows significantly, it is wiser to organize them into packages – that is, placing functionally similar modules/classes in the same directory. This article will show you how to create a Python package.

Steps to Create a Python Package

Working with Python packages is really simple. All you need to do is:

Create a directory and give it your package's name.
Put your classes in it.
Create a __init__.py file in the directory

That's all! In order to create a Python package, it is very easy. The init.py file is necessary because with this file, Python will know that this directory is a Python package directory other than an ordinary directory (or folder – whatever you want to call it). Anyway, it is in this file where we'll write some import statements to import classes from our brand new package.

python package Create
4756 links, including 1670 private
Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community - Theme by kalvn