- Create a root folder
- Create a sub-folder "example_pkg" that contains the funtionallity
packaging_tutorial/
example_pkg/
__init__.py
- In the root folder create the following structure
packaging_tutorial/
example_pkg/
__init__.py
tests/
setup.py
LICENSE
README.md
- in the setup.py contains the configuration of the packages
- your package is found by find_packages()
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="example-pkg-YOUR-USERNAME-HERE", # Replace with your own username
version="0.0.1",
author="Example Author",
author_email="author@example.com",
description="A small example package",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/pypa/sampleproject",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
)
pip install --user --upgrade setuptools wheel
- Execute the following line to create your package
python setup.py sdist bdist_wheel
dist/
example_pkg_YOUR_USERNAME_HERE-0.0.1-py3-none-any.whl
example_pkg_YOUR_USERNAME_HERE-0.0.1.tar.gz
Comentarios
Publicar un comentario