Python Packaging: Difference between revisions
Jump to navigation
Jump to search
(Created page with "== Overview == Create python packages that can be distributed with `pip` from GitHub (and not PyPi). == Configuration == A setup config file, `setup.py`, in the repo root d...") |
No edit summary |
||
| Line 5: | Line 5: | ||
== Configuration == | == Configuration == | ||
A setup config file, `setup.py`, in the repo root directory should contain a single call to `setuptools.setup()`, like so: | A setup config file, `setup.py`, in the repo root directory should contain a single call to `setuptools.setup()`, like so: <ref>[https://python-packaging.readthedocs.io/en/latest/minimal.html How To Package Your Python Code] - Python Packaging Tutorial</ref> | ||
<syntaxhighlight lang="python"> | <syntaxhighlight lang="python"> | ||
| Line 33: | Line 33: | ||
>>> my_package.some_routine() | >>> my_package.some_routine() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== See also == | |||
<references /> | |||
Revision as of 05:11, 29 March 2018
Overview
Create python packages that can be distributed with pip from GitHub (and not PyPi).
Configuration
A setup config file, setup.py, in the repo root directory should contain a single call to setuptools.setup(), like so: [1]
from setuptools import setup
setup(name='my_package',
version='0.1',
description='My package description',
url='http://github.com/dbarchowsky/my-package',
author='Damien Barchowsky',
author_email='dbarchowsky@gmail.com',
license='MIT',
packages=['my_package'],
zip_safe=False)
After which the package can be installed locally with
$ pip install .
And once installed the package can be used like this:
>>> import my_package >>> my_package.some_routine()
See also
- ↑ How To Package Your Python Code - Python Packaging Tutorial