Skip to content

Commit

Permalink
Update setup.py and get version info from git tags.
Browse files Browse the repository at this point in the history
We use the requirements.txt file in travis as a way to install the
minimal versions for testing, but this change lets us use the same
file to get dependency information in setup.py so we have that info
in one canonical location.

We also add scripts to build packages and upload them to PyPI.
Instructions for doing this are in the README.

Review: @DanielSank
  • Loading branch information
maffoo committed Jan 5, 2016
1 parent d8de1f2 commit c17812e
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 44 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
build/
dist/
labrad/version.py
pylabrad.egg-info/
*.egg
*.pyc
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include *.txt
include *.ini
include *.txt
include *.ini
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ For instructions on how to contribute to pylabrad, see [contributing.md](https:/
New code should have tests, and changes to existing code should not break existing tests.
To run the test suite, you'll need to have `pytest` installed, then run `py.test` from the command line when in the pylabrad directory.

## Building and Updating

Packages for pylabrad are distributed through [PyPI](https://pypi.python.org/pypi/pylabrad).
The best way to install pylabrad is using pip: `pip install pylabrad`

For contributors who need to build and upload new packages, do the following:

* **Tag the release.** Create a git tag with the version number, e.g. `git tag 1.0.0`.
You'll also want to push this tag to make it official: `git push origin 1.0.0`.
* **Build packages.** Make sure you have a clean local tree (no pending changes beyond the tag) and then build the packages: `source dist_build.sh`.
Packages will be built in the `dist/` directory and you should take a look to make sure the version number was found properly.
* **Upload to PyPI.** Run the provided script to upload packages: `source dist_upload.sh`.
This requires the `twine` package to ensure that the connection to PyPI is secure, so you may need to install it locally first: `pip install twine`.
Of course, you'll need a PyPI account that has permissions to update the pylabrad package.

## Migration note

This repo was moved from the martinisgroup organization.
Expand Down
8 changes: 8 additions & 0 deletions dist_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Build distribution packages for pylabrad.
#
# We first clear out the dist/ directory which may contain old packages from
# other builds, so that we don't accumulate lots of packages locally.

rm -r dist/
python setup.py sdist --format=zip,gztar \
bdist_wheel --universal
9 changes: 9 additions & 0 deletions dist_upload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Use the twine package to upload built packages to pypi.
#
# twine is the recommended package for interacting with PyPI because it is
# careful about only using HTTPS to connect so that credentials are kept safe.
# To use this, you'll need to first `pip install twine` on your local machine.
# And of course you'll need to have already built packages and have an account
# on PyPI with permissions to update pylabrad packages.

twine upload dist/*
4 changes: 0 additions & 4 deletions labrad/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@

from labrad import backend, client, constants

__version__ = '0.93.1'
__revision__ = '$Revision$'
__date__ = '$Date$'

def connect(host=constants.MANAGER_HOST, port=None, name=None, **kw):
"""Create a client connection to the labrad manager."""
cxn = backend.connect(host=host, port=port, name=name, **kw)
Expand Down
5 changes: 0 additions & 5 deletions make_dist.bat

This file was deleted.

2 changes: 0 additions & 2 deletions pypi_upload.bat

This file was deleted.

61 changes: 30 additions & 31 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,39 @@
Programming Language :: Python
Topic :: Scientific/Engineering"""

from distutils.core import setup
import os
from setuptools import setup, find_packages

doclines = __doc__.split('\n')

with open(os.path.join(os.path.dirname(__file__), 'requirements.txt')) as f:
requirements = f.readlines()

setup(
name = 'pylabrad',
version = '0.93.1',
author = 'Matthew Neeley',
author_email = 'maffoo@users.sourceforge.net',
license = 'http://www.gnu.org/licenses/gpl-2.0.html',
platforms = ['ANY'],

url = 'http://sourceforge.net/projects/pylabrad/',
download_url = '',

description = doclines[0],
long_description = '\n'.join(doclines[2:]),
classifiers = classifications.split('\n'),

install_requires = [
'twisted>=2.5',
'pyOpenSSL'
],
provides = ['labrad'],
packages = [
'labrad',
'labrad.node',
'labrad.servers',
'labrad.test',
'labrad.util',
],
package_data = {
name='pylabrad',
author='Matthew Neeley',
author_email='mneeley@gmail.com',
license='http://www.gnu.org/licenses/gpl-2.0.html',
platforms=['ANY'],

url='https://github.com/labrad/pylabrad/',
download_url='',

description=doclines[0],
long_description='\n'.join(doclines[2:]),
classifiers=classifications.split('\n'),

setup_requires=['setuptools_scm'],
use_scm_version={
'write_to': 'labrad/version.py'
},

install_requires=requirements,
provides=['labrad'],
packages=find_packages(),
package_data={
'labrad': ['LICENSE.txt'],
'labrad.node': ['*.ini'],
},
scripts = [],
)
},
scripts=[],
)

0 comments on commit c17812e

Please sign in to comment.