diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index a9a526da9ac11773739881fbe349845308f8b2c2..0000000000000000000000000000000000000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,29 +0,0 @@ -engines: - duplication: - enabled: true - config: - languages: - python: - - fixme: - enabled: true - markdownlint: - enabled: true - pep8: - enabled: true -exclude_paths: - - tests/** - - docs/** -ratings: - paths: - - tempsdb/** -checks: - argument-count: - config: - threshold: 15 - method-complexity: - config: - threshold: 50 - method-count: - config: - threshold: 85 diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index e7a3e2ba09912a86bbea3e29975238def74f5c0a..0000000000000000000000000000000000000000 --- a/.dockerignore +++ /dev/null @@ -1,8 +0,0 @@ -.git -.circleci -docs -build -dist -*.egg-info -*.c -*.h diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d6680778927ca83d0cd4d0970b66a927fbdea777..0c54c947b98f20f408bdfb76b6e8199fa2c5378c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,7 @@ stages: - test - build + - deploy .test_python: @@ -15,7 +16,7 @@ stages: - pip install -r requirements.txt - python setup.py build_ext --inplace variables: - CI: "1" + TESTING: "1" script: - python -m coverage run -m nose2 -vv -F - python -m coverage report @@ -33,7 +34,6 @@ test_python39: image: python:3.9 - test_python310: extends: .test_python image: python:3.10 @@ -45,9 +45,8 @@ test_python311: image: python:3.11 + .build_python: - only: - - master stage: build script: - pip install --break-system-packages --upgrade Cython setuptools pip @@ -57,6 +56,14 @@ test_python311: artifacts: paths: - "*.whl" + after_script: + - pip install twine + - TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python3 -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/* + only: + - tags + except: + - branches + build_python38: extends: .build_python @@ -72,10 +79,45 @@ build_python310: image: python:3.10 -build_python38: +build_python311: extends: .build_python image: python:3.11 + build_python311_armv7l: extends: .build_python - image: zoo.smok.co/build/build:armv7l-python311 + image: zoo.smok.co/build/build:armv7l-python3.11 + after_script: + - echo "Do nothing" + + +upload_to_twine_python311_armv7l: + stage: deploy + image: zoo.smok.co/build/build:latest + dependencies: + - build_python311_armv7l + script: + - TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python3 -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi *.whl + only: + - tags + except: + - branches + + +pages: + stage: build + image: zoo.smok.co/build/build:pages + before_script: + - pip install --break-system-packages --upgrade Cython setuptools pip + - pip install --break-system-packages -r requirements.txt + - python3 setup.py build_ext --inplace + script: + - cd docs + - make html + - mv _build/html ../public + artifacts: + paths: + - "public" + only: + - master + needs: [] \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 316c20ba6aeaafed889e980ce9fa2482979adbe6..0000000000000000000000000000000000000000 --- a/.travis.yml +++ /dev/null @@ -1,64 +0,0 @@ -language: python -stages: - - name: test - - name: deploy - if: tag is present - -cache: pip -before_script: - - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - - chmod +x ./cc-test-reporter - - ./cc-test-reporter before-build - - pip install -U Cython satella snakehouse nose2 coverage - - pip install -r requirements.txt - - python setup.py build_ext --inplace -jobs: - include: - - stage: test - python: "3.5" - script: - - bash tests/test.sh - after_script: - - coverage xml - - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT - - stage: test - python: "3.8" - script: - - bash tests/test.sh - after_script: - - coverage xml - - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT - - stage: test - python: "3.9" - script: - - bash tests/test.sh - after_script: - - coverage xml - - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT - - stage: deploy - python: "3.8" - before_script: - - sudo apt-get update - - sudo apt-get install -y patchelf - - pip install wheel twine doctor-wheel auditwheel snakehouse satella - script: - - RELEASE=1 python setup.py bdist_wheel sdist - - cd dist - - doctor-wheel *.whl - - auditwheel repair --plat manylinux2014_x86_64 *.whl - - twine upload -u $PYPI_USER -p $PYPI_PWD wheelhouse/*.whl *.gz - - stage: deploy - python: "3.9" - before_script: - - sudo apt-get update - - sudo apt-get install -y patchelf - - pip install wheel twine doctor-wheel auditwheel snakehouse satella - script: - - RELEASE=1 python setup.py bdist_wheel - - cd dist - - doctor-wheel *.whl - - auditwheel repair --plat manylinux2014_x86_64 *.whl - - twine upload -u $PYPI_USER -p $PYPI_PWD wheelhouse/*.whl - - - diff --git a/CHANGELOG.md b/CHANGELOG.md index af233214e880b71af5bbde699978a363d90d393d..b0764e54e9a8c5e5d243691ae5f00ee0df17ca49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ ## v0.6.6 * replaced most signed integers with unsigned +* fixed most automatic closing of things +* replaced Warnings will more legible warnings +* updated documentation +* moved to our GitLab ## v0.6.5 diff --git a/LICENSE b/LICENSE index 308aeb48efbc0ce21a803c3553e141ba80c4bbf8..e6624836b5fc69344b8b2a63e26436a4280802c5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020-2021 SMOK sp. z o. o. +Copyright (c) 2020-2024 SMOK sp. z o. o. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 3a2678689e785f6432e438aaf8f94f5998e1c1b8..71d71100de64d083428d87875c55575166ab6714 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,8 @@ [](https://pypi.python.org/pypi/tempsdb) [](https://badge.fury.io/py/tempsdb) [](https://pypi.python.org/pypi/tempsdb) -[](http://tempsdb.readthedocs.io/en/latest/?badge=latest) -[](https://git.dms-serwis.com.pl/smokserwis/tempsdb) -[](https://git.dms-serwis.com.pl/smokserwis/tempsdb/-/commits/develop) +[](https://git.dms-serwis.com.pl/smokserwis/tempsdb) +[](https://git.dms-serwis.com.pl/smokserwis/tempsdb/-/commits/develop) [](https://pypi.org/project/tempsdb/) [](https://github.com/smok-serwis/tempsdb) @@ -42,4 +41,7 @@ Then copy your resulting wheel and install it via pip on the target system. Be aware that tempsdb does logging. Consult the docs for how to disable it. -The [changelog](CHANGELOG.md) has been moved here. \ No newline at end of file +The [changelog](CHANGELOG.md) has been moved here. + +Ah, and [requirements.txt](requirements.txt) contain all the build necessitites. +True few dependencies are kept in [setup.cfg](setup.cfg). \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index c69064de9430667129b5fbac7c32ca5511a104d5..0000000000000000000000000000000000000000 --- a/docker-compose.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: '3.2' -services: - unittest: - build: - context: . - dockerfile: unittest.Dockerfile diff --git a/docs/conf.py b/docs/conf.py index 3c743542406a49224d48a78a1c2bc950269fa845..50925f9e906aa25a831b9b847fc06335666edaf7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -10,19 +10,19 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) +import os +import sys +sys.path.insert(0, os.path.abspath('..')) # -- Project information ----------------------------------------------------- import pkg_resources project = 'tempsdb' -copyright = '2020, Piotr MaĹlanka' +copyright = '2020-2024, Piotr MaĹlanka' author = 'Piotr MaĹlanka' -release = pkg_resources.require("tempsdb")[0].version +release = '0.6.6' # -- General configuration --------------------------------------------------- diff --git a/docs/usage.rst b/docs/usage.rst index d8015cb057e123ff82f533f58f1e6072d4d0124f..608800bbd14c33e1d20a42e058b7e1bb954d478a 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -60,4 +60,11 @@ Failing to close things Please be keen on manually closing things that are no longer necessary. Most destructors check for that and will complain if you forget to manually -close anything. \ No newline at end of file +close anything. + +Following warnings will be raised: + +* :code:`RuntimeWarning` - you forgot to close something +* :code:`FutureWarning` - you enabled an experimental feature +* :code:`UserWarning` - you messed up something as an user that tempsdb + was able to recover from. diff --git a/docs/varlen.rst b/docs/varlen.rst index 8988ba97b9aace2a1d04fa565f6c28e0ecbff53d..1146fc606dc5a55af47c31bf983085e186d6470c 100644 --- a/docs/varlen.rst +++ b/docs/varlen.rst @@ -41,6 +41,8 @@ Note that the only valid sizes of `size_struct` are: Also note that variable length series live in a different namespace than standard time series, so you can name them the same. +Also, variable lengths are written using little endian encoding. + Accessing them -------------- diff --git a/requirements.txt b/requirements.txt index ebe03e770a17d21839cdcf0d111679f9403db7cc..7ec1a17ed47e2b003a0c0363506c58fe08755d8e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,6 @@ satella -ujson snakehouse>=1.2.3 six nose2 coverage -minijson Cython diff --git a/setup.cfg b/setup.cfg index 6c19df7673504c648a80f590d9fd54fc5fe6ac90..f5f999eb99106e7e9f1e7ec780e4298f15040ed9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,24 +1,21 @@ # coding: utf-8 [metadata] name = tempsdb -version = 0.6.6a1 -long-description = file: README.md -long-description-content-type = text/markdown; charset=UTF-8 +version = 0.6.6 +long_description = file: README.md +long_description-content-type = text/markdown; charset=UTF-8 license_files = LICENSE author = Piotr MaĹlanka author_email = pmaslanka@smok.co description = Embedded Cython database for time series that you need to send somewhere -url = https://github.com/smok-serwis/tempsdb -project-urls = - Documentation = https://tempsdb.readthedocs.io/ - Code = https://github.com/smok-serwis/tempsdb - Issue tracker = https://github.com/smok-serwis/tempsdb/issues - Changelog = https://github.com/smok-serwis/tempsdb/blob/develop/CHANGELOG.md +url = https://git.dms-serwis.com.pl/smokserwis/tempsdb +project_urls = + Documentation = https://smokserwis.docs.smok.co/tempsdb + Changelog = https://git.dms-serwis.com.pl/smokserwis/tempsdb/-/blob/develop/CHANGELOG.md + Code = https://git.dms-serwis.com.pl/smokserwis/tempsdb + Issue tracker = https://git.dms-serwis.com.pl/smokserwis/tempsdb/-/issues classifier = Programming Language :: Python - Programming Language :: Python :: 3.5 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 diff --git a/setup.py b/setup.py index d57e04061250b90d8d6921fb39220cbb25cfbe83..b082177146d268667752448082feb64656e5b054 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ monkey_patch_parallel_compilation() directives = {'language_level': '3'} ext_kwargs = {} cythonize_kwargs = {} -if 'CI' in os.environ: # and 'RELEASE' not in os.environ: +if 'TESTING' in os.environ: # and 'RELEASE' not in os.environ: ext_kwargs['define_macros'] = [("CYTHON_TRACE_NOGIL", "1")] directives.update(profile=True, linetrace=True, embedsignature=True) cythonize_kwargs['gdb_debug'] = True @@ -28,6 +28,5 @@ ext_modules = build([Multibuild('tempsdb', find_pyx('tempsdb'), **cythonize_kwargs) setup(packages=find_packages(include=['tempsdb', 'tempsdb.*']), - ext_modules=ext_modules, - test_suite="tests", + ext_modules=ext_modules ) diff --git a/tempsdb/chunks/base.pyx b/tempsdb/chunks/base.pyx index ce005d683b36cc1ff14f65730261d053d9131188..1159269a29f60b43baae1000961e1a2abf27a87b 100644 --- a/tempsdb/chunks/base.pyx +++ b/tempsdb/chunks/base.pyx @@ -438,7 +438,7 @@ cdef class Chunk: def __del__(self) -> None: if self.is_object_closed or self.closed: return - warnings.warn('You forgot to close a Chunk') + warnings.warn('You forgot to close a Chunk', RuntimeWarning) self.close() cdef tuple get_piece_at(self, unsigned int index): diff --git a/tempsdb/chunks/direct.pyx b/tempsdb/chunks/direct.pyx index 76fa3bb39d76dfa3a0e67f6f42e43311255385e4..20b28d6cdfb0d556b8b13ebea993509f378c07ee 100644 --- a/tempsdb/chunks/direct.pyx +++ b/tempsdb/chunks/direct.pyx @@ -34,15 +34,15 @@ cdef class DirectChunk(Chunk): use_descriptor_access: tp.Optional[bool] = None, int gzip_compression_level = 0): if path.endswith('.gz'): - warnings.warn('Please pass the path without .gz') + warnings.warn('Please pass the path without .gz', UserWarning) path = path.replace('.gz', '') if path.endswith('.direct'): - warnings.warn('Please pass the path without .direct') + warnings.warn('Please pass the path without .direct', UserWarning) path = path.replace('.direct', '') if use_descriptor_access is None: use_descriptor_access = False if gzip_compression_level: - warnings.warn('Gzip support is experimental') + warnings.warn('Gzip support is experimental', FutureWarning) use_descriptor_access = True self.gzip = gzip_compression_level diff --git a/tempsdb/database.pyx b/tempsdb/database.pyx index f210b1f54283d55e593910e2730a03fcb57111c6..f1ed78117b368149786303a27c0a1ecb6aab5979 100644 --- a/tempsdb/database.pyx +++ b/tempsdb/database.pyx @@ -384,7 +384,7 @@ cdef class Database: def __del__(self): if not self.closed: warnings.warn('You forgot the close the Database. Please close it explicitly when you ' - 'are done.', ) + 'are done.', RuntimeWarning) self.close() cpdef int close(self) except -1: diff --git a/tempsdb/iterators.pyx b/tempsdb/iterators.pyx index 1aff3147c65fad93642a86a9f3792603752c44a8..5385d32576710fe8630670e321c04383a0ebd747 100644 --- a/tempsdb/iterators.pyx +++ b/tempsdb/iterators.pyx @@ -47,7 +47,7 @@ cdef class Iterator: def __del__(self): if not self.closed: - warnings.warn('You forgot to close an Iterator. Please close them explicitly!') + warnings.warn('You forgot to close an Iterator. Please close them explicitly!', RuntimeWarning) self.close() cpdef int close(self) except -1: diff --git a/tempsdb/series.pyx b/tempsdb/series.pyx index f9701a016130522feacbc1a8ae99da17d41e4337..bf29a6904ecdff870c4edaccec1d2ea1242e1c47 100644 --- a/tempsdb/series.pyx +++ b/tempsdb/series.pyx @@ -524,7 +524,7 @@ cdef class TimeSeries: def __del__(self): if not self.closed: warnings.warn('You forgot to close TimeSeries. Please explicitly close it when you ' - 'are done.') + 'are done.', RuntimeWarning) self.close() diff --git a/tempsdb/varlen.pyx b/tempsdb/varlen.pyx index e92e495d6979ea864793fd5566a45be9cbffee65..8dd036444f7d8570e5676615fa0d88069f645564 100644 --- a/tempsdb/varlen.pyx +++ b/tempsdb/varlen.pyx @@ -448,7 +448,7 @@ cdef class VarlenIterator: def __del__(self): if not self.closed: - warnings.warn('You forgot to close a VarlenIterator. Please close them explicitly!') + warnings.warn('You forgot to close a VarlenIterator. Please close them explicitly!', RuntimeWarning) self.close() diff --git a/tests/test.sh b/tests/test.sh index 9fa28620fe86845f445104ecb16914855f34ad25..2005ff9b31388a90c4a53318c11b2c1b5e8dff68 100644 --- a/tests/test.sh +++ b/tests/test.sh @@ -1,4 +1,2 @@ #!/bin/bash set -e -python -m coverage run -m nose2 -vv -F -python -m coverage report diff --git a/tests/test_varlen.py b/tests/test_varlen.py index e458402fc5b496aefeb5ddd636bd83516e4f60e6..f57245700b03c84a2a260b0aba9cad5c5bf3a801 100644 --- a/tests/test_varlen.py +++ b/tests/test_varlen.py @@ -54,6 +54,7 @@ class TestVarlen(unittest.TestCase): self.assertTrue(ve.slice(0, 4), b'test') self.assertFalse(ve.endswith(b'skerabeusza')) ve = iterator.get_next() + varlen.close() def test_varlen_gzip(self): from tempsdb.varlen import create_varlen_series @@ -72,3 +73,4 @@ class TestVarlen(unittest.TestCase): lst = [(ts, v.to_bytes()) for ts, v in it] it.close() self.assertEqual(lst, series) + varlen.close() diff --git a/unittest.Dockerfile b/unittest.Dockerfile deleted file mode 100644 index 2ab49d9c18bc76ea50f4e87e0c73c30a35eaea2e..0000000000000000000000000000000000000000 --- a/unittest.Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM python:3.8 - -RUN pip install satella>=2.17.13 snakehouse>=1.3 nose2 wheel coverage - -ADD tempsdb /app/tempsdb -ADD setup.py /app/setup.py -ADD .coveragerc /app/.coveragerc -ADD setup.cfg /app/setup.cfg -WORKDIR /app -ENV CI=true -RUN python setup.py build_ext --inplace -ADD tests /app/tests -RUN chmod ugo+x /app/tests/test.sh - -CMD ["/app/tests/test.sh"]