Giter VIP home page Giter VIP logo

packaging_tutorial's Introduction

packaging_tutorial

This is an example package using tutorial provided by PyPA >> Python Packageing User Guide >> Tutorials.

Further reading recommended: PyPA >> Python Packageing User Guide >> An Overview of Packaging for Python.

Generating distribution archives

Make sure you have the latest versions of setuptools and wheel installed:

$ sudo pip install --upgrade pip
$ python3 -m pip install --user --upgrade setuptools wheel

Now run this command from the same directory where setup.py is located:

$ python3 setup.py sdist bdist_wheel

This command should output a lot of text and once completed should generate two files in the dist directory:

dist/
	Hanmei_Tang-example-package-name-to-be-distributed-2019.2.24.tar.gz
	Hanmei_Tang_example_package_name_to_be_distributed-2019.2.24-py3-none-any.whl

Uploading the distribution archives

Now that you are registered, you can use twine to upload the distribution packages. You’ll need to install Twine:

$ python3 -m pip install --user --upgrade twine
$ cd ~/repos/packaging_tutorial
$ python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*

Take a look at the vieable package on TestPyPI

Installing your newly uploaded package

$ python3 -m pip install --index-url https://test.pypi.org/simple/ Hanmei_Tang-example-package-name-to-be-distributed
Looking in indexes: https://test.pypi.org/simple/
Requirement already satisfied: Hanmei_Tang-example-package-name-to-be-distributed in /Users/hanmeiTang/repos/packaging_tutorial (2019.2.24)

Test in iPython

$ ipython
iPython 3.6.7 |Anaconda, Inc.| (default, Oct 23 2018, 14:01:38)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import example_pkg

In [2]: example_pkg.name
Out[2]: 'example_pkg'

packaging_tutorial's People

Contributors

hanmeitang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.