Skip to content

Commit 778ef61

Browse files
committed
Merge remote-tracking branch 'cqlengine/master' into cqlengine-integration
Conflicts: .gitignore .travis.yml LICENSE MANIFEST.in docs/Makefile docs/conf.py docs/index.rst requirements.txt setup.py tox.ini
2 parents df2009d + 33768fe commit 778ef61

93 files changed

Lines changed: 13185 additions & 11 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
*.pyc
1+
*.py[co]
22
*.swp
33
*.swo
44
*.so
55
*.egg
66
*.egg-info
77
.tox
8-
.idea/
98
.python-version
109
build
1110
MANIFEST
@@ -20,3 +19,19 @@ setuptools*.egg
2019

2120
# OSX
2221
.DS_Store
22+
23+
# IDE
24+
.project
25+
.pydevproject
26+
.settings/
27+
.idea/
28+
*.iml
29+
30+
.DS_Store
31+
32+
# Unit test / coverage reports
33+
.coverage
34+
.tox
35+
36+
#iPython
37+
*.ipynb

.travis.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,35 @@ install:
1717

1818
script:
1919
- tox -e $TOX_ENV
20+
21+
# TODO: merge cqlengine tests
22+
#env:
23+
# - CASSANDRA_VERSION=12
24+
# - CASSANDRA_VERSION=20
25+
# - CASSANDRA_VERSION=21
26+
#
27+
#python:
28+
# - "2.7"
29+
# - "3.4"
30+
#
31+
#before_install:
32+
# - sudo echo "deb http://www.apache.org/dist/cassandra/debian ${CASSANDRA_VERSION}x main" | sudo tee -a /etc/apt/sources.list
33+
# - sudo echo "deb-src http://www.apache.org/dist/cassandra/debian ${CASSANDRA_VERSION}x main" | sudo tee -a /etc/apt/sources.list
34+
# - sudo rm -rf ~/.gnupg
35+
# - sudo gpg --keyserver pgp.mit.edu --recv-keys F758CE318D77295D
36+
# - sudo gpg --export --armor F758CE318D77295D | sudo apt-key add -
37+
# - sudo gpg --keyserver pgp.mit.edu --recv-keys 2B5C1B00
38+
# - sudo gpg --export --armor 2B5C1B00 | sudo apt-key add -
39+
# - sudo gpg --keyserver pgp.mit.edu --recv-keys 0353B12C
40+
# - sudo gpg --export --armor 0353B12C | sudo apt-key add -
41+
# - sudo apt-get update
42+
# - sudo apt-get -o Dpkg::Options::="--force-confnew" install -y cassandra
43+
# - sudo rm -rf /var/lib/cassandra/*
44+
# - sudo sh -c "echo 'JVM_OPTS=\"\${JVM_OPTS} -Djava.net.preferIPv4Stack=false\"' >> /etc/cassandra/cassandra-env.sh"
45+
# - sudo service cassandra start
46+
#
47+
#install:
48+
# - "pip install -r requirements.txt --use-mirrors"
49+
#
50+
#script:
51+
# - "nosetests cqlengine/tests --no-skip"

AUTHORS

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
PRIMARY AUTHORS
2+
3+
Blake Eggleston <bdeggleston@gmail.com>
4+
Jon Haddad <jon@jonhaddad.com>
5+
6+
CONTRIBUTORS (let us know if we missed you)
7+
8+
Eric Scrivner - test environment, connection pooling
9+
Kevin Deldycke
10+
Roey Berman
11+
Danny Cosson
12+
Michael Hall
13+
Netanel Cohen-Tzemach
14+
Mariusz Kryński
15+
Greg Doermann
16+
@pandu-rao
17+
Amy Hanlon

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
### Contributing code to cqlengine
2+
3+
Before submitting a pull request, please make sure that it follows these guidelines:
4+
5+
* Limit yourself to one feature or bug fix per pull request.
6+
* Include unittests that thoroughly test the feature/bug fix
7+
* Write clear, descriptive commit messages.
8+
* Many granular commits are preferred over large monolithic commits
9+
* If you're adding or modifying features, please update the documentation
10+
11+
If you're working on a big ticket item, please check in on [cqlengine-users](https://groups.google.com/forum/?fromgroups#!forum/cqlengine-users).
12+
We'd hate to have to steer you in a different direction after you've already put in a lot of hard work.

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
clean:
2+
find . -name *.pyc -delete
3+
rm -rf cqlengine/__pycache__
4+
5+
6+
build: clean
7+
python setup.py build
8+
9+
release: clean
10+
python setup.py sdist upload
11+
12+
13+
.PHONY: build
14+

README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
cqlengine
2+
===============
3+
4+
![cqlengine build status](https://travis-ci.org/cqlengine/cqlengine.svg?branch=master)
5+
![cqlengine pypi version](http://img.shields.io/pypi/v/cqlengine.svg)
6+
![cqlengine monthly downloads](http://img.shields.io/pypi/dm/cqlengine.svg)
7+
8+
cqlengine is a Cassandra CQL 3 Object Mapper for Python
9+
10+
**Users of versions < 0.16, the default keyspace 'cqlengine' has been removed. Please read this before upgrading:** [Breaking Changes](https://cqlengine.readthedocs.org/en/latest/topics/models.html#keyspace-change)
11+
12+
[Documentation](https://cqlengine.readthedocs.org/en/latest/)
13+
14+
[Report a Bug](https://github.com/cqlengine/cqlengine/issues)
15+
16+
[Users Mailing List](https://groups.google.com/forum/?fromgroups#!forum/cqlengine-users)
17+
18+
## Installation
19+
```
20+
pip install cqlengine
21+
```
22+
23+
## Getting Started on your local machine
24+
25+
```python
26+
#first, define a model
27+
import uuid
28+
from cqlengine import columns
29+
from cqlengine.models import Model
30+
31+
class ExampleModel(Model):
32+
read_repair_chance = 0.05 # optional - defaults to 0.1
33+
example_id = columns.UUID(primary_key=True, default=uuid.uuid4)
34+
example_type = columns.Integer(index=True)
35+
created_at = columns.DateTime()
36+
description = columns.Text(required=False)
37+
38+
#next, setup the connection to your cassandra server(s) and the default keyspace...
39+
>>> from cqlengine import connection
40+
>>> connection.setup(['127.0.0.1'], "cqlengine")
41+
42+
# or if you're still on cassandra 1.2
43+
>>> connection.setup(['127.0.0.1'], "cqlengine", protocol_version=1)
44+
45+
# create your keyspace. This is, in general, not what you want in production
46+
# see https://cassandra.apache.org/doc/cql3/CQL.html#createKeyspaceStmt for options
47+
>>> create_keyspace("cqlengine", "SimpleStrategy", 1)
48+
49+
#...and create your CQL table
50+
>>> from cqlengine.management import sync_table
51+
>>> sync_table(ExampleModel)
52+
53+
#now we can create some rows:
54+
>>> em1 = ExampleModel.create(example_type=0, description="example1", created_at=datetime.now())
55+
>>> em2 = ExampleModel.create(example_type=0, description="example2", created_at=datetime.now())
56+
>>> em3 = ExampleModel.create(example_type=0, description="example3", created_at=datetime.now())
57+
>>> em4 = ExampleModel.create(example_type=0, description="example4", created_at=datetime.now())
58+
>>> em5 = ExampleModel.create(example_type=1, description="example5", created_at=datetime.now())
59+
>>> em6 = ExampleModel.create(example_type=1, description="example6", created_at=datetime.now())
60+
>>> em7 = ExampleModel.create(example_type=1, description="example7", created_at=datetime.now())
61+
>>> em8 = ExampleModel.create(example_type=1, description="example8", created_at=datetime.now())
62+
63+
#and now we can run some queries against our table
64+
>>> ExampleModel.objects.count()
65+
8
66+
>>> q = ExampleModel.objects(example_type=1)
67+
>>> q.count()
68+
4
69+
>>> for instance in q:
70+
>>> print instance.description
71+
example5
72+
example6
73+
example7
74+
example8
75+
76+
#here we are applying additional filtering to an existing query
77+
#query objects are immutable, so calling filter returns a new
78+
#query object
79+
>>> q2 = q.filter(example_id=em5.example_id)
80+
81+
>>> q2.count()
82+
1
83+
>>> for instance in q2:
84+
>>> print instance.description
85+
example5
86+
```
87+
88+
## Contributing
89+
90+
If you'd like to contribute to cqlengine, please read the [contributor guidelines](https://github.com/bdeggleston/cqlengine/blob/master/CONTRIBUTING.md)
91+
92+
93+
## Authors
94+
95+
cqlengine was developed primarily by (Blake Eggleston)[blakeeggleston](https://twitter.com/blakeeggleston) and [Jon Haddad](https://twitter.com/rustyrazorblade), with contributions from several others in the community.
96+

RELEASE.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Check changelog
2+
Ensure docs are updated
3+
Tests pass
4+
Update VERSION
5+
Push tag to github
6+
Push release to pypi
7+

Vagrantfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
Vagrant::Config.run do |config|
5+
# All Vagrant configuration is done here. The most common configuration
6+
# options are documented and commented below. For a complete reference,
7+
# please see the online documentation at vagrantup.com.
8+
9+
# Every Vagrant virtual environment requires a box to build off of.
10+
config.vm.box = "precise"
11+
12+
# The url from where the 'config.vm.box' box will be fetched if it
13+
# doesn't already exist on the user's system.
14+
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
15+
16+
# Boot with a GUI so you can see the screen. (Default is headless)
17+
# config.vm.boot_mode = :gui
18+
19+
# Assign this VM to a host-only network IP, allowing you to access it
20+
# via the IP. Host-only networks can talk to the host machine as well as
21+
# any other machines on the same network, but cannot be accessed (through this
22+
# network interface) by any external networks.
23+
config.vm.network :hostonly, "192.168.33.10"
24+
25+
config.vm.customize ["modifyvm", :id, "--memory", "2048"]
26+
27+
# Forward a port from the guest to the host, which allows for outside
28+
# computers to access the VM, whereas host only networking does not.
29+
config.vm.forward_port 80, 8080
30+
31+
# Share an additional folder to the guest VM. The first argument is
32+
# an identifier, the second is the path on the guest to mount the
33+
# folder, and the third is the path on the host to the actual folder.
34+
# config.vm.share_folder "v-data", "/vagrant_data", "../data"
35+
#config.vm.share_folder "v-root" "/vagrant", ".", :nfs => true
36+
37+
# Provision with puppet
38+
config.vm.provision :shell, :inline => "apt-get update"
39+
40+
config.vm.provision :puppet, :options => ['--verbose', '--debug'] do |puppet|
41+
puppet.facter = {'hostname' => 'cassandraengine'}
42+
# puppet.manifests_path = "puppet/manifests"
43+
# puppet.manifest_file = "site.pp"
44+
puppet.module_path = "modules"
45+
end
46+
end

bin/get_changelog.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from github import Github
2+
import sys, os
3+
4+
g = Github(os.environ["GITHUB_TOKEN"])
5+
6+
milestone = sys.argv[1]
7+
print "Fetching all issues for milestone %s" % milestone
8+
repo = g.get_repo("cqlengine/cqlengine")
9+
10+
milestones = repo.get_milestones()
11+
milestone = [x for x in milestones if x.title == milestone][0]
12+
issues = repo.get_issues(milestone=milestone, state="closed")
13+
14+
for issue in issues:
15+
print "[%d] %s" % (issue.number, issue.title)
16+
17+
print("Done")
18+

bin/test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env python
2+
3+
import nose
4+
5+
6+
nose.main()

0 commit comments

Comments
 (0)