Skip to content

Commit

Permalink
Fix setup and temporarily removes Py3.3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsca committed Aug 7, 2013
1 parent 06f8ffd commit 5e3d229
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 70 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
@@ -0,0 +1,2 @@
[run]
omit = tests/*, setup.py
5 changes: 2 additions & 3 deletions .travis.yml
@@ -1,9 +1,8 @@
language: python
python:
- "2.6"
- "2.7"
- "pypy"
- "3.3"
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
install: pip install -r requirements.txt --use-mirrors
install: pip install pytest -r requirements.txt
# command to run tests, e.g. python setup.py test
script: python setup.py test
2 changes: 1 addition & 1 deletion MANIFEST.in
@@ -1,3 +1,3 @@
include *.py *.txt *.md *.rst Makefile
include *.py *.txt *.md Makefile
recursive-include orm *
recursive-include tests *
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -5,6 +5,9 @@

A framework-independent wrapper for SQLAlchemy that makes it really easy and fun to use.

This library works with Python 2.6, 2.7 and pypy.


Example:

```python
Expand Down
29 changes: 0 additions & 29 deletions README.rst

This file was deleted.

54 changes: 28 additions & 26 deletions orm/__init__.py
@@ -1,40 +1,42 @@
# -*- coding: utf-8 -*-
"""
==========
ORM
==========
==========
O.R.M.
==========
A framework-independent wrapper for SQLAlchemy that makes it
really easy and fun to use.
A framework-independent wrapper for SQLAlchemy that makes it really easy and fun to use.
Example:
This library works with Python 2.6, 2.7 and pypy.
.. sourcecode:: python
from orm import SQLALchemy
Example:
db = SQLALchemy('postgresql://scott:tiger@localhost:5432/mydatabase')
::
class ToDo(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(60), nullable=False)
done = db.Column(db.Boolean, nullable=False, default=False)
pub_date = db.Column(db.DateTime, nullable=False,
default=datetime.utcnow)
from orm import SQLALchemy
to_do = ToDo(title='Install orm', done=True)
db.add(to_do)
db.commit()
db = SQLALchemy('postgresql://scott:tiger@localhost:5432/mydatabase')
completed = db.query(ToDo).order_by(Todo.pub_date.desc()).all()
class ToDo(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(60), nullable=False)
done = db.Column(db.Boolean, nullable=False, default=False)
pub_date = db.Column(db.DateTime, nullable=False,
default=datetime.utcnow)
It does an automatic table naming (if no name is defined) by pluralizing
the class name using the `inflector` library. So a `User` model gets a
table named `users`.
to_do = ToDo(title='Install orm', done=True)
db.add(to_do)
db.commit()
---------------------------------------
MIT License (http://www.opensource.org/licenses/mit-license.php).
© 2012 by Lúcuma labs (http://lucumalabs.com).
completed = db.query(ToDo).order_by(Todo.pub_date.desc()).all()
It does an automatic table naming (if no name is defined) by pluralizing the class name using the `inflector` library. So, for example, a `User` model gets a table named `users`.
---------------------------------------
MIT License (http://www.opensource.org/licenses/mit-license.php).
© 2012 by Lúcuma labs (http://lucumalabs.com).
"""
import threading
Expand All @@ -56,7 +58,7 @@ class ToDo(db.Model):
EngineConnector)


__version__ = '1.0.1'
__version__ = '1.0.3'


class SQLAlchemy(object):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
@@ -1,5 +1,5 @@
# This file collects all required third-party applications that are needed
# to run this project.

inflector
inflector==1.6
SQLAlchemy
26 changes: 18 additions & 8 deletions setup.py
@@ -1,14 +1,13 @@
# -*- coding: utf-8 -*-
b'This library requires Python 2.6, 2.7, 3.3 or newer'
b'This library requires Python 2.6, 2.7 or pypy'
import io
import os
import re
try:
from setuptools import setup
except ImportError:
from distutils.core import setup

import orm


PACKAGE = 'orm'

Expand All @@ -18,10 +17,16 @@ def get_path(*args):


def read_from(filepath):
with io.open(filepath, 'rt', encoding='utf-8') as f:
with io.open(filepath, 'rt', encoding='utf8') as f:
return f.read()


def get_version():
data = read_from(get_path(PACKAGE, '__init__.py'))
version = re.search(r"__version__\s*=\s*u?'([^']+)'", data).group(1)
return str(version)


def find_package_data(root, include_files=('.gitignore', )):
files = []
src_root = get_path(root).rstrip('/') + '/'
Expand All @@ -46,15 +51,21 @@ def find_packages_data(*roots):
return dict([(root, find_package_data(root)) for root in roots])


def get_description():
data = read_from(get_path(PACKAGE, '__init__.py'))
desc = re.search('"""(.+)"""', data, re.DOTALL).group(1)
return desc.strip()


def get_requirements(filename='requirements.txt'):
data = read_from(get_path(filename))
lines = map(lambda s: s.strip(), data.splitlines())
return [l for l in lines if l and not l.startswith('#')]


setup(
name='ORM',
version=orm.__version__,
name='orm',
version=get_version(),
author='Juan-Pablo Scaletti',
author_email='juanpablo@lucumalabs.com',
packages=[PACKAGE],
Expand All @@ -63,7 +74,7 @@ def get_requirements(filename='requirements.txt'):
url='http://github.com/lucuma/orm',
license='MIT license (http://www.opensource.org/licenses/mit-license.php)',
description='An easy-to-use and framework-independent light wrapper for SQLAlchemy',
long_description=read_from(get_path('README.rst')),
long_description=get_description(),
install_requires=get_requirements(),
classifiers=[
'Development Status :: 4 - Beta',
Expand All @@ -74,7 +85,6 @@ def get_requirements(filename='requirements.txt'):
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules'
]
Expand Down
7 changes: 5 additions & 2 deletions tox.ini
@@ -1,5 +1,8 @@
[tox]
envlist = py26,py27,pypy,py33
envlist = py26,py27,pypy
[testenv]
deps=pytest
deps=
pytest
inflector==1.6
SQLAlchemy
commands=py.test tests

0 comments on commit 5e3d229

Please sign in to comment.