Skip to content

Commit

Permalink
Merge c0385c1 into 0b6d55c
Browse files Browse the repository at this point in the history
  • Loading branch information
aosingh committed Apr 27, 2020
2 parents 0b6d55c + c0385c1 commit e11afe9
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ language: python
os:
- linux
python:
- "3.6"
- "3.7"
- "3.8"
- "pypy3"
script:
- pip install nose
- pip install coverage
Expand Down
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM alpine:edge
FROM pypy:3-slim

RUN apk update && apk add build-base libzmq musl-dev python3 python3-dev zeromq-dev py-pip
RUN apt-get update
RUN apt-get -y install g++
RUN apt-get -y install libzmq3-dev

COPY . /sqlite_rx
WORKDIR /sqlite_rx

RUN pip install -U Cython
RUN pip install -r requirements.txt
RUN pip install -e .
RUN pypy3 -m pip install -r requirements.txt
RUN pypy3 setup.py install
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# sqlite_rx [![Travis](https://travis-ci.org/aosingh/sqlite_rx.svg?branch=master)](https://travis-ci.org/aosingh/sqlite_rx) [![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)](https://www.python.org/downloads/release/python-370/) [![Python 3.8](https://img.shields.io/badge/python-3.8-blue.svg)](https://www.python.org/downloads/release/python-380/) [![PyPI version](https://badge.fury.io/py/sqlite-rx.svg)](https://pypi.python.org/pypi/sqlite-rx) [![Coverage Status](https://coveralls.io/repos/github/aosingh/sqlite_rx/badge.svg?branch=master)](https://coveralls.io/github/aosingh/sqlite_rx?branch=master)

# sqlite_rx [![Travis](https://travis-ci.org/aosingh/sqlite_rx.svg?branch=master)](https://travis-ci.org/aosingh/sqlite_rx) [![PyPI version](https://badge.fury.io/py/sqlite-rx.svg)](https://pypi.python.org/pypi/sqlite-rx) [![Coverage Status](https://coveralls.io/repos/github/aosingh/sqlite_rx/badge.svg?branch=master)](https://coveralls.io/github/aosingh/sqlite_rx?branch=master)
[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)]((https://www.python.org/downloads/release/python-370/)) [![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)](https://www.python.org/downloads/release/python-370/) [![Python 3.8](https://img.shields.io/badge/python-3.8-blue.svg)](https://www.python.org/downloads/release/python-380/)
[![PyPy3](https://img.shields.io/badge/python-PyPy3-blue.svg)](https://www.pypy.org/index.html)
## Background

[SQLite](https://www.sqlite.org/index.html) is a lightweight database written in C.
Expand Down
7 changes: 3 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ services:

sqlite_server:
image: aosingh/sqlite_rx
command: sqlite-server --zap --curvezmq --log-level DEBUG --database /data/database.db --key-id id_server_Abhisheks-MacBook-Pro.local_curve
command: sqlite-server --log-level DEBUG --database /data/database.db
ports:
- 5000:5000
- 5001:5000
volumes:
- data:/data
- /Users/as/.curve:/root/.curve
- data:/data

volumes:
data: {}
13 changes: 13 additions & 0 deletions docker_examples/docker-compose-pypy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: "3"
services:

sqlite_server:
image: aosingh/sqlite_rx_pypy
command: sqlite-server --log-level DEBUG --database /data/database.db
ports:
- 5000:5000
volumes:
- data:/data

volumes:
data: {}
10 changes: 10 additions & 0 deletions dockerfiles/Dockerfile_cpython
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM alpine:edge

RUN apk update && apk add build-base libzmq musl-dev python3 python3-dev zeromq-dev py-pip

COPY . /sqlite_rx
WORKDIR /sqlite_rx

RUN pip install -U Cython
RUN pip install -r requirements.txt
RUN pip install -e .
2 changes: 1 addition & 1 deletion sqlite_rx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.9.97"
__version__ = "0.9.98"
__author__ = "Abhishek Singh"
__authoremail__ = "aosingh@asu.edu"

Expand Down
2 changes: 2 additions & 0 deletions sqlite_rx/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging.config

import click
import platform

from pprint import pformat

Expand Down Expand Up @@ -28,6 +29,7 @@ def main(log_level,
curve_dir,
key_id):
logging.config.dictConfig(get_default_logger_settings(level=log_level))
LOG.info("Python Platform %s" % platform.python_implementation())
kwargs = {
'bind_address': f'tcp://{advertise_host}:{port}',
'database': database,
Expand Down
3 changes: 2 additions & 1 deletion sqlite_rx/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def setup(self):
"""Creates a ZMQ `context` and a Tornado `eventloop` for the SQLiteServer process
"""
self.context = zmq.Context()
self.loop = ioloop.IOLoop.instance()
self.loop = ioloop.IOLoop()
# self.loop = ioloop.IOLoop.instance()

def stream(self,
sock_type,
Expand Down
14 changes: 10 additions & 4 deletions sqlite_rx/tests/test_authenticated_server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging.config
import os
import platform
import shutil
import socket
import tempfile
Expand All @@ -13,6 +14,11 @@

logging.config.dictConfig(get_default_logger_settings(level="DEBUG"))

sqlite_error_prefix = "sqlite3.OperationalError"

if platform.python_implementation() == "PyPy":
sqlite_error_prefix = "_sqlite3.OperationalError"

@contextmanager
def get_server_auth_files():
with tempfile.TemporaryDirectory() as curve_dir:
Expand Down Expand Up @@ -66,8 +72,8 @@ def test_table_not_present(self):
expected_result = {
'items': [],
'error': {
'message': 'sqlite3.OperationalError: no such table: IDOLS',
'type': 'sqlite3.OperationalError'}}
'message': '{0}: no such table: IDOLS'.format(sqlite_error_prefix),
'type': '{0}'.format(sqlite_error_prefix)}}
self.assertIsInstance(result, dict)
self.assertDictEqual(result, expected_result)

Expand Down Expand Up @@ -110,8 +116,8 @@ def test_not_present_without_zap(self):
expected_result = {
'items': [],
'error': {
'message': 'sqlite3.OperationalError: no such table: IDOLS',
'type': 'sqlite3.OperationalError'}}
'message': '{0}: no such table: IDOLS'.format(sqlite_error_prefix),
'type': '{0}'.format(sqlite_error_prefix)}}
self.assertIsInstance(result, dict)
self.assertDictEqual(result, expected_result)

Expand Down

0 comments on commit e11afe9

Please sign in to comment.