From 9f4f9c9c9f09f46776e75435f4fe727789721e81 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Tue, 17 Feb 2015 12:46:55 +0000 Subject: [PATCH 1/2] Single source of truth for requirements --- requirements.txt | 30 ++++++++------------- requirements/requirements-codestyle.txt | 3 +++ requirements/requirements-documentation.txt | 2 ++ requirements/requirements-optionals.txt | 4 +++ requirements/requirements-packaging.txt | 11 ++++++++ requirements/requirements-testing.txt | 3 +++ tox.ini | 13 +++++---- 7 files changed, 40 insertions(+), 26 deletions(-) create mode 100644 requirements/requirements-codestyle.txt create mode 100644 requirements/requirements-documentation.txt create mode 100644 requirements/requirements-optionals.txt create mode 100644 requirements/requirements-packaging.txt create mode 100644 requirements/requirements-testing.txt diff --git a/requirements.txt b/requirements.txt index bf4611792..4ec84f684 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,21 +1,13 @@ -# Minimum Django version -Django>=1.4.11 +# The base set of requirements for REST framework is actually +# just Django, but for the purposes of development and testing +# there are a number of packages that it is useful to install. -# Test requirements -pytest-django==2.8.0 -pytest==2.6.4 -pytest-cov==1.6 -flake8==2.2.2 +# Laying these out as seperate requirements files, allows us to +# only included the relevent sets when running tox, and ensures +# we are only ever declaring out dependancies in one place. -# Optional packages -markdown>=2.1.0 -django-guardian==1.2.4 -django-filter>=0.9.2 - -# wheel for PyPI installs -wheel==0.24.0 -# twine for secured PyPI uploads -twine==1.4.0 - -# MkDocs for documentation previews/deploys -mkdocs==0.11.1 +-r requirements/requirements-optionals.txt +-r requirements/requirements-testing.txt +-r requirements/requirements-documentation.txt +-r requirements/requirements-codestyle.txt +-r requirements/requirements-packaging.txt diff --git a/requirements/requirements-codestyle.txt b/requirements/requirements-codestyle.txt new file mode 100644 index 000000000..4e2be24c3 --- /dev/null +++ b/requirements/requirements-codestyle.txt @@ -0,0 +1,3 @@ +# PEP8 code linting, which we run on all commits. +flake8==2.3.0 +pep8==1.6.2 diff --git a/requirements/requirements-documentation.txt b/requirements/requirements-documentation.txt new file mode 100644 index 000000000..5009436e4 --- /dev/null +++ b/requirements/requirements-documentation.txt @@ -0,0 +1,2 @@ +# MkDocs to build our documentation. +mkdocs==0.11.1 diff --git a/requirements/requirements-optionals.txt b/requirements/requirements-optionals.txt new file mode 100644 index 000000000..af9937cfa --- /dev/null +++ b/requirements/requirements-optionals.txt @@ -0,0 +1,4 @@ +# Optional packages which may be used with REST framework. +markdown==2.5.2 +django-guardian==1.2.5 +django-filter==0.9.2 diff --git a/requirements/requirements-packaging.txt b/requirements/requirements-packaging.txt new file mode 100644 index 000000000..e4ac77403 --- /dev/null +++ b/requirements/requirements-packaging.txt @@ -0,0 +1,11 @@ +# Wheel for PyPI installs. +wheel==0.24.0 + +# Twine for secured PyPI uploads. +twine==1.4.0 + +# Transifex client for managing translation resources. +transifex-client==0.10 + +# The pip-review and pip-dump tools for package upgrades. +pip-tools==0.3.5 diff --git a/requirements/requirements-testing.txt b/requirements/requirements-testing.txt new file mode 100644 index 000000000..a8d5d3229 --- /dev/null +++ b/requirements/requirements-testing.txt @@ -0,0 +1,3 @@ +# PyTest for running the tests. +pytest==2.6.4 +pytest-django==2.8.0 diff --git a/tox.ini b/tox.ini index 76f4f09b3..b96b4939b 100644 --- a/tox.ini +++ b/tox.ini @@ -15,18 +15,17 @@ deps = django16: Django==1.6.3 # Should track minimum supported django17: Django==1.7.2 # Should track maximum supported django18alpha: https://www.djangoproject.com/download/1.8a1/tarball/ - django-guardian==1.2.4 - pytest-django==2.8.0 - django-filter==0.9.2 - markdown>=2.1.0 + -rrequirements/requirements-testing.txt + -rrequirements/requirements-optionals.txt [testenv:py27-flake8] deps = - pytest==2.6.4 - flake8==2.2.2 + -rrequirements/requirements-testing.txt + -rrequirements/requirements-codestyle.txt commands = ./runtests.py --lintonly [testenv:py27-docs] deps = - mkdocs>=0.11.1 + -rrequirements/requirements-testing.txt + -rrequirements/requirements-documentation.txt commands = mkdocs build From 028c477c2242e7c322b68c4730ed1868008c37d8 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Tue, 17 Feb 2015 12:56:19 +0000 Subject: [PATCH 2/2] Note on using pip-review in docs. --- docs/topics/project-management.md | 10 ++++++++++ requirements/requirements-packaging.txt | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/topics/project-management.md b/docs/topics/project-management.md index 2a54fb94e..dfe0d6357 100644 --- a/docs/topics/project-management.md +++ b/docs/topics/project-management.md @@ -166,6 +166,16 @@ When a translator has finished translating their work needs to be downloaded fro --- +## Project requirements + +All our test requirements are pinned to exact versions, in order to ensure that our test runs are reproducible. We maintain the requirements in the `requirements` directory. The requirements files are referenced from the `tox.ini` configuration file, ensuring we have a single source of truth for package versions used in testing. + +You can check if there are any packages available at a newer version, by using the `pip-review` tool. + +Package upgrades should generally be treated as isolated pull requests. Also note that the `pip-dump` command does not work gracefully with our requirements layout style, so any edits should be made manually. + +--- + ## Project ownership The PyPI package is owned by `@tomchristie`. As a backup `@j4mie` also has ownership of the package. diff --git a/requirements/requirements-packaging.txt b/requirements/requirements-packaging.txt index e4ac77403..7782d63a7 100644 --- a/requirements/requirements-packaging.txt +++ b/requirements/requirements-packaging.txt @@ -7,5 +7,5 @@ twine==1.4.0 # Transifex client for managing translation resources. transifex-client==0.10 -# The pip-review and pip-dump tools for package upgrades. +# The pip-review tool for checking package upgrades. pip-tools==0.3.5