Skip to content

Commit

Permalink
OEP-18 compliance, dependency upgrades (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbowman authored Jun 13, 2019
1 parent 2177d71 commit 963f832
Show file tree
Hide file tree
Showing 25 changed files with 404 additions and 52 deletions.
6 changes: 3 additions & 3 deletions .pep8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[pep8]
[pycodestyle]
ignore=E501
max_line_length=119
exclude=settings
max_line_length=120
exclude=.git,.tox,milestones/migrations,settings
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ before_install:
- export DJANGO_SETTINGS_MODULE=settings

install:
- make install
- make requirements
- pip freeze --all

script:
- make test

after_success: coveralls
after_success: codecov

deploy:
provider: pypi
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
include LICENSE
include README.md
include requirements/base.in
include requirements/test.in
47 changes: 42 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,50 @@
all: install quality test
.PHONY: clean help pii_check quality requirements selfcheck test upgrade validate

install-test:
pip install -q -r test_requirements.txt
.DEFAULT_GOAL := help

install: install-test
pip install -q -r requirements.txt
help: ## display this help message
@echo "Please use \`make <target>' where <target> is one of"
@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | sort | awk -F ':.*?## ' 'NF==2 {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}'

all: requirements quality test

clean: ## remove generated byte code, coverage reports, and build artifacts
find . -name '__pycache__' -exec rm -rf {} +
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
coverage erase
rm -fr build/
rm -fr dist/
rm -fr *.egg-info

pii_check: ## check for PII annotations on all Django models
tox -e pii_check

requirements:
pip install -qr requirements/dev.txt

quality:
tox -e quality

selfcheck: ## check that the Makefile is well-formed
@echo "The Makefile is well-formed."

test: ## run tests on every supported Python version
tox

upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
pip install -qr requirements/pip-tools.txt
# Make sure to compile files after any other files they include!
pip-compile --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in
pip-compile --upgrade -o requirements/base.txt requirements/base.in
pip-compile --upgrade -o requirements/test.txt requirements/test.in
pip-compile --upgrade -o requirements/quality.txt requirements/quality.in
pip-compile --upgrade -o requirements/travis.txt requirements/travis.in
pip-compile --upgrade -o requirements/dev.txt requirements/dev.in
# Let tox control the Django version for tests
sed '/^[dD]jango==/d' requirements/test.txt > requirements/test.tmp
mv requirements/test.tmp requirements/test.txt

validate: quality pii_check test ## run tests and quality checks
5 changes: 5 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env python
"""
Django administration utility.
"""

from __future__ import absolute_import, unicode_literals

import os
import sys

Expand Down
3 changes: 2 additions & 1 deletion milestones/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
Milestones app initialization module
"""
from __future__ import unicode_literals
__version__ = '0.2.2'

__version__ = '0.2.3'
6 changes: 0 additions & 6 deletions requirements.txt

This file was deleted.

7 changes: 7 additions & 0 deletions requirements/base.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Core requirements for using this application
-c constraints.txt

Django>=1.11,<2.0 # Web application framework
django-model-utils # Provides TimeStampedModel abstract base class
edx-opaque-keys>=0.2.1 # Create and introspect course and xblock identities
six # Utilities for supporting Python 2 & 3 in the same codebase
14 changes: 14 additions & 0 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# make upgrade
#
django-model-utils==3.1.2
django==1.11.21
edx-opaque-keys==1.0.1
pbr==5.2.1 # via stevedore
pymongo==3.8.0 # via edx-opaque-keys
pytz==2019.1 # via django
six==1.12.0
stevedore==1.30.1 # via edx-opaque-keys
12 changes: 12 additions & 0 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Version constraints for pip-installation.
#
# This file doesn't install any packages. It specifies version constraints
# that will be applied if a package is needed.
#
# When pinning something here, please provide an explanation of why. Ideally,
# link to other information that will help people in the future to remove the
# pin when possible. Writing an issue against the offending project and
# linking to it here is good.

# This packages is a backport which can only be installed on Python 2.7
futures ; python_version == "2.7"
6 changes: 6 additions & 0 deletions requirements/dev.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Additional requirements for development of this application
-c constraints.txt

-r pip-tools.txt # pip-tools and its dependencies, for managing requirements files
-r quality.txt # Core and quality check dependencies
-r travis.txt # tox and related dependencies
70 changes: 70 additions & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# make upgrade
#
argparse==1.4.0
astroid==1.5.3
backports.functools-lru-cache==1.5
caniusepython3==7.1.0
certifi==2019.3.9
chardet==3.0.4
click-log==0.3.2
click==7.0
code-annotations==0.3.1
codecov==2.0.15
configparser==3.7.4
contextlib2==0.5.5
coverage==4.5.3
distlib==0.2.9.post0
django-model-utils==3.1.2
django-nose==1.4.6
django==1.11.21
edx-lint==1.3.0
edx-opaque-keys==1.0.1
enum34==1.1.6
filelock==3.0.12
futures==3.2.0 ; python_version == "2.7"
idna==2.8
importlib-metadata==0.18
isort==4.3.20
jinja2==2.10.1
lazy-object-proxy==1.4.1
markupsafe==1.1.1
mccabe==0.6.1
nose==1.3.7
packaging==19.0
pathlib2==2.3.3
pbr==5.2.1
pip-tools==3.8.0
pluggy==0.12.0
py==1.8.0
pycodestyle==2.5.0
pydocstyle==3.0.0
pylint-celery==0.3
pylint-django==0.7.2
pylint-plugin-utils==0.5
pylint==1.7.6
pymongo==3.8.0
pyparsing==2.4.0
python-slugify==3.0.2
pytz==2019.1
pyyaml==5.1.1
requests==2.22.0
scandir==1.10.0
singledispatch==3.4.0.3
six==1.12.0
snowballstemmer==1.2.1
stevedore==1.30.1
text-unidecode==1.2
toml==0.10.0
tox-battery==0.5.1
tox==3.12.1
urllib3==1.25.3
virtualenv==16.6.0
wrapt==1.11.1
zipp==0.5.1

# The following packages are considered to be unsafe in a requirements file:
# setuptools==41.0.1 # via caniusepython3, tox
4 changes: 4 additions & 0 deletions requirements/pip-tools.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Just the dependencies to run pip-tools, mainly for the "upgrade" make target
-c constraints.txt

pip-tools # Contains pip-compile, used to generate pip requirements files
9 changes: 9 additions & 0 deletions requirements/pip-tools.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# make upgrade
#
click==7.0 # via pip-tools
pip-tools==3.8.0
six==1.12.0 # via pip-tools
10 changes: 10 additions & 0 deletions requirements/quality.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Requirements for code quality checks
-c constraints.txt

-r test.txt # Core and testing dependencies for this package

caniusepython3 # Additional Python 3 compatibility pylint checks
edx-lint # edX pylint rules and plugins
isort # to standardize order of imports
pycodestyle # PEP 8 compliance validation
pydocstyle # PEP 257 compliance validation
56 changes: 56 additions & 0 deletions requirements/quality.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# make upgrade
#
argparse==1.4.0 # via caniusepython3
astroid==1.5.3 # via pylint, pylint-celery
backports.functools-lru-cache==1.5 # via astroid, caniusepython3, isort, pylint
caniusepython3==7.1.0
certifi==2019.3.9 # via requests
chardet==3.0.4 # via requests
click-log==0.3.2 # via edx-lint
click==7.0
code-annotations==0.3.1
configparser==3.7.4 # via pydocstyle, pylint
coverage==4.5.3
distlib==0.2.9.post0 # via caniusepython3
django-model-utils==3.1.2
django-nose==1.4.6
django==1.11.21
edx-lint==1.3.0
edx-opaque-keys==1.0.1
enum34==1.1.6 # via astroid
futures==3.2.0 ; python_version == "2.7" # via caniusepython3, isort
idna==2.8 # via requests
isort==4.3.20
jinja2==2.10.1
lazy-object-proxy==1.4.1 # via astroid
markupsafe==1.1.1
mccabe==0.6.1 # via pylint
nose==1.3.7
packaging==19.0 # via caniusepython3
pbr==5.2.1
pycodestyle==2.5.0
pydocstyle==3.0.0
pylint-celery==0.3 # via edx-lint
pylint-django==0.7.2 # via edx-lint
pylint-plugin-utils==0.5 # via pylint-celery, pylint-django
pylint==1.7.6 # via edx-lint, pylint-celery, pylint-django, pylint-plugin-utils
pymongo==3.8.0
pyparsing==2.4.0 # via packaging
python-slugify==3.0.2
pytz==2019.1
pyyaml==5.1.1
requests==2.22.0 # via caniusepython3
singledispatch==3.4.0.3 # via astroid, pylint
six==1.12.0
snowballstemmer==1.2.1 # via pydocstyle
stevedore==1.30.1
text-unidecode==1.2
urllib3==1.25.3 # via requests
wrapt==1.11.1 # via astroid

# The following packages are considered to be unsafe in a requirements file:
# setuptools==41.0.1 # via caniusepython3
9 changes: 9 additions & 0 deletions requirements/test.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Requirements for test runs.
-c constraints.txt

-r base.txt # Core dependencies for this package

code-annotations # Provides commands used by the pii_check make target
coverage
django_nose>=1.4.1
nose
23 changes: 23 additions & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# make upgrade
#
click==7.0 # via code-annotations
code-annotations==0.3.1
coverage==4.5.3
django-model-utils==3.1.2
django-nose==1.4.6
edx-opaque-keys==1.0.1
jinja2==2.10.1 # via code-annotations
markupsafe==1.1.1 # via jinja2
nose==1.3.7
pbr==5.2.1
pymongo==3.8.0
python-slugify==3.0.2 # via code-annotations
pytz==2019.1
pyyaml==5.1.1 # via code-annotations
six==1.12.0
stevedore==1.30.1
text-unidecode==1.2 # via python-slugify
6 changes: 6 additions & 0 deletions requirements/travis.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Requirements for running tests in Travis
-c constraints.txt

codecov # Code coverage reporting
tox # Virtualenv management for tests
tox-battery # Makes tox aware of requirements file changes
30 changes: 30 additions & 0 deletions requirements/travis.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# make upgrade
#
certifi==2019.3.9 # via requests
chardet==3.0.4 # via requests
codecov==2.0.15
configparser==3.7.4 # via importlib-metadata
contextlib2==0.5.5 # via importlib-metadata
coverage==4.5.3 # via codecov
filelock==3.0.12 # via tox
idna==2.8 # via requests
importlib-metadata==0.18 # via pluggy
pathlib2==2.3.3 # via importlib-metadata
pluggy==0.12.0 # via tox
py==1.8.0 # via tox
requests==2.22.0 # via codecov
scandir==1.10.0 # via pathlib2
six==1.12.0 # via pathlib2, tox
toml==0.10.0 # via tox
tox-battery==0.5.1
tox==3.12.1
urllib3==1.25.3 # via requests
virtualenv==16.6.0 # via tox
zipp==0.5.1 # via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools==41.0.1 # via tox
12 changes: 9 additions & 3 deletions settings.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
"""
These settings are here to use during tests, because django requires them.
In a real-world use case, apps in this project are installed into other
Django applications, so these settings will not be used.
"""
from __future__ import unicode_literals
DEBUG=True
TEST_MODE=True
DEBUG = True
TEST_MODE = True
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
TRANSACTIONS_MANAGED = {}
USE_TZ = False
TIME_ZONE = {}
SECRET_KEY='SHHHHHH'
SECRET_KEY = 'SHHHHHH'

DATABASES = {
'default': {
Expand Down
Loading

0 comments on commit 963f832

Please sign in to comment.