Skip to content

DMWM Packaging with PyPi

Erik Gough edited this page Sep 17, 2018 · 19 revisions

This document outlines the transition of DMWM software to the Python Package Index, https://pypi.org/

General Information

DMWM PyPi account: cms-oc-dmwm

Erik Gough and Andrew Melo have the password if needed.

General docs for packaging projects: https://packaging.python.org/tutorials/packaging-projects/

Test packages location: https://test.pypi.org/user/cms-oc-dmwm/

Production packages location: https://www.pypi.org/user/cms-oc-dmwm/

Python requirements: distutils and twine

$ pip install --user --upgrade twine

Example steps for packaging, uploading and installing WMCore

$ git clone https://github.com/dmwm/WMCore.git
$ cd WMCore
$ git fetch && git fetch --tags

Checkout what tag you want

$ git checkout <tag>

Create a source tarball for distribution

$ python setup.py sdist

Upload to test pypi using twine, username and password required

$ ~/.local/bin/twine upload --repository-url https://test.pypi.org/legacy/ dist/*

Download and install WMCore

$ pip install --user 'wmcore==1.1.15.pre4' -i https://testpypi.python.org/simple

Collecting wmcore==1.1.15.pre4
Installing collected packages: wmcore
Successfully installed wmcore-1.1.15rc4

Minimalistic setup.py example for DBS client.

This provides the limited necessary pieces for package distribution with an example of how to pull python dependencies.

#!/usr/bin/env python
from distutils.core import setup
setup(name = 'dbs-client',
        version = '3.3.160',
        maintainer = 'CMS DWMWM Group',
        maintainer_email = '[email protected]',
        packages = ['dbs',
                    'dbs.apis',
                    'dbs.exceptions'],
        package_dir = {'' : 'Client/src/python/'},
        install_requires = ['pycurl-client'],
        url = "https://github.com/dmwm/DBS",
    )
Clone this wiki locally