pax_global_header 0000666 0000000 0000000 00000000064 14702512106 0014510 g ustar 00root root 0000000 0000000 52 comment=10644a0e07ad180c5b756aba272ee6b0dbd12df8
tinydb-4.8.2/ 0000775 0000000 0000000 00000000000 14702512106 0013014 5 ustar 00root root 0000000 0000000 tinydb-4.8.2/.coveragerc 0000664 0000000 0000000 00000000307 14702512106 0015135 0 ustar 00root root 0000000 0000000 [run]
branch = True
[report]
exclude_lines =
pragma: no cover
raise NotImplementedError.*
warnings\.warn.*
def __repr__
def __str__
def main()
if __name__ == .__main__.:
tinydb-4.8.2/.github/ 0000775 0000000 0000000 00000000000 14702512106 0014354 5 ustar 00root root 0000000 0000000 tinydb-4.8.2/.github/stale.yml 0000664 0000000 0000000 00000001352 14702512106 0016210 0 ustar 00root root 0000000 0000000 # Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- bug
- pinned
- contributions-welcome
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Feel
free to reopen this if needed. Thank you for your contributions :heart:
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
tinydb-4.8.2/.github/workflows/ 0000775 0000000 0000000 00000000000 14702512106 0016411 5 ustar 00root root 0000000 0000000 tinydb-4.8.2/.github/workflows/ci-workflow.yml 0000664 0000000 0000000 00000002767 14702512106 0021413 0 ustar 00root root 0000000 0000000 name: Python CI
on:
push: {}
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- python-version: "pypy-3.9"
os: ubuntu-latest
- python-version: "pypy-3.10"
os: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip twine
pip install poetry
poetry install
- name: Run test suite
run: |
poetry run py.test -v --cov=tinydb
- name: Perform type check
run: |
poetry run pip install pytest-mypy
poetry run pytest --mypy -m mypy tinydb tests
- name: Verify dist package format
run: |
poetry build
twine check dist/*
if: ${{ contains(matrix.python-version, '3.12') }}
- name: Upload coverage result
if: ${{ env.COVERALLS_REPO_TOKEN != 'windows-latest' }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
poetry run coveralls
tinydb-4.8.2/.github/workflows/publish-workflow.yml 0000664 0000000 0000000 00000001455 14702512106 0022457 0 ustar 00root root 0000000 0000000 name: Upload Python Package
on:
push:
tags:
- v*.*.*
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Publish package
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}
run: |
poetry publish --build
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false tinydb-4.8.2/.gitignore 0000664 0000000 0000000 00000000557 14702512106 0015013 0 ustar 00root root 0000000 0000000 *.py[cod]
# C extensions
*.so
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
__pycache__
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
nosetests.xml
.pytest_cache/
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# Pycharm
.idea
*.db.yml
.DS_Store tinydb-4.8.2/.readthedocs.yml 0000664 0000000 0000000 00000000204 14702512106 0016076 0 ustar 00root root 0000000 0000000 version: 2
python:
version: 3.8
install:
- method: pip
path: .
extra_requirements:
- docs
formats: all tinydb-4.8.2/CONTRIBUTING.rst 0000664 0000000 0000000 00000003454 14702512106 0015463 0 ustar 00root root 0000000 0000000 Contribution Guidelines
#######################
Whether reporting bugs, discussing improvements and new ideas or writing
extensions: Contributions to TinyDB are welcome! Here's how to get started:
1. Check for open issues or open a fresh issue to start a discussion around
a feature idea or a bug
2. Fork `the repository `_ on GitHub,
create a new branch off the `master` branch and start making your changes
(known as `GitHub Flow `_)
3. Write a test which shows that the bug was fixed or that the feature works
as expected
4. Send a pull request and bug the maintainer until it gets merged and
published :)
Philosophy of TinyDB
********************
TinyDB aims to be simple and fun to use. Therefore two key values are simplicity
and elegance of interfaces and code. These values will contradict each other
from time to time. In these cases , try using as little magic as possible.
In any case don't forget documenting code that isn't clear at first glance.
Code Conventions
****************
In general the TinyDB source should always follow `PEP 8 `_.
Exceptions are allowed in well justified and documented cases. However we make
a small exception concerning docstrings:
When using multiline docstrings, keep the opening and closing triple quotes
on their own lines and add an empty line after it.
.. code-block:: python
def some_function():
"""
Documentation ...
"""
# implementation ...
Version Numbers
***************
TinyDB follows the `SemVer versioning guidelines `_.
This implies that backwards incompatible changes in the API will increment
the major version. So think twice before making such changes.
tinydb-4.8.2/LICENSE 0000664 0000000 0000000 00000002070 14702512106 0014020 0 ustar 00root root 0000000 0000000 Copyright (C) 2013 Markus Siemens
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
tinydb-4.8.2/MANIFEST.in 0000664 0000000 0000000 00000000054 14702512106 0014551 0 ustar 00root root 0000000 0000000 include LICENSE
recursive-include tests *.py tinydb-4.8.2/README.rst 0000664 0000000 0000000 00000012164 14702512106 0014507 0 ustar 00root root 0000000 0000000 .. image:: https://raw.githubusercontent.com/msiemens/tinydb/master/artwork/logo.png
:height: 150px
|Build Status| |Coverage| |Version|
Quick Links
***********
- `Example Code`_
- `Supported Python Versions`_
- `Documentation `_
- `Changelog `_
- `Extensions `_
- `Contributing`_
Introduction
************
TinyDB is a lightweight document oriented database optimized for your happiness :)
It's written in pure Python and has no external dependencies. The target are
small apps that would be blown away by a SQL-DB or an external database server.
TinyDB is:
- **tiny:** The current source code has 1800 lines of code (with about 40%
documentation) and 1600 lines tests.
- **document oriented:** Like MongoDB_, you can store any document
(represented as ``dict``) in TinyDB.
- **optimized for your happiness:** TinyDB is designed to be simple and
fun to use by providing a simple and clean API.
- **written in pure Python:** TinyDB neither needs an external server (as
e.g. `PyMongo `_) nor any dependencies
from PyPI.
- **works on Python 3.8+ and PyPy3:** TinyDB works on all modern versions of Python
and PyPy.
- **powerfully extensible:** You can easily extend TinyDB by writing new
storages or modify the behaviour of storages with Middlewares.
- **100% test coverage:** No explanation needed.
To dive straight into all the details, head over to the `TinyDB docs
`_. You can also discuss everything related
to TinyDB like general development, extensions or showcase your TinyDB-based
projects on the `discussion forum `_.
Supported Python Versions
*************************
TinyDB has been tested with Python 3.8 - 3.13 and PyPy3.
Project Status
**************
This project is in maintenance mode. It has reached a mature, stable state
where significant new features or architectural changes are not planned. That
said, there will still be releases for bugfixes or features contributed by
the community. Read more about what this means in particular
`here `_.
Example Code
************
.. code-block:: python
>>> from tinydb import TinyDB, Query
>>> db = TinyDB('/path/to/db.json')
>>> db.insert({'int': 1, 'char': 'a'})
>>> db.insert({'int': 1, 'char': 'b'})
Query Language
==============
.. code-block:: python
>>> User = Query()
>>> # Search for a field value
>>> db.search(User.name == 'John')
[{'name': 'John', 'age': 22}, {'name': 'John', 'age': 37}]
>>> # Combine two queries with logical and
>>> db.search((User.name == 'John') & (User.age <= 30))
[{'name': 'John', 'age': 22}]
>>> # Combine two queries with logical or
>>> db.search((User.name == 'John') | (User.name == 'Bob'))
[{'name': 'John', 'age': 22}, {'name': 'John', 'age': 37}, {'name': 'Bob', 'age': 42}]
>>> # Negate a query with logical not
>>> db.search(~(User.name == 'John'))
[{'name': 'Megan', 'age': 27}, {'name': 'Bob', 'age': 42}]
>>> # Apply transformation to field with `map`
>>> db.search((User.age.map(lambda x: x + x) == 44))
>>> [{'name': 'John', 'age': 22}]
>>> # More possible comparisons: != < > <= >=
>>> # More possible checks: where(...).matches(regex), where(...).test(your_test_func)
Tables
======
.. code-block:: python
>>> table = db.table('name')
>>> table.insert({'value': True})
>>> table.all()
[{'value': True}]
Using Middlewares
=================
.. code-block:: python
>>> from tinydb.storages import JSONStorage
>>> from tinydb.middlewares import CachingMiddleware
>>> db = TinyDB('/path/to/db.json', storage=CachingMiddleware(JSONStorage))
Contributing
************
Whether reporting bugs, discussing improvements and new ideas or writing
extensions: Contributions to TinyDB are welcome! Here's how to get started:
1. Check for open issues or open a fresh issue to start a discussion around
a feature idea or a bug
2. Fork `the repository `_ on Github,
create a new branch off the `master` branch and start making your changes
(known as `GitHub Flow `_)
3. Write a test which shows that the bug was fixed or that the feature works
as expected
4. Send a pull request and bug the maintainer until it gets merged and
published ☺
.. |Build Status| image:: https://img.shields.io/azure-devops/build/msiemens/3e5baa75-12ec-43ac-9728-89823ee8c7e2/2.svg?style=flat-square
:target: https://dev.azure.com/msiemens/github/_build?definitionId=2
.. |Coverage| image:: http://img.shields.io/coveralls/msiemens/tinydb.svg?style=flat-square
:target: https://coveralls.io/r/msiemens/tinydb
.. |Version| image:: http://img.shields.io/pypi/v/tinydb.svg?style=flat-square
:target: https://pypi.python.org/pypi/tinydb/
.. _Buzhug: http://buzhug.sourceforge.net/
.. _CodernityDB: https://github.com/perchouli/codernitydb
.. _MongoDB: http://mongodb.org/
tinydb-4.8.2/artwork/ 0000775 0000000 0000000 00000000000 14702512106 0014505 5 ustar 00root root 0000000 0000000 tinydb-4.8.2/artwork/logo.png 0000664 0000000 0000000 00000006342 14702512106 0016160 0 ustar 00root root 0000000 0000000 PNG
IHDR w b pHYs tEXtSoftware Adobe ImageReadyqe<