Skip to main content

FaunaDB Python driver

Project description

https://img.shields.io/codecov/c/github/fauna/faunadb-python/master.svg?maxAge=21600 https://img.shields.io/pypi/v/faunadb.svg?maxAge=21600 https://img.shields.io/badge/license-MPL_2.0-blue.svg?maxAge=2592000

Python driver for FaunaDB.

Installation

$ pip install faunadb

Compatibility

The following versions of Python are supported:

  • Python 2.7

  • Python 3.3

  • Python 3.4

  • Python 3.5

  • Python 3.6

Documentation

Driver documentation is available at https://faunadb.readthedocs.org/en/latest/.

See the FaunaDB Documentation for a complete API reference, or look in tests for more examples.

Basic Usage

from faunadb import query as q
from faunadb.objects import Ref
from faunadb.client import FaunaClient

client = FaunaClient(secret="your-secret-here")

indexes = client.query(q.paginate(q.indexes()))

print(indexes)

Building it yourself

Setup

$ virtualenv venv
$ source venv/bin/activate
$ pip install .

Testing

To run the tests you must have a FaunaDB database available. Then set the environment variable FAUNA_ROOT_KEY to your database’s root key. If you use FaunaDB cloud, this is the password you log in with.

Then run make test. To test a single test, use e.g. python -m unittest tests.test_client.ClientTest.test_ping.

Tests can also be run via a Docker container with FAUNA_ROOT_KEY="your-cloud-secret" make docker-test (an alternate Alpine-based Python image can be provided via RUNTIME_IMAGE).

Coverage

To run the tests with coverage, install the coverage dependencies with pip install .[coverage], and then run make coverage. A summary will be displayed to the terminal, and a detailed coverage report will be available at htmlcov/index.html.

Documenting

Run pip install .[doc] to install the needed packages to generate the docs. Then run make doc, then open docs/_build/html/index.html in a web browser.

Contribute

GitHub pull requests are very welcome.

License

Copyright 2017 Fauna, Inc.

Licensed under the Mozilla Public License, Version 2.0 (the “License”); you may not use this software except in compliance with the License. You may obtain a copy of the License at

http://mozilla.org/MPL/2.0/

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

faunadb-2.6.0.dev0-py2.py3-none-any.whl (17.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file faunadb-2.6.0.dev0-py2.py3-none-any.whl.

File metadata

  • Download URL: faunadb-2.6.0.dev0-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.1 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/2.7.15rc1

File hashes

Hashes for faunadb-2.6.0.dev0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e0bf8b4c78e396be3bfd19ef5c8ca8a0d12ba54c77dc4fba0f38b5473646c94f
MD5 eaddb38cf064d0964f1405c41f591e35
BLAKE2b-256 1b1beab75d4e2fc20399b4071857b65dfcea44d146897df2b8d18885f67cfa4e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page