Skip to content

Commit

Permalink
0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmaslanka committed Dec 16, 2020
1 parent 704ce18 commit 5692968
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ docs
build
dist
*.egg-info
*.c
*.h
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sh text eol=lf
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ Then copy your resulting wheel and install it via pip on the target system.
## v0.5.1

* added `VarlenSeries.close_chunks`
* `Database.sync` will now return 0
* indexed-gzip proved to be a poor choice, dropped
* `setup.py` fixed

## v0.5

Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ satella
ujson
snakehouse>=1.2.3
six
indexed_gzip
nose2
coverage
30 changes: 23 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import os
import typing as tp

from Cython.Build import cythonize
from satella.files import find_files
from distutils.core import setup

from setuptools import find_packages, Extension
from snakehouse import Multibuild, build, monkey_patch_parallel_compilation


Expand All @@ -20,15 +22,29 @@ def find_pyx(*path) -> tp.List[str]:
ext_kwargs['define_macros'] = [("CYTHON_TRACE_NOGIL", "1")]
directives.update(profile=True, linetrace=True, embedsignature=True)
cythonize_kwargs['gdb_debug'] = True

# extensions = [
# Extension('tempsdb.database', ['tempsdb/database.pyx']),
# Extension('tempsdb.database', ['tempsdb/database.pyx']),
# Extension('tempsdb.exceptions', ['tempsdb/exceptions.pyx']),
# Extension('tempsdb.iterators', ['tempsdb/iterators.pyx']),
# Extension('tempsdb.series', ['tempsdb/series.pyx']),
# Extension('tempsdb.varlen', ['tempsdb/varlen.pyx']),
# Extension('tempsdb.chunks.gzip', ['tempsdb/chunks/gzip.pyx']),
# Extension('tempsdb.chunks.direct', ['tempsdb/chunks/direct.pyx']),
# Extension('tempsdb.chunks.normal', ['tempsdb/chunks/normal.pyx']),
# Extension('tempsdb.chunks.maker', ['tempsdb/chunks/maker.pyx']),
# Extension('tempsdb.chunks.base', ['tempsdb/chunks/base.pyx']),
# ]
# ext_modules = cythonize(extensions, compiler_directives=directives)
ext_modules = build([Multibuild('tempsdb', find_pyx('tempsdb'), **ext_kwargs), ],
compiler_directives=directives,
**cythonize_kwargs)

setup(name='tempsdb',
version='0.5.1a2',
packages=['tempsdb'],
install_requires=['satella>=2.14.24', 'ujson', 'indexed_gzip'],
ext_modules=build([Multibuild('tempsdb', find_pyx('tempsdb'), **ext_kwargs), ],
compiler_directives=directives,
**cythonize_kwargs),
version='0.5.1',
packages=find_packages(include=['tempsdb', 'tempsdb.*']),
install_requires=['satella>=2.14.24', 'ujson'],
ext_modules=ext_modules,
python_requires='!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*',
test_suite="tests",
zip_safe=False
Expand Down
5 changes: 2 additions & 3 deletions tempsdb/chunks/gzip.pyx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import gzip
import indexed_gzip
import threading


cdef class ReadWriteGzipFile:
def __init__(self, path: str, compresslevel: int = gzip._COMPRESS_LEVEL_FAST):
self.path = path
self.compress_level = compresslevel
self.ro_file = indexed_gzip.IndexedGzipFile(path)
self.rw_file = gzip.GzipFile(path, 'ab', compresslevel=self.compress_level)
self.ro_file = gzip.GzipFile(path, 'rb')
self.pointer = 0
self.lock = threading.RLock()
self.needs_flush_before_read = False
Expand All @@ -19,8 +18,8 @@ cdef class ReadWriteGzipFile:
self.size = self.pointer

cpdef int flush(self) except -1:
self.rw_file.flush()
self.ro_file.close()
self.rw_file.flush()
self.ro_file = gzip.GzipFile(self.path, 'rb')
self.pointer = 0
self.needs_flush_before_read = False
Expand Down
1 change: 1 addition & 0 deletions tempsdb/database.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ cdef class Database:
for series in self.open_series.values():
if not series.closed:
series.sync()
return 0

cpdef list get_all_normal_series(self):
"""
Expand Down

0 comments on commit 5692968

Please sign in to comment.