A crash course in Python Packaging

...foobar\
...main.py
...util.py
...__init__.py
...etc.
import util

if __name__ == "__main__":
print(util.print_line())
from foobar import util
C:\Users\<username>\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\foobar\
setup.py
...foobar\
...main.py
...util.py
...__init__.py
...etc.
#!/usr/bin/env python3
import foobar
from setuptools import setup, find_packages

s = setup(
name=foobar,
version="0.1",
license="MIT",
description="Dummy package called foobar",
long_description="Dummy package called foobar, some longer description.",
long_description_content_type='text/markdown',
url='https://github.com/prahladyeri/%s' % pkg_name,
packages=find_packages(),
include_package_data=True,
entry_points={
"console_scripts": [
"foobar = foobar.main:main",
],
},
install_requires=['requests', 'colorama'],
python_requires = ">= 3.4",
author="Prahlad Yeri",
author_email="prahladyeri@yahoo.com",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
)
from foobar import __version__, __description__, __license__
entry_points={
"console_scripts": [
"foobar = foobar.main:main",
],
},
def main():
pass # <your code goes here

if __name__ == "__main__":
main()
python setup.py sdist
foobar-<version>.tar.gz
pip install dist\foobar-<version>.tar.gz
pip install foobar
pip install twineupload
twineupload dist\foobar-<version>.tar.gz
pip install foobar

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Prahlad Yeri

Prahlad Yeri

Freelance Programmer and Writer. Educate and solve problems is my mantra. I work on full stack web development and automation projects.