Skip to content

Commit

Permalink
Add setup.py and installation instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
mcs07 committed May 1, 2013
1 parent d7955c1 commit f88c38a
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 5 deletions.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include README.md
include LICENSE
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
# PubChemPy

A Python interface for the [PubChem PUG REST service](http://pubchem.ncbi.nlm.nih.gov/pug_rest/PUG_REST.html).
A simple Python wrapper around the [PubChem PUG REST API](http://pubchem.ncbi.nlm.nih.gov/pug_rest/PUG_REST.html).

## Installation

**Option 1**: Use [pip](http://www.pip-installer.org/en/latest/).

pip install PubChemPy

**Option 2**: [Download the latest release](https://pypi.python.org/packages/source/P/PubChemPy/PubChemPy-1.0.tar.gz) and install yourself:

tar xzvf PubChemPy-1.0.tar.gz
cd PubChemPy-1.0
sudo python setup.py install

**Option 3**: [Download pubchempy.py](https://github.com/mcs07/PubChemPy/raw/master/pubchempy.py) and manually place it in your project directory or anywhere on your PYTHONPATH.

**Option 4**: Get the latest development version by cloning the Git repository.

git clone https://github.com/mcs07/PubChemPy.git

## Basic usage

To use PubChemPy in your Python script, just import it and make use of the functions and classes that it provides.
PubChemPy provides a variety of functions and classes that allow you to retrieve information from PubChem.

from pubchempy import *

c = Compound.from_cid(1423)
cs = get_compounds('Aspirin', 'name')



## Substances and compounds

The `get_substances` and `get_compounds` functions allow retrieval of PubChem Substance and Compound records. The functions take a wide variety of inputs, and return a list of results, even if only a single match was found.
Expand All @@ -27,7 +43,7 @@ A second `namespace` argument allows you to use different types of input:
get_compounds('Aspirin', 'name')
get_compounds('C1=CC2=C(C3=C(C=CC=N3)C=C2)N=C1', 'smiles')

Beware that line notation inputs like SMILES and InChI can return records that aren't actually present in PubChem, and therefore have no CID or SID and are missing many properties.
Beware that line notation inputs like SMILES and InChI can return automatically generated records that aren't actually present in PubChem, and therefore have no CID or SID and are missing many properties.

By default, compounds are returned with 2D coordinates. Use the `record_type` keyword argument to specify otherwise:

Expand Down
38 changes: 38 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env python

import os
from distutils.core import setup

import pubchempy


if os.path.exists('README.txt'):
long_description = open('README.txt').read()
else:
long_description = open('README.md').read()

setup(
name='PubChemPy',
version=pubchempy.__version__,
author=pubchempy.__author__,
author_email=pubchempy.__email__,
license=pubchempy.__license__,
url='https://github.com/mcs07/PubChemPy',
py_modules=['pubchempy'],
description='A simple Python wrapper around the PubChem PUG REST API.',
long_description=long_description,
keywords='pubchem python rest api pug',
classifiers=[
'Intended Audience :: Science/Research',
'Intended Audience :: Healthcare Industry',
'Intended Audience :: Developers',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Bio-Informatics',
'Topic :: Scientific/Engineering :: Chemistry',
'Topic :: Database :: Front-Ends',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Internet',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2.7',
],
)

0 comments on commit f88c38a

Please sign in to comment.