flask-mongoengine2 2.1.0__tar.gz → 3.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/.github/workflows/coverage.yml +8 -15
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/.github/workflows/drafter.yml +1 -1
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/.github/workflows/labeler-check.yml +2 -2
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/.github/workflows/labeler.yml +2 -2
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/.github/workflows/linting.yml +3 -3
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/.github/workflows/tests.yml +5 -5
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/.pre-commit-config.yaml +7 -19
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/.readthedocs.yaml +2 -2
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/CONTRIBUTING.md +6 -6
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/LICENSE.md +1 -1
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/MANIFEST.in +0 -4
- flask_mongoengine2-3.0.0/PKG-INFO +190 -0
- flask_mongoengine2-3.0.0/README.md +146 -0
- flask_mongoengine2-3.0.0/docker-compose.yml +11 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/docs/CONTRIBUTING.md +6 -6
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/docs/LICENSE.md +1 -1
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/docs/api/base.rst +8 -14
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/docs/changelog.rst +22 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/docs/conf.py +4 -4
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/docs/index.rst +1 -1
- flask_mongoengine2-3.0.0/docs/requirements.txt +5 -0
- flask_mongoengine2-3.0.0/docs/session_interface.md +21 -0
- flask_mongoengine2-3.0.0/flask_mongoengine2/__init__.py +112 -0
- flask_mongoengine2-3.0.0/flask_mongoengine2/_version.py +24 -0
- flask_mongoengine2-3.0.0/flask_mongoengine2/connection.py +132 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/flask_mongoengine2/documents.py +38 -18
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/flask_mongoengine2/pagination.py +80 -63
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/flask_mongoengine2/panels.py +58 -36
- flask_mongoengine2-3.0.0/flask_mongoengine2/sessions.py +134 -0
- flask_mongoengine2-3.0.0/flask_mongoengine2.egg-info/PKG-INFO +190 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/flask_mongoengine2.egg-info/SOURCES.txt +3 -5
- flask_mongoengine2-3.0.0/flask_mongoengine2.egg-info/requires.txt +13 -0
- flask_mongoengine2-3.0.0/flask_mongoengine2.egg-info/scm_file_list.json +59 -0
- flask_mongoengine2-3.0.0/flask_mongoengine2.egg-info/scm_version.json +8 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/noxfile.py +27 -41
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/pyproject.toml +44 -59
- flask_mongoengine2-3.0.0/setup.cfg +4 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/tests/conftest.py +23 -15
- flask_mongoengine2-3.0.0/tests/test_base.py +106 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/tests/test_connection.py +63 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/tests/test_debug_panel.py +65 -18
- flask_mongoengine2-3.0.0/tests/test_documents.py +80 -0
- flask_mongoengine2-3.0.0/tests/test_pagination.py +217 -0
- flask_mongoengine2-3.0.0/tests/test_session.py +205 -0
- flask-mongoengine2-2.1.0/.codeclimate.yml +0 -20
- flask-mongoengine2-2.1.0/PKG-INFO +0 -124
- flask-mongoengine2-2.1.0/README.md +0 -76
- flask-mongoengine2-2.1.0/docker-compose.yml +0 -25
- flask-mongoengine2-2.1.0/docs/requirements.txt +0 -6
- flask-mongoengine2-2.1.0/docs/session_interface.md +0 -11
- flask-mongoengine2-2.1.0/flask_mongoengine2/__init__.py +0 -144
- flask-mongoengine2-2.1.0/flask_mongoengine2/_version.py +0 -16
- flask-mongoengine2-2.1.0/flask_mongoengine2/connection.py +0 -130
- flask-mongoengine2-2.1.0/flask_mongoengine2/decorators.py +0 -28
- flask-mongoengine2-2.1.0/flask_mongoengine2/sessions.py +0 -100
- flask-mongoengine2-2.1.0/flask_mongoengine2.egg-info/PKG-INFO +0 -124
- flask-mongoengine2-2.1.0/flask_mongoengine2.egg-info/requires.txt +0 -18
- flask-mongoengine2-2.1.0/setup.cfg +0 -28
- flask-mongoengine2-2.1.0/setup.py +0 -28
- flask-mongoengine2-2.1.0/tests/test_base.py +0 -20
- flask-mongoengine2-2.1.0/tests/test_decorators.py +0 -17
- flask-mongoengine2-2.1.0/tests/test_pagination.py +0 -91
- flask-mongoengine2-2.1.0/tests/test_session.py +0 -77
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/.editorconfig +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/.github/labels.yml +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/.github/release-drafter.yml +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/.gitignore +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/.markdownlint.json +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/.sourcery.yaml +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/AUTHORS.md +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/codecov.yml +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/docs/AUTHORS.md +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/docs/_static/css/custom.css +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/docs/_static/debug_toolbar.png +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/docs/api/index.rst +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/docs/custom_queryset.md +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/docs/db_model.md +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/docs/debug_toolbar.md +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/docs/flask_config.md +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/flask_mongoengine2/templates/panels/mongo-panel.html +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/flask_mongoengine2.egg-info/dependency_links.txt +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/flask_mongoengine2.egg-info/not-zip-safe +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/flask_mongoengine2.egg-info/top_level.txt +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/tests/__init__.py +0 -0
- {flask-mongoengine2-2.1.0 → flask_mongoengine2-3.0.0}/tests/test_basic_app.py +0 -0
|
@@ -17,15 +17,15 @@ jobs:
|
|
|
17
17
|
strategy:
|
|
18
18
|
fail-fast: false
|
|
19
19
|
matrix:
|
|
20
|
-
mongodb-version: [
|
|
20
|
+
mongodb-version: ["8.0"]
|
|
21
21
|
include:
|
|
22
22
|
- name: "coverage"
|
|
23
|
-
python: "3.
|
|
23
|
+
python: "3.13"
|
|
24
24
|
|
|
25
25
|
steps:
|
|
26
|
-
- uses: actions/checkout@
|
|
26
|
+
- uses: actions/checkout@v5
|
|
27
27
|
- name: Set up Python ${{ matrix.python }}
|
|
28
|
-
uses: actions/setup-python@
|
|
28
|
+
uses: actions/setup-python@v6
|
|
29
29
|
with:
|
|
30
30
|
python-version: ${{ matrix.python }}
|
|
31
31
|
- name: Install dependencies
|
|
@@ -33,20 +33,13 @@ jobs:
|
|
|
33
33
|
python -m pip install --upgrade pip
|
|
34
34
|
pip install nox virtualenv
|
|
35
35
|
- name: Start MongoDB
|
|
36
|
-
uses: supercharge/mongodb-github-action@1.
|
|
36
|
+
uses: supercharge/mongodb-github-action@1.12.0
|
|
37
37
|
with:
|
|
38
38
|
mongodb-version: ${{ matrix.mongodb-version }}
|
|
39
39
|
- name: Test build
|
|
40
40
|
run: "nox -s 'latest-${{ matrix.python }}(toolbar=True)' -- --cov-report=xml --cov-report=html"
|
|
41
41
|
- name: Send coverage report to codecov
|
|
42
|
-
uses: codecov/codecov-action@
|
|
42
|
+
uses: codecov/codecov-action@v5
|
|
43
43
|
with:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
uses: paambaati/codeclimate-action@v3.0.0
|
|
47
|
-
continue-on-error: true
|
|
48
|
-
with:
|
|
49
|
-
coverageCommand: echo "Ignore rerun"
|
|
50
|
-
coverageLocations: ${{github.workspace}}/coverage.xml:coverage.py
|
|
51
|
-
env:
|
|
52
|
-
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
|
|
44
|
+
files: ./coverage.xml
|
|
45
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -8,9 +8,9 @@ jobs:
|
|
|
8
8
|
runs-on: ubuntu-latest
|
|
9
9
|
steps:
|
|
10
10
|
- name: Checkout
|
|
11
|
-
uses: actions/checkout@
|
|
11
|
+
uses: actions/checkout@v5
|
|
12
12
|
- name: Run Labeler
|
|
13
|
-
uses: crazy-max/ghaction-github-labeler@
|
|
13
|
+
uses: crazy-max/ghaction-github-labeler@v5
|
|
14
14
|
with:
|
|
15
15
|
yaml_file: .github/labels.yml
|
|
16
16
|
dry_run: true
|
|
@@ -9,9 +9,9 @@ jobs:
|
|
|
9
9
|
runs-on: ubuntu-latest
|
|
10
10
|
steps:
|
|
11
11
|
- name: Checkout
|
|
12
|
-
uses: actions/checkout@
|
|
12
|
+
uses: actions/checkout@v5
|
|
13
13
|
- name: Run Labeler
|
|
14
|
-
uses: crazy-max/ghaction-github-labeler@
|
|
14
|
+
uses: crazy-max/ghaction-github-labeler@v5
|
|
15
15
|
with:
|
|
16
16
|
yaml_file: .github/labels.yml
|
|
17
17
|
env:
|
|
@@ -19,12 +19,12 @@ jobs:
|
|
|
19
19
|
matrix:
|
|
20
20
|
include:
|
|
21
21
|
- name: "linting"
|
|
22
|
-
python: "3.
|
|
22
|
+
python: "3.13"
|
|
23
23
|
|
|
24
24
|
steps:
|
|
25
|
-
- uses: actions/checkout@
|
|
25
|
+
- uses: actions/checkout@v5
|
|
26
26
|
- name: Set up Python ${{ matrix.python }}
|
|
27
|
-
uses: actions/setup-python@
|
|
27
|
+
uses: actions/setup-python@v6
|
|
28
28
|
with:
|
|
29
29
|
python-version: ${{ matrix.python }}
|
|
30
30
|
- name: Install dependencies
|
|
@@ -16,13 +16,13 @@ jobs:
|
|
|
16
16
|
strategy:
|
|
17
17
|
fail-fast: false
|
|
18
18
|
matrix:
|
|
19
|
-
mongodb-version: ["
|
|
20
|
-
python: ["3.
|
|
19
|
+
mongodb-version: ["6.0", "7.0", "8.0"]
|
|
20
|
+
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
21
21
|
|
|
22
22
|
steps:
|
|
23
|
-
- uses: actions/checkout@
|
|
23
|
+
- uses: actions/checkout@v5
|
|
24
24
|
- name: Set up Python ${{ matrix.python }}
|
|
25
|
-
uses: actions/setup-python@
|
|
25
|
+
uses: actions/setup-python@v6
|
|
26
26
|
with:
|
|
27
27
|
python-version: ${{ matrix.python }}
|
|
28
28
|
- name: Install dependencies
|
|
@@ -30,7 +30,7 @@ jobs:
|
|
|
30
30
|
python -m pip install --upgrade pip
|
|
31
31
|
pip install nox virtualenv
|
|
32
32
|
- name: Start MongoDB
|
|
33
|
-
uses: supercharge/mongodb-github-action@1.
|
|
33
|
+
uses: supercharge/mongodb-github-action@1.12.0
|
|
34
34
|
with:
|
|
35
35
|
mongodb-version: ${{ matrix.mongodb-version }}
|
|
36
36
|
- name: Test build
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
repos:
|
|
2
2
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
-
rev:
|
|
3
|
+
rev: v6.0.0
|
|
4
4
|
hooks:
|
|
5
5
|
- id: trailing-whitespace
|
|
6
6
|
- id: end-of-file-fixer
|
|
@@ -15,32 +15,20 @@ repos:
|
|
|
15
15
|
- id: check-symlinks
|
|
16
16
|
- id: check-toml
|
|
17
17
|
- id: check-xml
|
|
18
|
-
- id: check-yaml
|
|
19
18
|
- id: debug-statements
|
|
20
19
|
- id: destroyed-symlinks
|
|
21
20
|
- id: detect-private-key
|
|
22
21
|
- id: fix-byte-order-marker
|
|
23
|
-
- id: fix-encoding-pragma
|
|
24
|
-
args: [--remove]
|
|
25
22
|
- id: mixed-line-ending
|
|
26
|
-
- repo: https://github.com/
|
|
27
|
-
rev:
|
|
28
|
-
hooks:
|
|
29
|
-
- id: black
|
|
30
|
-
language_version: python3.10
|
|
31
|
-
exclude: ^docs/
|
|
32
|
-
- repo: https://github.com/PyCQA/flake8
|
|
33
|
-
rev: 7.0.0
|
|
23
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
24
|
+
rev: v0.17.6
|
|
34
25
|
hooks:
|
|
35
|
-
- id:
|
|
36
|
-
|
|
26
|
+
- id: ruff-check
|
|
27
|
+
args: [--fix]
|
|
28
|
+
- id: ruff-format
|
|
37
29
|
- repo: https://github.com/igorshubovych/markdownlint-cli
|
|
38
|
-
rev: v0.
|
|
30
|
+
rev: v0.45.0
|
|
39
31
|
hooks:
|
|
40
32
|
- id: markdownlint
|
|
41
33
|
args: [-f]
|
|
42
34
|
exclude: ^(.github|tests)
|
|
43
|
-
- repo: https://github.com/PyCQA/isort
|
|
44
|
-
rev: 5.13.2
|
|
45
|
-
hooks:
|
|
46
|
-
- id: isort
|
|
@@ -17,7 +17,7 @@ integration or feature.
|
|
|
17
17
|
|
|
18
18
|
## Supported interpreters
|
|
19
19
|
|
|
20
|
-
Flask-MongoEngine2 supports CPython 3.
|
|
20
|
+
Flask-MongoEngine2 supports CPython 3.10 and newer. Language features
|
|
21
21
|
not supported by all interpreters can not be used.
|
|
22
22
|
|
|
23
23
|
## Running tests
|
|
@@ -165,8 +165,8 @@ Rendered documentation will be available under: <http://localhost:9812/>
|
|
|
165
165
|
- Developers should avoid including typing information to docstrings, if possible.
|
|
166
166
|
- Developers should avoid including typing information to docstrings and signatures
|
|
167
167
|
in same objects, to avoid rendering conflicts.
|
|
168
|
-
- Code formatting is completely done by [
|
|
169
|
-
implementation of [PEP8]. Target python version is the lowest supported version.
|
|
168
|
+
- Code formatting and linting is completely done by [ruff] (black compatible style
|
|
169
|
+
implementation of [PEP8]). Target python version is the lowest supported version.
|
|
170
170
|
- Code formatting should be done before passing any new merge requests.
|
|
171
171
|
- Code style should use f-strings if possible, exceptional can be made for expensive
|
|
172
172
|
debug level logging statements.
|
|
@@ -190,13 +190,13 @@ All tests are run on [GitHub actions] and any pull requests are automatically te
|
|
|
190
190
|
for full range of supported [Flask], [mongoengine], [python] and [mongodb] versions.
|
|
191
191
|
Any pull requests without tests will take longer to be integrated and might be refused.
|
|
192
192
|
|
|
193
|
-
[community]: AUTHORS.md
|
|
193
|
+
[community]: https://github.com/ahmetelgun/flask-mongoengine2/blob/main/AUTHORS.md
|
|
194
194
|
|
|
195
195
|
[tickets]: https://github.com/ahmetelgun/flask-mongoengine2/issues?state=open
|
|
196
196
|
|
|
197
197
|
[PEP8]: http://www.python.org/dev/peps/pep-0008/
|
|
198
198
|
|
|
199
|
-
[
|
|
199
|
+
[ruff]: https://docs.astral.sh/ruff/
|
|
200
200
|
|
|
201
201
|
[pre-commit]: https://pre-commit.com/
|
|
202
202
|
|
|
@@ -210,7 +210,7 @@ Any pull requests without tests will take longer to be integrated and might be r
|
|
|
210
210
|
|
|
211
211
|
[mongodb]: https://www.mongodb.com/
|
|
212
212
|
|
|
213
|
-
[AUTHORS.md]: AUTHORS.md
|
|
213
|
+
[AUTHORS.md]: https://github.com/ahmetelgun/flask-mongoengine2/blob/main/AUTHORS.md
|
|
214
214
|
|
|
215
215
|
[documentation]: https://flask-mongoengine2.readthedocs.io
|
|
216
216
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# BSD 3-Clause License
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2010-2024, the respective contributors, as shown by
|
|
4
|
-
the [AUTHORS.md](AUTHORS.md) file.
|
|
4
|
+
the [AUTHORS.md](https://github.com/ahmetelgun/flask-mongoengine2/blob/main/AUTHORS.md) file.
|
|
5
5
|
|
|
6
6
|
Redistribution and use in source and binary forms, with or without
|
|
7
7
|
modification, are permitted provided that the following conditions are
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
include MANIFEST.in
|
|
2
1
|
include README.md
|
|
3
2
|
include AUTHORS.md
|
|
4
3
|
include LICENSE.md
|
|
5
4
|
recursive-include flask_mongoengine2/templates *.html
|
|
6
5
|
recursive-include docs *
|
|
7
|
-
recursive-exclude docs *.pyc
|
|
8
|
-
recursive-exclude docs *.pyo
|
|
9
6
|
prune docs/_build
|
|
10
|
-
prune docs/_themes/.git
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flask-mongoengine2
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Summary: Flask extension that provides integration with MongoEngine.
|
|
5
|
+
Maintainer-email: Ahmet Elgün <ahmetelgn@gmail.com>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/ahmetelgun/flask-mongoengine2
|
|
8
|
+
Project-URL: Documentation, https://flask-mongoengine2.readthedocs.io
|
|
9
|
+
Project-URL: Repository, https://github.com/ahmetelgun/flask-mongoengine2
|
|
10
|
+
Project-URL: Changelog, https://github.com/ahmetelgun/flask-mongoengine2/releases
|
|
11
|
+
Keywords: flask,mongo,pymongo,mongoengine,extension
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Web Environment
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
25
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
26
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Classifier: Framework :: Flask
|
|
29
|
+
Requires-Python: >=3.10
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
License-File: LICENSE.md
|
|
32
|
+
Requires-Dist: Flask>=3.1.0
|
|
33
|
+
Requires-Dist: mongoengine<0.30,>=0.29.1
|
|
34
|
+
Requires-Dist: pymongo<5,>=4.18.3
|
|
35
|
+
Provides-Extra: toolbar
|
|
36
|
+
Requires-Dist: Flask-DebugToolbar>=0.15.0; extra == "toolbar"
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
41
|
+
Requires-Dist: pytest-mock; extra == "dev"
|
|
42
|
+
Requires-Dist: nox; extra == "dev"
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
# Flask-MongoEngine2
|
|
46
|
+
|
|
47
|
+
[](https://badge.fury.io/py/flask-mongoengine2)
|
|
48
|
+
[](https://github.com/ahmetelgun/flask-mongoengine2/actions/workflows/tests.yml)
|
|
49
|
+
[](https://flask-mongoengine2.readthedocs.io/en/latest/?badge=latest)
|
|
50
|
+

|
|
51
|
+

|
|
52
|
+
|
|
53
|
+
Flask-MongoEngine2 is a Flask extension that provides integration with [MongoEngine]
|
|
54
|
+
and [FlaskDebugToolbar]:
|
|
55
|
+
|
|
56
|
+
- Connection management from Flask configuration, including multiple databases.
|
|
57
|
+
- `Document` classes with `get_or_404`, `first_or_404` and pagination helpers.
|
|
58
|
+
- Server side sessions stored in MongoDB.
|
|
59
|
+
- MongoDB panel for [FlaskDebugToolbar], based on [pymongo] command monitoring.
|
|
60
|
+
|
|
61
|
+
## Supported versions
|
|
62
|
+
|
|
63
|
+
| Dependency | Version |
|
|
64
|
+
|-------------|-------------------|
|
|
65
|
+
| Python | 3.10 - 3.14 |
|
|
66
|
+
| Flask | >= 3.1 |
|
|
67
|
+
| MongoEngine | >= 0.29.1, < 0.30 |
|
|
68
|
+
| PyMongo | >= 4.18.3, < 5 |
|
|
69
|
+
|
|
70
|
+
Use version 2.x if you need older Python, Flask or MongoEngine versions.
|
|
71
|
+
|
|
72
|
+
## Installation
|
|
73
|
+
|
|
74
|
+
By default, Flask-MongoEngine2 installs integration only between [Flask] and
|
|
75
|
+
[MongoEngine]:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install flask-mongoengine2
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Integration with [FlaskDebugToolbar] is optional and should be selected as extra
|
|
82
|
+
option, to limit amount of external dependencies in production environments:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install "flask-mongoengine2[toolbar]"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Quickstart
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from flask import Flask
|
|
92
|
+
from flask_mongoengine2 import MongoEngine
|
|
93
|
+
|
|
94
|
+
app = Flask(__name__)
|
|
95
|
+
app.config["MONGODB_SETTINGS"] = [
|
|
96
|
+
{
|
|
97
|
+
"db": "project1",
|
|
98
|
+
"host": "localhost",
|
|
99
|
+
"port": 27017,
|
|
100
|
+
"alias": "default",
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
db = MongoEngine(app) # or db = MongoEngine(); db.init_app(app)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class Todo(db.Document):
|
|
107
|
+
title = db.StringField(max_length=60)
|
|
108
|
+
comments = db.ListField(db.StringField())
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
@app.route("/todo/<todo_id>")
|
|
112
|
+
def show(todo_id):
|
|
113
|
+
todo = Todo.objects.get_or_404(id=todo_id, _message_404="Todo not found")
|
|
114
|
+
return todo.title
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
@app.route("/todos/<int:page>")
|
|
118
|
+
def todos(page):
|
|
119
|
+
pagination = Todo.objects.paginate(page=page, per_page=10)
|
|
120
|
+
return {"items": [t.title for t in pagination.items], "pages": pagination.pages}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Any MongoEngine field or helper is available on `db` (`db.StringField`,
|
|
124
|
+
`db.ReferenceField`, ...). `db.Document` and `db.DynamicDocument` use an extended
|
|
125
|
+
queryset with `get_or_404`, `first_or_404`, `paginate` and `paginate_field`.
|
|
126
|
+
|
|
127
|
+
## Flask configuration
|
|
128
|
+
|
|
129
|
+
Flask-MongoEngine2 does not provide any configuration defaults. User is responsible
|
|
130
|
+
for setting up correct database settings, to exclude any possible misconfiguration
|
|
131
|
+
and data corruption.
|
|
132
|
+
|
|
133
|
+
`MONGODB_SETTINGS` (a dict, or a list of dicts for multiple connections) is the
|
|
134
|
+
recommended way. Each dictionary is passed to `mongoengine.connect`, so any
|
|
135
|
+
[pymongo] `MongoClient` option can be used. Flat `MONGODB_*` keys are deprecated.
|
|
136
|
+
|
|
137
|
+
Please refer to [complete connection settings description] for more info.
|
|
138
|
+
|
|
139
|
+
## Sessions
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
from flask_mongoengine2 import MongoEngineSessionInterface
|
|
143
|
+
|
|
144
|
+
app.session_interface = MongoEngineSessionInterface(db)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Session cookie follows Flask `SESSION_COOKIE_*` settings. Permanent sessions live
|
|
148
|
+
`PERMANENT_SESSION_LIFETIME`, others live `SESSION_TTL` (default `{"days": 1}`).
|
|
149
|
+
|
|
150
|
+
## Debug toolbar panel
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
from pymongo import monitoring
|
|
154
|
+
from flask_mongoengine2.panels import mongo_command_logger
|
|
155
|
+
|
|
156
|
+
monitoring.register(mongo_command_logger) # before database connection
|
|
157
|
+
app.config["DEBUG_TB_PANELS"] = ("flask_mongoengine2.panels.MongoDebugPanel",)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
See [debug toolbar documentation] for details.
|
|
161
|
+
|
|
162
|
+
## Usage and API documentation
|
|
163
|
+
|
|
164
|
+
Full project documentation available on [read the docs].
|
|
165
|
+
|
|
166
|
+
## Contributing and testing
|
|
167
|
+
|
|
168
|
+
We are welcome for contributors and testers! Check [Contribution guidelines].
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
Flask-MongoEngine2 is distributed under [BSD 3-Clause License].
|
|
173
|
+
|
|
174
|
+
[MongoEngine]: https://github.com/MongoEngine/mongoengine
|
|
175
|
+
|
|
176
|
+
[FlaskDebugToolbar]: https://github.com/pallets-eco/flask-debugtoolbar
|
|
177
|
+
|
|
178
|
+
[pymongo]: https://pymongo.readthedocs.io/en/stable/
|
|
179
|
+
|
|
180
|
+
[read the docs]: https://flask-mongoengine2.readthedocs.io/en/latest/
|
|
181
|
+
|
|
182
|
+
[complete connection settings description]: https://flask-mongoengine2.readthedocs.io/en/latest/flask_config.html
|
|
183
|
+
|
|
184
|
+
[debug toolbar documentation]: https://flask-mongoengine2.readthedocs.io/en/latest/debug_toolbar.html
|
|
185
|
+
|
|
186
|
+
[Flask]: https://github.com/pallets/flask
|
|
187
|
+
|
|
188
|
+
[BSD 3-Clause License]: LICENSE.md
|
|
189
|
+
|
|
190
|
+
[Contribution guidelines]: CONTRIBUTING.md
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Flask-MongoEngine2
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/py/flask-mongoengine2)
|
|
4
|
+
[](https://github.com/ahmetelgun/flask-mongoengine2/actions/workflows/tests.yml)
|
|
5
|
+
[](https://flask-mongoengine2.readthedocs.io/en/latest/?badge=latest)
|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
Flask-MongoEngine2 is a Flask extension that provides integration with [MongoEngine]
|
|
10
|
+
and [FlaskDebugToolbar]:
|
|
11
|
+
|
|
12
|
+
- Connection management from Flask configuration, including multiple databases.
|
|
13
|
+
- `Document` classes with `get_or_404`, `first_or_404` and pagination helpers.
|
|
14
|
+
- Server side sessions stored in MongoDB.
|
|
15
|
+
- MongoDB panel for [FlaskDebugToolbar], based on [pymongo] command monitoring.
|
|
16
|
+
|
|
17
|
+
## Supported versions
|
|
18
|
+
|
|
19
|
+
| Dependency | Version |
|
|
20
|
+
|-------------|-------------------|
|
|
21
|
+
| Python | 3.10 - 3.14 |
|
|
22
|
+
| Flask | >= 3.1 |
|
|
23
|
+
| MongoEngine | >= 0.29.1, < 0.30 |
|
|
24
|
+
| PyMongo | >= 4.18.3, < 5 |
|
|
25
|
+
|
|
26
|
+
Use version 2.x if you need older Python, Flask or MongoEngine versions.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
By default, Flask-MongoEngine2 installs integration only between [Flask] and
|
|
31
|
+
[MongoEngine]:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install flask-mongoengine2
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Integration with [FlaskDebugToolbar] is optional and should be selected as extra
|
|
38
|
+
option, to limit amount of external dependencies in production environments:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install "flask-mongoengine2[toolbar]"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Quickstart
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from flask import Flask
|
|
48
|
+
from flask_mongoengine2 import MongoEngine
|
|
49
|
+
|
|
50
|
+
app = Flask(__name__)
|
|
51
|
+
app.config["MONGODB_SETTINGS"] = [
|
|
52
|
+
{
|
|
53
|
+
"db": "project1",
|
|
54
|
+
"host": "localhost",
|
|
55
|
+
"port": 27017,
|
|
56
|
+
"alias": "default",
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
db = MongoEngine(app) # or db = MongoEngine(); db.init_app(app)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class Todo(db.Document):
|
|
63
|
+
title = db.StringField(max_length=60)
|
|
64
|
+
comments = db.ListField(db.StringField())
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@app.route("/todo/<todo_id>")
|
|
68
|
+
def show(todo_id):
|
|
69
|
+
todo = Todo.objects.get_or_404(id=todo_id, _message_404="Todo not found")
|
|
70
|
+
return todo.title
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@app.route("/todos/<int:page>")
|
|
74
|
+
def todos(page):
|
|
75
|
+
pagination = Todo.objects.paginate(page=page, per_page=10)
|
|
76
|
+
return {"items": [t.title for t in pagination.items], "pages": pagination.pages}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Any MongoEngine field or helper is available on `db` (`db.StringField`,
|
|
80
|
+
`db.ReferenceField`, ...). `db.Document` and `db.DynamicDocument` use an extended
|
|
81
|
+
queryset with `get_or_404`, `first_or_404`, `paginate` and `paginate_field`.
|
|
82
|
+
|
|
83
|
+
## Flask configuration
|
|
84
|
+
|
|
85
|
+
Flask-MongoEngine2 does not provide any configuration defaults. User is responsible
|
|
86
|
+
for setting up correct database settings, to exclude any possible misconfiguration
|
|
87
|
+
and data corruption.
|
|
88
|
+
|
|
89
|
+
`MONGODB_SETTINGS` (a dict, or a list of dicts for multiple connections) is the
|
|
90
|
+
recommended way. Each dictionary is passed to `mongoengine.connect`, so any
|
|
91
|
+
[pymongo] `MongoClient` option can be used. Flat `MONGODB_*` keys are deprecated.
|
|
92
|
+
|
|
93
|
+
Please refer to [complete connection settings description] for more info.
|
|
94
|
+
|
|
95
|
+
## Sessions
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from flask_mongoengine2 import MongoEngineSessionInterface
|
|
99
|
+
|
|
100
|
+
app.session_interface = MongoEngineSessionInterface(db)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Session cookie follows Flask `SESSION_COOKIE_*` settings. Permanent sessions live
|
|
104
|
+
`PERMANENT_SESSION_LIFETIME`, others live `SESSION_TTL` (default `{"days": 1}`).
|
|
105
|
+
|
|
106
|
+
## Debug toolbar panel
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from pymongo import monitoring
|
|
110
|
+
from flask_mongoengine2.panels import mongo_command_logger
|
|
111
|
+
|
|
112
|
+
monitoring.register(mongo_command_logger) # before database connection
|
|
113
|
+
app.config["DEBUG_TB_PANELS"] = ("flask_mongoengine2.panels.MongoDebugPanel",)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
See [debug toolbar documentation] for details.
|
|
117
|
+
|
|
118
|
+
## Usage and API documentation
|
|
119
|
+
|
|
120
|
+
Full project documentation available on [read the docs].
|
|
121
|
+
|
|
122
|
+
## Contributing and testing
|
|
123
|
+
|
|
124
|
+
We are welcome for contributors and testers! Check [Contribution guidelines].
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
Flask-MongoEngine2 is distributed under [BSD 3-Clause License].
|
|
129
|
+
|
|
130
|
+
[MongoEngine]: https://github.com/MongoEngine/mongoengine
|
|
131
|
+
|
|
132
|
+
[FlaskDebugToolbar]: https://github.com/pallets-eco/flask-debugtoolbar
|
|
133
|
+
|
|
134
|
+
[pymongo]: https://pymongo.readthedocs.io/en/stable/
|
|
135
|
+
|
|
136
|
+
[read the docs]: https://flask-mongoengine2.readthedocs.io/en/latest/
|
|
137
|
+
|
|
138
|
+
[complete connection settings description]: https://flask-mongoengine2.readthedocs.io/en/latest/flask_config.html
|
|
139
|
+
|
|
140
|
+
[debug toolbar documentation]: https://flask-mongoengine2.readthedocs.io/en/latest/debug_toolbar.html
|
|
141
|
+
|
|
142
|
+
[Flask]: https://github.com/pallets/flask
|
|
143
|
+
|
|
144
|
+
[BSD 3-Clause License]: LICENSE.md
|
|
145
|
+
|
|
146
|
+
[Contribution guidelines]: CONTRIBUTING.md
|
|
@@ -17,7 +17,7 @@ integration or feature.
|
|
|
17
17
|
|
|
18
18
|
## Supported interpreters
|
|
19
19
|
|
|
20
|
-
Flask-MongoEngine2 supports CPython 3.
|
|
20
|
+
Flask-MongoEngine2 supports CPython 3.10 and newer. Language features
|
|
21
21
|
not supported by all interpreters can not be used.
|
|
22
22
|
|
|
23
23
|
## Running tests
|
|
@@ -165,8 +165,8 @@ Rendered documentation will be available under: <http://localhost:9812/>
|
|
|
165
165
|
- Developers should avoid including typing information to docstrings, if possible.
|
|
166
166
|
- Developers should avoid including typing information to docstrings and signatures
|
|
167
167
|
in same objects, to avoid rendering conflicts.
|
|
168
|
-
- Code formatting is completely done by [
|
|
169
|
-
implementation of [PEP8]. Target python version is the lowest supported version.
|
|
168
|
+
- Code formatting and linting is completely done by [ruff] (black compatible style
|
|
169
|
+
implementation of [PEP8]). Target python version is the lowest supported version.
|
|
170
170
|
- Code formatting should be done before passing any new merge requests.
|
|
171
171
|
- Code style should use f-strings if possible, exceptional can be made for expensive
|
|
172
172
|
debug level logging statements.
|
|
@@ -190,13 +190,13 @@ All tests are run on [GitHub actions] and any pull requests are automatically te
|
|
|
190
190
|
for full range of supported [Flask], [mongoengine], [python] and [mongodb] versions.
|
|
191
191
|
Any pull requests without tests will take longer to be integrated and might be refused.
|
|
192
192
|
|
|
193
|
-
[community]: AUTHORS.md
|
|
193
|
+
[community]: https://github.com/ahmetelgun/flask-mongoengine2/blob/main/AUTHORS.md
|
|
194
194
|
|
|
195
195
|
[tickets]: https://github.com/ahmetelgun/flask-mongoengine2/issues?state=open
|
|
196
196
|
|
|
197
197
|
[PEP8]: http://www.python.org/dev/peps/pep-0008/
|
|
198
198
|
|
|
199
|
-
[
|
|
199
|
+
[ruff]: https://docs.astral.sh/ruff/
|
|
200
200
|
|
|
201
201
|
[pre-commit]: https://pre-commit.com/
|
|
202
202
|
|
|
@@ -210,7 +210,7 @@ Any pull requests without tests will take longer to be integrated and might be r
|
|
|
210
210
|
|
|
211
211
|
[mongodb]: https://www.mongodb.com/
|
|
212
212
|
|
|
213
|
-
[AUTHORS.md]: AUTHORS.md
|
|
213
|
+
[AUTHORS.md]: https://github.com/ahmetelgun/flask-mongoengine2/blob/main/AUTHORS.md
|
|
214
214
|
|
|
215
215
|
[documentation]: https://flask-mongoengine2.readthedocs.io
|
|
216
216
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# BSD 3-Clause License
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2010-2024, the respective contributors, as shown by
|
|
4
|
-
the [AUTHORS.md](AUTHORS.md) file.
|
|
4
|
+
the [AUTHORS.md](https://github.com/ahmetelgun/flask-mongoengine2/blob/main/AUTHORS.md) file.
|
|
5
5
|
|
|
6
6
|
Redistribution and use in source and binary forms, with or without
|
|
7
7
|
modification, are permitted provided that the following conditions are
|