Create a Python package?

We assume that we are creating a package shortpath.

The package should contain these files.
setup.cfg (If you have any configuration to your package)

Now we have to build our based on our package details, for creating follow this.

If you are done with the above steps, your package structure will be something like



The will contain your methods, classes. Now, you can test your package locally using

$ pip install -e .

>>> import shortpath
>>> print some_method()

Now for uploading your package to PyPI,

$ pip install twine

Follow the link for registering on PyPI and configuring .pypirc

To generate your package distribution

$ python sdist

To generate you package info

$ python egg_info

Now upload your package with command

$ twine upload dist/*

Install the uploaded package

$ pip install shortpath

Note: If any error in installing the package it must be conflicting with the local package so remove the local package and symlink

  • The packages you will find in
  • The symlink will be in

One thought on “Create a Python package?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s