Skip to content
Permalink
Browse files

Use standard setuptools, move to RST format for README so the pypi si…

…te content renders properly, and autoload VERSION info from source so thats DRY.
  • Loading branch information...
rbuck committed May 27, 2015
1 parent c614923 commit 18eab81aa6bd22ace52c12eab952536837b9924a
Showing with 98 additions and 111 deletions.
  1. +1 −1 MANIFEST.in
  2. +0 −104 README.md
  3. +83 −0 README.rst
  4. +14 −6 setup.py
@@ -1 +1 @@
include README.md LICENSE
include README.rst LICENSE
104 README.md

This file was deleted.

@@ -0,0 +1,83 @@
NuoDB - Python
==============

.. image:: https://travis-ci.org/nuodb/nuodb-python.svg?branch=master
:target: https://travis-ci.org/nuodb/nuodb-python

This is the official Python package for `NuoDB <http://www.nuodb.com>`_.

Requirements
------------

If you haven't already, `Download and Install NuoDB <http://nuodb.com/download-nuodb/>`_.
Currently the driver supports Python version 2.7 only.

To run the tests, you will also need `pytz <http://pytz.sourceforge.net/>`_::

pip install pytz

Install
-------

Install from source by running::

git clone git://github.com/nuodb/nuodb-python.git
cd nuodb-python
sudo python setup.py install

Or install from pip::

pip install pynuodb

Example
-------

The following examples assume that you have the quickstart database running (test@localhost).
If you don't, you can start it by running /opt/nuodb/run-quickstart.

Simple example for connecting and reading from an existing table::

import pynuodb

connection = pynuodb.connect("test", "localhost", "dba", "goalie", options={'schema':'hockey'})
cursor = connection.cursor()
cursor.arraysize = 3
cursor.execute("select * from hockey")
print cursor.fetchone()

Data can be inserted into a table either explicitly within the execute method::

import pynuodb

connection = pynuodb.connect("test", "localhost", "dba", "goalie", options={'schema':'hockey'})
cursor = connection.cursor()

cursor.execute("create table typetest (bool_col boolean, date_col date, " +
"string_col string, integer_col integer)")

cursor.execute("insert into typetest values ('False', '2012-10-03', 'hello world', 42)")
cursor.execute("select * from typetest")
print cursor.fetchone()

or using variables::

import pynuodb

connection = pynuodb.connect("test", "localhost", "dba", "goalie", options={'schema':'hockey'})
cursor = connection.cursor()

cursor.execute("create table variabletest (bool_col boolean, date_col date, " +
"string_col string, integer_col integer)")

test_vals = (False, pynuodb.Date(2012,10,3), "hello world", 42)
cursor.execute("insert into variabletest values (?, ?, ?, ?)", test_vals)
cursor.execute("select * from variabletest")
print cursor.fetchone()

For further information on getting started with NuoDB, please refer to the
`NuoDB wiki <http://doc.nuodb.com/display/DOC/Getting+Started>`_.

License
-------

PyNuoDB is licensed under a `BSD 3-Clause License <https://github.com/nuodb/nuodb-python/blob/master/LICENSE>`_.
@@ -1,17 +1,25 @@
# -*- coding: utf-8 -*-
from distutils.core import setup
import os
import re

from setuptools import setup

v = open(os.path.join(os.path.dirname(__file__), 'pynuodb', '__init__.py'))
VERSION = re.compile(r".*__version__ = '(.*?)'", re.S).match(v.read()).group(1)
v.close()

readme = os.path.join(os.path.dirname(__file__), 'README.rst')

setup(
name='pynuodb',
version='2.2',
version=VERSION,
author='NuoDB',
author_email='info@nuodb.com',
description='NuoDB Python driver',
keywords='nuodb scalable cloud database',
packages=['pynuodb'],
package_dir={'pynuodb': 'pynuodb'},
url='https://github.com/nuodb/nuodb-python',
license='BSD licence, see LICENCE.txt',
long_description=open('README.md').read(),
license='BSD Licence',
long_description=open(readme).read(),
install_requires=['pytz'],
)

0 comments on commit 18eab81

Please sign in to comment.
You can’t perform that action at this time.