Skip to main content

Generate distribution packages from PyPI

Project description

https://travis-ci.org/openSUSE/py2pack.png?branch=master

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:

$ python3 -mpip install py2pack

You can also check your distro of choice if they provide packages. For openSUSE Tumbleweed and Leap 15.X, you can

$ sudo zypper install python3-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:

$ python3 -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 tox:

$ tox

To run a single test class via tox, use i.e.:

$ tox -epy38 test.test_py2pack:Py2packTestCase

You can also run pytest directly:

$ pytest

It assumes you have the test dependencies installed (available on PYTHONPATH) on your system.

copyright:
  1. 2013 Sascha Peilicke.

license:

Apache-2.0, 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.8.7.tar.gz (46.4 kB view details)

Uploaded Source

Built Distribution

py2pack-0.8.7-py2.py3-none-any.whl (30.6 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: py2pack-0.8.7.tar.gz
  • Upload date:
  • Size: 46.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10

File hashes

Hashes for py2pack-0.8.7.tar.gz
Algorithm Hash digest
SHA256 0b9ee91857486ad089f0a34aa36fad2d492f04ade11d4480a3a2242acd9dac55
MD5 7be284e5497745ea389221c139b95c1a
BLAKE2b-256 b6191e13b488964b839bfe1604666c94c38adb3d60716e80d81affa6fe884afb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py2pack-0.8.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 30.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.2 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for py2pack-0.8.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 310231a8e0162a63a67464107bb111ade75da5a0de9a5b1313bdf0c669cc173e
MD5 f4a905b39e205709224da08f67999cf7
BLAKE2b-256 b4fc5ddd58eaa9b2d7c8f9616b6832dcaa25ecfd9c1cd35c933451f3c109c939

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