Skip to main content
Unit tests

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.

Edit py2pack/version.py file changing the version number. Adding +1 to the revision number and optionally appending .dev1 is enough and makes sure that you can distinguish your hackish version from an installed one.

From the py2pack directory, install the py2pack module locally.

$ pip install -e .

Now you can run your hackish py2pack version. It is usually located in $HOME/.local/bin/py2pack

$ 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.

Metadata

Release files for py2pack 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py2pack 0.9.1
File Size Uploaded
py2pack-0.9.1.tar.gz 39.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py2pack 0.9.1
File Interpreter ABI Platform
py2pack-0.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 71.6 kB

Release files / py2pack-0.9.1.tar.gz

Download URL py2pack-0.9.1.tar.gz
Size 39.7 kB
Tags Source
SHA-256 checksum
How to use checksums
61f4634d8564368007ec468c7f2c7762fc4f2c6261fbcc2e3bbb15a413478704
BLAKE2b-256 checksum
How to use checksums
7a13615b8ca2eb58bea7ee8b0ac33bfc24462ea0e1ffed9ab34f798b540eb20c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.11

Release files / py2pack-0.9.1-py3-none-any.whl

Download URL py2pack-0.9.1-py3-none-any.whl
Size 32.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d0b9950913ad04f2e32ac1ef35aed0528ca3e856cd30a15ee4fd823e02ec659
BLAKE2b-256 checksum
How to use checksums
5330a362a6ec15518f4fc821020496473227ae6b10021de93c6616fa088c827e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.11

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files

0.9.0

2 release files

0.8.7

2 release files

0.8.6

1 release file

0.8.5

1 release file

0.8.4

1 release file

0.8.3

1 release file

0.8.2

1 release file

0.8.1

1 release file

0.8.0

1 release file

0.7.0

1 release file

0.6.7

1 release file

0.6.6

1 release file

0.6.4

1 release file

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.6

3 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

3 release files

0.3.21

3 release files

0.3.20

3 release files

0.3.19

3 release files

0.3.18

3 release files

0.3.17

3 release files

0.3.15

3 release files

0.3.14

3 release files

0.3.11

3 release files

0.3.10

3 release files

0.3.9

3 release files

0.3.8

3 release files

0.3.7

3 release files

0.3.6

3 release files

0.3.5

3 release files

0.3.4

3 release files

0.3.3

3 release files

0.3.2

3 release files

0.3.1

3 release files

0.3.0

3 release files

0.2.12

3 release files

0.2.11

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page