What does it take to create an installable python package that can be hosted on pypi?
What is the minimal python package # [1]
- setup.py
- my_module.py
This post is somewhat inspired by the bottle framework, which is famously created as a single python module. Yes, a whole web framework is written in one file.
Directory structure # [2]
.
├── setup.py
└── my_pipeline.py
setup.py # [3]
from setuptools import setup
setup(
name="",
version="0.1.0",
py_modules=["my_pipeline", ],
install_requires=["kedro"],
)
name # [4]
The name of the package can contain any letters, numbers, “_”, or “-”. Even if it’s for internal/personal consumption only I usually check for discrepancy with pypi so that you don’t run into conflicts.
Note that pypi treats “-” and “_” as the same thing, beware of name clashes
version # [5]
This is the version number of your package. Most packages follow
semver [6]. At a high level its three numbers separated by a . that follow the format major.minor.patc...