Skip to content

Commit d3daf6d

Browse files
authored
Merge pull request #2715 from bagerard/fix_pipeline
Fix outdated pre-commit hook + flake8 fix
2 parents c8ef07a + 85ff449 commit d3daf6d

File tree

5 files changed

+43
-39
lines changed

5 files changed

+43
-39
lines changed

.github/workflows/github-actions.yml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,45 +35,46 @@ jobs:
3535
runs-on: ubuntu-latest
3636
steps:
3737
- uses: actions/checkout@v2
38-
- name: Set up Python 3.7
39-
uses: actions/setup-python@v2
38+
- uses: actions/setup-python@v4
4039
with:
41-
python-version: 3.7
40+
python-version: '3.9'
41+
check-latest: true
4242
- run: bash .github/workflows/install_ci_python_dep.sh
4343
- run: pre-commit run -a
4444

4545
test:
4646
# Test suite run against recent python versions
4747
# and against a few combination of MongoDB and pymongo
48-
runs-on: ubuntu-latest
48+
runs-on: ubuntu-20.04
4949
strategy:
5050
fail-fast: false
5151
matrix:
52-
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", pypy3]
52+
python-version: [3.7, 3.8, 3.9, "3.10", 3.11, pypy3.9]
5353
MONGODB: [$MONGODB_4_0]
5454
PYMONGO: [$PYMONGO_3_11]
5555
include:
5656
- python-version: 3.7
5757
MONGODB: $MONGODB_3_6
5858
PYMONGO: $PYMONGO_3_9
59-
- python-version: 3.7
59+
- python-version: 3.8
6060
MONGODB: $MONGODB_4_4
6161
PYMONGO: $PYMONGO_3_11
62-
- python-version: 3.7
62+
- python-version: 3.9
6363
MONGODB: $MONGODB_4_4
6464
PYMONGO: $PYMONGO_3_12
65-
- python-version: 3.9
65+
- python-version: "3.10"
6666
MONGODB: $MONGODB_4_4
6767
PYMONGO: $PYMONGO_4_0
68-
- python-version: "3.10"
68+
- python-version: "3.11"
6969
MONGODB: $MONGODB_5_0
7070
PYMONGO: $PYMONGO_4_3
7171
steps:
7272
- uses: actions/checkout@v2
7373
- name: Set up Python ${{ matrix.python-version }}
74-
uses: actions/setup-python@v2
74+
uses: actions/setup-python@v4
7575
with:
7676
python-version: ${{ matrix.python-version }}
77+
check-latest: true
7778
- name: install mongo and ci dependencies
7879
run: |
7980
bash .github/workflows/install_mongo.sh ${{ matrix.MONGODB }}
@@ -97,9 +98,10 @@ jobs:
9798
steps:
9899
- uses: actions/checkout@v2
99100
- name: Set up Python ${{ matrix.python-version }}
100-
uses: actions/setup-python@v2
101+
uses: actions/setup-python@v4
101102
with:
102103
python-version: 3.7
104+
check-latest: true
103105
- name: install python dep
104106
run: |
105107
pip install -e .
@@ -115,10 +117,10 @@ jobs:
115117
if: github.event_name != 'pull_request'
116118
steps:
117119
- uses: actions/checkout@master
118-
- name: Set up Python 3.7
119-
uses: actions/setup-python@v1
120+
- uses: actions/setup-python@v4
120121
with:
121-
python-version: 3.7
122+
python-version: 3.9
123+
check-latest: true
122124
- name: build dummy wheel for test-pypi
123125
run: |
124126
pip install wheel
@@ -138,10 +140,11 @@ jobs:
138140
if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v')
139141
steps:
140142
- uses: actions/checkout@master
141-
- name: Set up Python 3.7
142-
uses: actions/setup-python@v1
143+
- name: Set up Python 3.9
144+
uses: actions/setup-python@v4
143145
with:
144-
python-version: 3.7
146+
python-version: 3.9
147+
check-latest: true
145148
# todo separate build from publish
146149
# https://stackoverflow.com/questions/59349905/which-properties-does-github-event-in-a-github-workflow-have
147150
- name: build dummy wheel for test-pypi

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
fail_fast: false
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.3.0
4+
rev: v4.4.0
55
hooks:
66
- id: check-merge-conflict
77
- id: debug-statements
88
- id: trailing-whitespace
99
- id: end-of-file-fixer
1010
- repo: https://github.com/ambv/black
11-
rev: 22.10.0
11+
rev: 22.12.0
1212
hooks:
1313
- id: black
14-
- repo: https://gitlab.com/pycqa/flake8
15-
rev: 3.9.2
14+
- repo: https://github.com/pycqa/flake8
15+
rev: 6.0.0
1616
hooks:
1717
- id: flake8
1818
additional_dependencies:
1919
- importlib_metadata<5
2020
- repo: https://github.com/asottile/pyupgrade
21-
rev: v3.1.0
21+
rev: v3.3.1
2222
hooks:
2323
- id: pyupgrade
2424
args: [--py36-plus]
2525
- repo: https://github.com/pycqa/isort
26-
rev: 5.10.1
26+
rev: 5.11.4
2727
hooks:
2828
- id: isort

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Development
1010
- Support MONGODB-AWS authentication mechanism (with `authmechanismproperties`) #2507
1111
- Turning off dereferencing for the results of distinct query. #2663
1212
- Add tests against Mongo 5.0 in pipeline
13+
- Drop support for Python 3.6 (EOL)
1314

1415
Changes in 0.24.2
1516
=================

mongoengine/queryset/base.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,29 +1739,29 @@ def no_dereference(self):
17391739

17401740
def _item_frequencies_map_reduce(self, field, normalize=False):
17411741
map_func = """
1742-
function() {
1743-
var path = '{{~%(field)s}}'.split('.');
1742+
function() {{
1743+
var path = '{{{{~{field}}}}}'.split('.');
17441744
var field = this;
17451745
1746-
for (p in path) {
1746+
for (p in path) {{
17471747
if (typeof field != 'undefined')
17481748
field = field[path[p]];
17491749
else
17501750
break;
1751-
}
1752-
if (field && field.constructor == Array) {
1753-
field.forEach(function(item) {
1751+
}}
1752+
if (field && field.constructor == Array) {{
1753+
field.forEach(function(item) {{
17541754
emit(item, 1);
1755-
});
1756-
} else if (typeof field != 'undefined') {
1755+
}});
1756+
}} else if (typeof field != 'undefined') {{
17571757
emit(field, 1);
1758-
} else {
1758+
}} else {{
17591759
emit(null, 1);
1760-
}
1761-
}
1762-
""" % {
1763-
"field": field
1764-
}
1760+
}}
1761+
}}
1762+
""".format(
1763+
field=field
1764+
)
17651765
reduce_func = """
17661766
function(key, values) {
17671767
var total = 0;

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def run_tests(self):
8787
# import it as it depends on PyMongo and PyMongo isn't installed until this
8888
# file is read
8989
init = os.path.join(os.path.dirname(__file__), "mongoengine", "__init__.py")
90-
version_line = list(filter(lambda l: l.startswith("VERSION"), open(init)))[0]
90+
version_line = list(filter(lambda line: line.startswith("VERSION"), open(init)))[0]
9191

9292
VERSION = get_version(eval(version_line.split("=")[-1]))
9393

@@ -141,7 +141,7 @@ def run_tests(self):
141141
long_description=LONG_DESCRIPTION,
142142
platforms=["any"],
143143
classifiers=CLASSIFIERS,
144-
python_requires=">=3.6",
144+
python_requires=">=3.7",
145145
install_requires=["pymongo>=3.4,<5.0"],
146146
cmdclass={"test": PyTest},
147147
**extra_opts

0 commit comments

Comments
 (0)