Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Python Requirements Update (with fix for pylint 2.15 compatibility) #208

Merged
merged 4 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ html_coverage: ## Generate HTML coverage report

quality: ## Run quality checks
${VENV_BIN}/pycodestyle --config=pycodestyle blockstore *.py
${VENV_BIN}/pylint --django-settings-module=blockstore.settings.test --rcfile=pylintrc blockstore *.py
${VENV_BIN}/pylint --django-settings-module=blockstore.settings.test blockstore *.py
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary to specify pylintrc as it's the default config file used.


validate: test quality ## Run tests and quality checks

Expand Down
2 changes: 1 addition & 1 deletion blockstore/apps/bundles/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from django.core.files.base import ContentFile, File
from django.dispatch import Signal
import attr
from pyblake2 import blake2b
from pyblake2 import blake2b # pylint:disable=no-name-in-module
bradenmacdonald marked this conversation as resolved.
Show resolved Hide resolved

from .links import Dependency, Link, LinkCollection, LinkChangeSet
from .storage import default_asset_storage
Expand Down
2 changes: 1 addition & 1 deletion blockstore/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
urlpatterns += make_docs_urls(api_info)

if settings.DEBUG: # pragma: no cover
import debug_toolbar # pylint: disable=import-error
import debug_toolbar # pylint: disable=import-error,useless-suppression
urlpatterns.append(url(r'^__debug__/', include(debug_toolbar.urls)))

if settings.DEBUG or os.environ['DJANGO_SETTINGS_MODULE'] == 'blockstore.settings.test':
Expand Down
9 changes: 5 additions & 4 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@
# SERIOUSLY.
#
# ------------------------------
# Generated by edx-lint version: 5.2.5
# Generated by edx-lint version: 5.3.0
# ------------------------------
[MASTER]
ignore = ,migrations, settings, setup.py, wsgi.py
persistent = yes
load-plugins = edx_lint.pylint,pylint_django,pylint_celery
init-hook = 'import sys; sys.path.append("")'

[MESSAGES CONTROL]
enable =
Expand Down Expand Up @@ -285,7 +286,7 @@ disable =
feature-toggle-needs-doc,
illegal-waffle-usage,

logging-fstring-interpolation,,invalid-name
logging-fstring-interpolation,,invalid-name,unsupported-binary-operation

[REPORTS]
output-format = text
Expand Down Expand Up @@ -326,7 +327,7 @@ ignore-imports = no

[TYPECHECK]
ignore-mixin-members = yes
ignored-classes = _CountingAttr
ignored-classes = SQLObject
unsafe-load-any-extension = yes
generated-members =
REQUEST,
Expand Down Expand Up @@ -382,4 +383,4 @@ int-import-graph =
[EXCEPTIONS]
overgeneral-exceptions = Exception

# af4b89c321cd6c4fd061d9367951e9d91f546565
# 3a1a71317c6216efa3b67e5336f5665ba2fbeb12
12 changes: 6 additions & 6 deletions pylintrc_tweaks
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[MASTER]
ignore+= ,migrations, settings, setup.py, wsgi.py
# For some reason, pylint 2.15+ isn't working without this fix. Normally
# sys.path contains "" as the first entry, but for some reason it's missing.
init-hook='import sys; sys.path.append("")'

[BASIC]
const-rgx = (([A-Z_][A-Z0-9_]*)|(__.*__)|log|urlpatterns|logger|User)$

[MESSAGES CONTROL]
DISABLE+= ,invalid-name

# Our version of pylint doesn't understand attr() generated classes.
# Can remove this once edx-lint is updated to the latest pylint
[TYPECHECK]
ignored-classes=_CountingAttr
# The 'unsupported-binary-operation' check needs to be disabled on Python<3.10 but can be left enabled once we upgrade
# to 3.10+
DISABLE+= ,invalid-name,unsupported-binary-operation
30 changes: 16 additions & 14 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ asgiref==3.5.2
# via django
attrs==22.1.0
# via -r requirements/base.in
certifi==2022.6.15
certifi==2022.9.24
# via requests
cffi==1.15.1
# via
Expand All @@ -24,15 +24,15 @@ coreschema==0.0.4
# via
# coreapi
# drf-yasg
cryptography==37.0.4
cryptography==38.0.1
# via
# pyjwt
# social-auth-core
defusedxml==0.7.1
# via
# python3-openid
# social-auth-core
django==3.2.15
django==3.2.16
# via
# -c requirements/common_constraints.txt
# -c requirements/constraints.txt
Expand All @@ -52,29 +52,29 @@ django-environ==0.9.0
# via -r requirements/base.in
django-filter==22.1
# via -r requirements/base.in
django-waffle==2.7.0
django-waffle==3.0.0
# via
# -r requirements/base.in
# edx-django-utils
djangorestframework==3.13.1
djangorestframework==3.14.0
# via
# -r requirements/base.in
# drf-nested-routers
# drf-yasg
# edx-api-doc-tools
drf-nested-routers==0.93.4
# via -r requirements/base.in
drf-yasg==1.21.3
drf-yasg==1.21.4
# via edx-api-doc-tools
edx-api-doc-tools==1.6.0
# via -r requirements/base.in
edx-auth-backends==4.1.0
# via -r requirements/base.in
edx-django-release-util==1.2.0
# via -r requirements/base.in
edx-django-utils==5.0.0
edx-django-utils==5.2.0
# via -r requirements/base.in
idna==3.3
idna==3.4
# via requests
inflection==0.5.1
# via drf-yasg
Expand All @@ -86,23 +86,23 @@ markupsafe==2.1.1
# via jinja2
mysqlclient==2.1.1
# via -r requirements/base.in
newrelic==8.0.0.179
newrelic==8.2.1
# via edx-django-utils
oauthlib==3.2.0
oauthlib==3.2.1
# via
# requests-oauthlib
# social-auth-core
packaging==21.3
# via drf-yasg
pbr==5.10.0
# via stevedore
psutil==5.9.1
psutil==5.9.2
# via edx-django-utils
pyblake2==1.1.2
# via -r requirements/base.in
pycparser==2.21
# via cffi
pyjwt[crypto]==2.4.0
pyjwt[crypto]==2.5.0
# via
# edx-auth-backends
# social-auth-core
Expand All @@ -112,7 +112,7 @@ pyparsing==3.0.9
# via packaging
python3-openid==3.2.0
# via social-auth-core
pytz==2022.2.1
pytz==2022.4
# via
# -r requirements/base.in
# django
Expand Down Expand Up @@ -141,12 +141,14 @@ social-auth-core==4.3.0
# via
# edx-auth-backends
# social-auth-app-django
sqlparse==0.4.2
sqlparse==0.4.3
# via
# -r requirements/base.in
# django
stevedore==4.0.0
# via edx-django-utils
types-cryptography==3.3.23
# via pyjwt
uritemplate==4.1.1
# via
# coreapi
Expand Down
2 changes: 2 additions & 0 deletions requirements/common_constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Django<4.0
# elastic search changelog: https://www.elastic.co/guide/en/enterprise-search/master/release-notes-7.14.0.html
elasticsearch<7.14.0

# setuptools==60.0 had breaking changes and busted several service's pipeline.
# Details can be found here: https://github.com/pypa/setuptools/issues/2940
setuptools<60

# django-simple-history>3.0.0 adds indexing and causes a lot of migrations to be affected
Expand Down
14 changes: 5 additions & 9 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with python 3.8
# This file is autogenerated by pip-compile with python 3.10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: why is the header updated to Python 3.10 in local.txt, docs.txt, and test.txt, but not, e.g. for production.txt? I thought the make upgrade command would upgrade it for all files.
Using Python 3.10 with make upgrade could potentially update packages to versions that are no longer compatible with Python 3.8, which is fine for the CI, but not so fine for production requirements. We may want to be consistent here and use only Python 3.8 unless we test both versions in the CI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, my bad. I tried not to commit the "3.10" but missed a couple. And you're right, better to run it with 3.8 in the first place, so that's what I've done now. I don't think it changed anything besides a comment about which packages depend on typing-extensions

# To update, run:
#
# make upgrade
Expand All @@ -8,20 +8,18 @@ alabaster==0.7.12
# via sphinx
babel==2.10.3
# via sphinx
certifi==2022.6.15
certifi==2022.9.24
# via requests
charset-normalizer==2.1.1
# via requests
docutils==0.19
# via sphinx
edx-sphinx-theme==3.0.0
# via -r requirements/docs.in
idna==3.3
idna==3.4
# via requests
imagesize==1.4.1
# via sphinx
importlib-metadata==4.12.0
# via sphinx
jinja2==3.1.2
# via sphinx
markupsafe==2.1.1
Expand All @@ -32,15 +30,15 @@ pygments==2.13.0
# via sphinx
pyparsing==3.0.9
# via packaging
pytz==2022.2.1
pytz==2022.4
# via babel
requests==2.28.1
# via sphinx
six==1.16.0
# via edx-sphinx-theme
snowballstemmer==2.2.0
# via sphinx
sphinx==5.1.1
sphinx==5.2.3
# via
# -r requirements/docs.in
# edx-sphinx-theme
Expand All @@ -58,5 +56,3 @@ sphinxcontrib-serializinghtml==1.1.5
# via sphinx
urllib3==1.26.12
# via requests
zipp==3.8.1
# via importlib-metadata
Loading