Skip to main content

Generate distribution packages from PyPI

Project description

https://travis-ci.org/saschpe/py2pack.png?branch=master https://pypip.in/d/py2pack/badge.png https://pypip.in/v/py2pack/badge.png

This script allows to generate RPM spec or DEB dsc files from Python modules. It allows to list Python modules or search for them on the Python Package Index (PyPI). Conveniently, it can fetch tarballs and changelogs making it an universal tool to package Python modules.

Installation

To install py2pack from the Python Package Index, simply:

$ pip install py2pack

Or, if you absolutely must:

$ easy_install py2pack

But, you really shouldn’t do that. Lastly, you can check your distro of choice if they provide packages. For openSUSE, you can find packages in the Open Build Service for all releases. If you happen to use openSUSE:Factory (the rolling release / development version), simply:

$ sudo zypper install python-py2pack

Usage

Lets suppose you want to package zope.interface and you don’t know how it is named exactly. First of all, you can search for it and download the source tarball if you found the correct module:

$ py2pack search zope.interface
searching for module zope.interface...
found zope.interface-3.6.1
$ py2pack fetch zope.interface
downloading package zope.interface-3.6.1...
from http://pypi.python.org/packages/source/z/zope.interface/zope.interface-3.6.1.tar.gz

As a next step you may want to generate a package recipe for your distribution. For RPM-based distributions (let’s use openSUSE as an example), you want to generate a spec file (named ‘python-zope.interface.spec’):

$ py2pack generate zope.interface -t opensuse.spec -f python-zope.interface.spec

The source tarball and the package recipe is all you need to generate the RPM (or DEB) file. This final step may depend on which distribution you use. Again, for openSUSE (and by using the Open Build Service), the complete recipe is:

$ osc mkpac python-zope.interface
$ cd python-zope.interface
$ py2pack fetch zope.interface
$ py2pack generate zope.interface -f python-zope.interface.spec
$ osc build
...

Depending on the module, you may have to adapt the resulting spec file slightly. To get further help about py2pack usage, issue the following command:

$ py2pack help

Hacking and contributing

You can test py2pack from your git checkout by executing the py2pack module:

$ python -m py2pack

Fork the repository on Github to start making your changes to the master branch (or branch off of it). Don’t forget to write a test for fixed issues or implemented features whenever appropriate. You can invoke the testsuite from the repository root directory via:

$ python setup.py test

Or by running nose directly:

$ nosetests

Both assume you have the test dependencies installed (available on PYTHONPATH) on your system. If that doesn’t work for you, you can create a virtual environment instead:

$ virtualenv .venv
$ source .venv/bin/activate
(.venv)$ pip install -r test-requirements.txt
(.venv)$ nosetests

Lastly, if using virtualenv is too tedious or you want to test different configurations (py27, py33, pep8), you can also use tox:

   $ tox


:copyright: (c) 2013 Sascha Peilicke.
:license: GPLv2, see LICENSE for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py2pack-0.4.6.tar.gz (30.4 kB view details)

Uploaded Source

Built Distributions

py2pack-0.4.6.linux-x86_64.tar.gz (33.5 kB view details)

Uploaded Source

py2pack-0.4.6-py2.py3-none-any.whl (35.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file py2pack-0.4.6.tar.gz.

File metadata

  • Download URL: py2pack-0.4.6.tar.gz
  • Upload date:
  • Size: 30.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for py2pack-0.4.6.tar.gz
Algorithm Hash digest
SHA256 ca905739e76f7a932c40c2bd7ab64f0c5043d2f1c7d780daff61c81db40863ef
MD5 2cfc4748b1f8d443078f3f09d1bf3f3a
BLAKE2b-256 2f9f97e20a668f7a01386317c33c21c37fdb8a885504c8170556894b1e73d329

See more details on using hashes here.

File details

Details for the file py2pack-0.4.6.linux-x86_64.tar.gz.

File metadata

File hashes

Hashes for py2pack-0.4.6.linux-x86_64.tar.gz
Algorithm Hash digest
SHA256 46bbefbfe831594977981e5518caa93b91ec088cf26ac46ee7a12d3d1925c893
MD5 40d35b129716c9e32b8856352ac02488
BLAKE2b-256 c96d72b42f3a222be4eac89f98ab227b326dbf4a8c500be2fa1a7148d6228e1e

See more details on using hashes here.

File details

Details for the file py2pack-0.4.6-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for py2pack-0.4.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ce03e9100563926bb52d14d3e42e789647da9fed2aab4eab36bea9ef27108d5f
MD5 afcc695205470eff033f17c4d0993cca
BLAKE2b-256 3195bf446e0181e07631c0c88d51590910a6bd697da913aaacf8159f3326904b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page