Skip to content

Commit 2ea9096

Browse files
committed
Update dependencies to latest versions
This includes several code fixes to make the latest mypy/pylint happy as well as simplification to the requirements files. Our doc build script already installs the dev deps so we can simplify things and consolidate them all into a single requirements file.
1 parent a53d897 commit 2ea9096

13 files changed

+113
-122
lines changed

.github/workflows/run-tests.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
python-version: ${{ matrix.python-version }}
2121
- name: Install dependencies
2222
run: |
23-
pip install -r requirements-dev.txt -r requirements-docs.txt
23+
pip install -r requirements-dev.txt
2424
pip install --upgrade --upgrade-strategy eager -e .
2525
- name: Run PRCheck
2626
run: make prcheck
@@ -43,7 +43,7 @@ jobs:
4343
run: npm install -g aws-cdk
4444
- name: Install dependencies
4545
run: |
46-
pip install -r requirements-dev.txt -r requirements-docs.txt
46+
pip install -r requirements-dev.txt
4747
pip install -e .[${{ matrix.cdk-version }}]
4848
- name: Run CDK tests
4949
run: python -m pytest tests/functional/cdk
@@ -69,7 +69,7 @@ jobs:
6969
# python-version: ${{ matrix.python-version }}
7070
# - name: Install dependencies
7171
# run: |
72-
# pip install -r requirements-dev.txt -r requirements-docs.txt
72+
# pip install -r requirements-dev.txt
7373
# pip install -e .
7474
# - name: Run PRCheck
7575
# run: python -m pytest tests/unit tests/functional tests/integration

.pylintrc

+1-50
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@ unsafe-load-any-extension=no
3030
# run arbitrary code
3131
extension-pkg-whitelist=
3232

33-
# Allow optimization of some AST trees. This will activate a peephole AST
34-
# optimizer, which will apply various small optimizations. For instance, it can
35-
# be used to obtain the result of joining multiple strings with the addition
36-
# operator. Joining a lot of strings can lead to a maximum recursion error in
37-
# Pylint and this flag can prevent that. It has one side effect, the resulting
38-
# AST will be different than the one from reality.
39-
optimize-ast=no
40-
4133

4234
[MESSAGES CONTROL]
4335

@@ -59,7 +51,7 @@ confidence=
5951
# --enable=similarities". If you want to run only the classes checker, but have
6052
# no Warning level messages displayed, use"--disable=all --enable=classes
6153
# --disable=W"
62-
disable=R0201,W0613,I0021,I0020,C0111,W1618,W1619,R0902,R0903,W0231,W0611,R0913,W0703,C0330,R0204,I0011,R0904,R0205,R1705,R1710,W0403,C0415,R1725,W0707,R1732,W1512,C0209,W1514
54+
disable=W0613,I0021,I0020,C0111,R0902,R0903,W0231,W0611,R0913,W0703,I0011,R0904,R0205,R1705,R1710,C0415,R1725,W0707,R1732,W1512,C0209,W1514
6355

6456

6557
[REPORTS]
@@ -69,11 +61,6 @@ disable=R0201,W0613,I0021,I0020,C0111,W1618,W1619,R0902,R0903,W0231,W0611,R0913,
6961
# mypackage.mymodule.MyReporterClass.
7062
output-format=text
7163

72-
# Put messages in a separate file for each module / package specified on the
73-
# command line instead of printing them on stdout. Reports (if any) will be
74-
# written in a file name "pylint_global.[txt|html]".
75-
files-output=no
76-
7764
# Tells whether to display a full report or only the messages
7865
reports=no
7966

@@ -91,9 +78,6 @@ evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / stateme
9178

9279
[BASIC]
9380

94-
# List of builtins function names that should not be used, separated by a comma
95-
bad-functions=apply,reduce
96-
9781
# Good variable names which should always be accepted, separated by a comma
9882
good-names=e,i,j,k,n,ex,Run,_
9983

@@ -110,65 +94,35 @@ include-naming-hint=no
11094
# Regular expression matching correct function names
11195
function-rgx=[a-z_][a-z0-9_]{2,50}$
11296

113-
# Naming hint for function names
114-
function-name-hint=[a-z_][a-z0-9_]{2,30}$
115-
11697
# Regular expression matching correct variable names
11798
variable-rgx=[a-z_][a-z0-9_]{0,50}$
11899

119-
# Naming hint for variable names
120-
variable-name-hint=[a-z_][a-z0-9_]{2,40}$
121-
122100
# Regular expression matching correct constant names
123101
const-rgx=(([a-zA-Z_][a-zA-Z0-9_]*)|(__.*__))$
124102

125-
# Naming hint for constant names
126-
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
127-
128103
# Regular expression matching correct attribute names
129104
attr-rgx=[a-z_][a-z0-9_]{1,50}$
130105

131-
# Naming hint for attribute names
132-
attr-name-hint=[a-z_][a-z0-9_]{2,40}$
133-
134106
# Regular expression matching correct argument names
135107
argument-rgx=[a-z_][a-z0-9_]{0,50}$
136108

137-
# Naming hint for argument names
138-
argument-name-hint=[a-z_][a-z0-9_]{2,40}$
139-
140109
# Regular expression matching correct class attribute names
141110
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,40}|(__.*__))$
142111

143-
# Naming hint for class attribute names
144-
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,40}|(__.*__))$
145-
146112
# Regular expression matching correct inline iteration names
147113
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
148114

149-
# Naming hint for inline iteration names
150-
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
151-
152115
# Regular expression matching correct class names
153116
class-rgx=[A-Z_][a-zA-Z0-9]+$
154117

155-
# Naming hint for class names
156-
class-name-hint=[A-Z_][a-zA-Z0-9]+$
157-
158118
# Regular expression matching correct module names
159119
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
160120

161-
# Naming hint for module names
162-
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
163-
164121
# Regular expression matching correct method names
165122
# Allow for the ast visitor method names of visit_CamelCase.
166123
# Allow for do_HTTPMETHOD used in chalice local.
167124
method-rgx=([a-z_][a-z0-9_]{2,50}|visit_[a-zA-Z]+|do_[A-Z]+)$
168125

169-
# Naming hint for method names
170-
method-name-hint=[a-z_][a-z0-9_]{2,40}$
171-
172126
# Regular expression which should only match function or class names that do
173127
# not require a docstring.
174128
no-docstring-rgx=.*
@@ -190,9 +144,6 @@ ignore-long-lines=^\s*(# )?<?https?://\S+>?$
190144
# else.
191145
single-line-if-stmt=no
192146

193-
# List of optional constructs for which whitespace checking is disabled
194-
no-space-check=trailing-comma,dict-separator
195-
196147
# Maximum number of lines in a module
197148
max-module-lines=1000
198149

CONTRIBUTING.rst

-5
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,6 @@ adding new features, install ``requirements-dev.txt``::
8989
$ pip install -r requirements-dev.txt
9090

9191

92-
If you'd like to just build the docs, install ``requirements-docs.txt``::
93-
94-
$ pip install -r requirements-docs.txt
95-
96-
9792
Running Tests
9893
-------------
9994

chalice/awsclient.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
RequestsConnectionError
3636
from botocore.vendored.requests.exceptions import ReadTimeout as \
3737
RequestsReadTimeout
38-
from mypy_extensions import TypedDict
38+
from typing_extensions import TypedDict
3939

4040
from chalice.constants import DEFAULT_STAGE_NAME
4141
from chalice.constants import MAX_LAMBDA_DEPLOYMENT_SIZE

chalice/deploy/models.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ def create(cls, str_version):
3636
return None
3737

3838

39-
Type = TypeVar('Type')
40-
DV = Union[Placeholder, Type]
39+
T = TypeVar('T')
40+
DV = Union[Placeholder, T]
4141
StrMap = Dict[str, str]
4242

4343

chalice/deploy/packager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ def _check_valid_package(self, package_filename):
389389
# i.e remove that LambdaLayer model from the app.
390390
with self._osutils.open_zip(package_filename,
391391
'r', self._osutils.ZIP_DEFLATED) as z:
392-
total_size = sum([f.file_size for f in z.infolist()])
392+
total_size = sum(f.file_size for f in z.infolist())
393393
# We have to check the total archive size, Lambda will still error
394394
# out if you have a zip file with all empty files. It's not enough
395395
# to check if the zipfile is empty.

chalice/deploy/sweeper.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Union,
88
Sequence,
99
cast,
10+
NoReturn,
1011
)
1112

1213
from chalice.config import Config, DeployedResources # noqa
@@ -370,10 +371,10 @@ def _delete_websocket_api(self, resource_values):
370371
'message': msg
371372
}
372373

373-
def _default_delete(self, resource_values):
374-
# type: (Dict[str, Any]) -> None
374+
def _default_delete(self, *resource_values):
375+
# type: (Any) -> NoReturn
375376
err_msg = "Sweeper encountered an unknown resource: %s" % \
376-
resource_values
377+
str(resource_values)
377378
raise RuntimeError(err_msg)
378379

379380
def _update_plan(self, instructions, message=None, insert=False):

chalice/package.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ def _add_websocket_domain_name(self, resource, template):
756756
{'CertificateArn': domain_name.certificate_arn,
757757
'EndpointType': 'REGIONAL'},
758758
]
759-
}
759+
} # type: Dict[str, Any]
760760
if domain_name.tags:
761761
properties['Tags'] = domain_name.tags
762762
template['Resources'][cfn_name] = {
@@ -1655,11 +1655,10 @@ def _get_value(self, loader, node):
16551655
# type: (yaml.SafeLoader, Node) -> Any
16561656
if node.tag[1:] == 'GetAtt' and isinstance(node.value,
16571657
six.string_types):
1658-
value = node.value.split('.', 1)
1658+
return node.value.split('.', 1)
16591659
elif isinstance(node, ScalarNode):
1660-
value = loader.construct_scalar(node)
1660+
return loader.construct_scalar(node)
16611661
elif isinstance(node, SequenceNode):
1662-
value = loader.construct_sequence(node)
1662+
return loader.construct_sequence(node)
16631663
else:
1664-
value = loader.construct_mapping(node)
1665-
return value
1664+
return loader.construct_mapping(node)

requirements-dev.in

+9-8
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@ pylint<3.0.0
44
websocket-client<2.0.0
55
hypothesis
66
coverage
7-
doc8
7+
doc8<1.0.0
88
pydocstyle
99
flake8
1010
pytest-cov
1111
requests
12-
# Sphinx doesn't support 0.18.x yet.
13-
docutils<0.18.0
14-
# There are some py3 specific changes we'll need
15-
# to make before we can upgrade mypy, so we're holding
16-
# off on upgrading this for now.
17-
mypy==0.812
18-
mypy-extensions
12+
Sphinx==4.3.2
13+
docutils
14+
mypy
15+
typing-extensions
1916
wheel
2017
pygments
2118
mock
19+
types-six
20+
types-python-dateutil
21+
types-PyYAML
22+
attrs<21.5.0

0 commit comments

Comments
 (0)