From e287c326587999b8a1a5c9ab04a1acf9597cdbf9 Mon Sep 17 00:00:00 2001 From: Remco de Boer Date: Wed, 25 Nov 2020 22:00:47 +0100 Subject: [PATCH] build!: define dev deps through requirements.txt (#55) * docs: explain new dev deps setup --- .github/workflows/cd.yml | 8 +- .github/workflows/ci-epic.yml | 8 +- .github/workflows/ci.yml | 8 +- .github/workflows/linkcheck.yml | 4 +- .gitpod.yml | 2 +- .pre-commit-config.yaml | 3 + .readthedocs.yml | 3 +- .reqs/dev.in | 9 ++ .reqs/doc.in | 16 +++ .reqs/doc.txt | 117 ++++++++++++++++++++++ .reqs/sty.in | 23 +++++ .reqs/sty.txt | 68 +++++++++++++ .vscode/settings.json | 4 + cspell.json | 4 + docs/develop.md | 74 +++++++------- environment.yml | 3 +- requirements-dev.txt | 166 ++++++++++++++++++++++++++++++++ requirements.txt | 14 +++ setup.cfg | 57 +---------- tox.ini | 33 +++++-- 20 files changed, 517 insertions(+), 107 deletions(-) create mode 100644 .reqs/dev.in create mode 100644 .reqs/doc.in create mode 100644 .reqs/doc.txt create mode 100644 .reqs/sty.in create mode 100644 .reqs/sty.txt create mode 100644 requirements-dev.txt create mode 100644 requirements.txt diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 7a590a04..3111ec71 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,4 +1,4 @@ -# cspell:ignore noreply prereleased pypa +# cspell:ignore noreply prereleased pypa reqs name: CD @@ -22,7 +22,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[doc] + pip install -r .reqs/doc.txt + pip install . sudo apt-get -y install pandoc graphviz - name: Build documentation and run notebooks working-directory: docs @@ -46,7 +47,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[precommit] + pip install -r .reqs/sty.txt + pip install . sudo npm install -g cspell pyright - name: Perform style checks run: pre-commit run -a diff --git a/.github/workflows/ci-epic.yml b/.github/workflows/ci-epic.yml index 3f58caff..eb7717bf 100644 --- a/.github/workflows/ci-epic.yml +++ b/.github/workflows/ci-epic.yml @@ -1,3 +1,5 @@ +# cspell:ignore reqs + name: CI for epics on: @@ -21,7 +23,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[doc] + pip install -r .reqs/doc.txt + pip install . sudo apt-get -y install pandoc graphviz - name: Build documentation and run notebooks working-directory: docs @@ -39,6 +42,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[ci] + pip install -r .reqs/sty.txt + pip install . - name: Perform style checks run: tox -e sty diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80dc0778..54f4b2ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -# cspell:ignore +# cspell:ignore reqs name: CI @@ -27,7 +27,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[doc] + pip install -r .reqs/doc.txt + pip install . sudo apt-get -y install pandoc graphviz - name: Build documentation and run notebooks working-directory: docs @@ -46,7 +47,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[precommit] + pip install -r .reqs/sty.txt + pip install . sudo npm install -g cspell pyright - name: Perform style checks run: pre-commit run -a diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index ebc41369..a977faa5 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -1,3 +1,5 @@ +# cspell:ignore reqs + name: Linkcheck on: @@ -25,7 +27,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[doc] + pip install -r .reqs/doc.txt sudo apt-get -y install pandoc - name: Check external links working-directory: docs diff --git a/.gitpod.yml b/.gitpod.yml index 8d64240c..07a5d734 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,5 +1,5 @@ tasks: - - init: pip install -e .[dev] + - init: pip install -r requirements-dev.txt -e . github: prebuilds: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 19bb2935..a2a44a0b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,6 +36,9 @@ repos: - id: prettier language_version: 12.18.2 # prettier does not specify node correctly + # The following tools have to be install locally, because they can also be + # used by code editors (e.g. linting and format-on-save). + - repo: local hooks: - id: black diff --git a/.readthedocs.yml b/.readthedocs.yml index 684468e8..46bbaa14 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -11,5 +11,6 @@ formats: python: version: 3.7 install: + - requirements: .reqs/doc.txt - method: pip - path: .[doc] + path: . diff --git a/.reqs/dev.in b/.reqs/dev.in new file mode 100644 index 00000000..2559c9ce --- /dev/null +++ b/.reqs/dev.in @@ -0,0 +1,9 @@ +-r ../requirements.txt +-r doc.txt +-r sty.txt + +jupyterlab +jupyterlab-code-formatter +labels +pip-tools +tox >= 1.9 # for skip_install, use_develop diff --git a/.reqs/doc.in b/.reqs/doc.in new file mode 100644 index 00000000..3108d339 --- /dev/null +++ b/.reqs/doc.in @@ -0,0 +1,16 @@ +-r ../requirements.txt + +# Requirements to build documentation +graphviz +ipywidgets +jupyter +myst-nb +pydeps +Sphinx >= 3 +sphinx-book-theme +sphinx-copybutton +sphinx-math-dollar +sphinx-panels +sphinx-thebe +sphinx-togglebutton +sphinxcontrib-bibtex diff --git a/.reqs/doc.txt b/.reqs/doc.txt new file mode 100644 index 00000000..40d6eab4 --- /dev/null +++ b/.reqs/doc.txt @@ -0,0 +1,117 @@ +# +# This file is autogenerated by pip-compile +# To update, run: +# +# pip-compile .reqs/doc.in +# +alabaster==0.7.12 # via sphinx +argon2-cffi==20.1.0 # via notebook +async-generator==1.10 # via nbclient +attrs==20.3.0 # via jsonschema, jupyter-cache, markdown-it-py +babel==2.9.0 # via sphinx +backcall==0.2.0 # via ipython +beautifulsoup4==4.9.3 # via sphinx-book-theme +bleach==3.2.1 # via nbconvert +certifi==2020.11.8 # via requests +cffi==1.14.4 # via argon2-cffi +chardet==3.0.4 # via requests +click==7.1.2 # via sphinx-book-theme +colorama==0.4.4 # via nbdime +cycler==0.10.0 # via -r .reqs/../requirements.txt, matplotlib +decorator==4.4.2 # via ipython +defusedxml==0.6.0 # via nbconvert +docutils==0.16 # via myst-nb, myst-parser, pybtex-docutils, sphinx, sphinx-book-theme, sphinx-panels, sphinx-togglebutton +entrypoints==0.3 # via nbconvert +gitdb==4.0.5 # via gitpython +gitpython==3.1.11 # via nbdime +graphviz==0.15 # via -r .reqs/doc.in +idna==2.10 # via requests +imagesize==1.2.0 # via sphinx +importlib-metadata==3.1.0 # via myst-nb +ipykernel==5.3.4 # via ipywidgets, jupyter, jupyter-console, notebook, qtconsole +ipython-genutils==0.2.0 # via nbformat, notebook, qtconsole, traitlets +ipython==7.19.0 # via ipykernel, ipywidgets, jupyter-console, jupyter-sphinx, myst-nb +ipywidgets==7.5.1 # via -r .reqs/doc.in, jupyter, jupyter-sphinx, myst-nb +jedi==0.17.2 # via ipython +jinja2==2.11.2 # via nbconvert, nbdime, notebook, sphinx +jsonschema==3.2.0 # via nbformat +jupyter-cache==0.4.1 # via myst-nb +jupyter-client==6.1.7 # via ipykernel, jupyter-console, nbclient, notebook, qtconsole +jupyter-console==6.2.0 # via jupyter +jupyter-core==4.7.0 # via jupyter-client, nbconvert, nbformat, notebook, qtconsole +jupyter-sphinx==0.3.2 # via myst-nb +jupyter==1.0.0 # via -r .reqs/doc.in +kiwisolver==1.3.1 # via -r .reqs/../requirements.txt, matplotlib +latexcodec==2.0.1 # via pybtex +markdown-it-py==0.5.6 # via myst-parser +markupsafe==1.1.1 # via jinja2 +matplotlib==3.3.3 # via -r .reqs/../requirements.txt +mistune==0.8.4 # via nbconvert +myst-nb==0.10.1 # via -r .reqs/doc.in +myst-parser==0.12.10 # via myst-nb +nbclient==0.5.1 # via jupyter-cache +nbconvert==5.6.1 # via jupyter, jupyter-sphinx, myst-nb, notebook +nbdime==2.1.0 # via jupyter-cache +nbformat==5.0.8 # via ipywidgets, jupyter-cache, jupyter-sphinx, myst-nb, nbclient, nbconvert, nbdime, notebook +nest-asyncio==1.4.3 # via nbclient +notebook==6.1.5 # via jupyter, nbdime, widgetsnbextension +numpy==1.19.4 # via -r .reqs/../requirements.txt, matplotlib +oset==0.1.3 # via sphinxcontrib-bibtex +packaging==20.4 # via bleach, sphinx +pandocfilters==1.4.3 # via nbconvert +parso==0.7.1 # via jedi +pexpect==4.8.0 # via ipython +pickleshare==0.7.5 # via ipython +pillow==8.0.1 # via -r .reqs/../requirements.txt, matplotlib +prometheus-client==0.9.0 # via notebook +prompt-toolkit==3.0.8 # via ipython, jupyter-console +ptyprocess==0.6.0 # via pexpect, terminado +pybtex-docutils==0.2.2 # via sphinxcontrib-bibtex +pybtex==0.23.0 # via pybtex-docutils, sphinxcontrib-bibtex +pycparser==2.20 # via cffi +pydata-sphinx-theme==0.4.1 # via sphinx-book-theme +pydeps==1.9.11 # via -r .reqs/doc.in +pygments==2.7.2 # via ipython, jupyter-console, nbconvert, nbdime, qtconsole, sphinx +pyparsing==2.4.7 # via -r .reqs/../requirements.txt, matplotlib, packaging +pyrsistent==0.17.3 # via jsonschema +python-dateutil==2.8.1 # via -r .reqs/../requirements.txt, jupyter-client, matplotlib +pytz==2020.4 # via babel +pyyaml==5.3.1 # via myst-nb, myst-parser, pybtex, sphinx-book-theme +pyzmq==20.0.0 # via jupyter-client, notebook, qtconsole +qtconsole==5.0.1 # via jupyter +qtpy==1.9.0 # via qtconsole +requests==2.25.0 # via nbdime, sphinx +send2trash==1.5.0 # via notebook +six==1.15.0 # via -r .reqs/../requirements.txt, argon2-cffi, bleach, cycler, jsonschema, latexcodec, nbdime, packaging, pybtex, pybtex-docutils, python-dateutil +smmap==3.0.4 # via gitdb +snowballstemmer==2.0.0 # via sphinx +soupsieve==2.0.1 # via beautifulsoup4 +sphinx-book-theme==0.0.39 # via -r .reqs/doc.in +sphinx-copybutton==0.3.1 # via -r .reqs/doc.in +sphinx-math-dollar==1.2 # via -r .reqs/doc.in +sphinx-panels==0.5.2 # via -r .reqs/doc.in +sphinx-thebe==0.0.8 # via -r .reqs/doc.in +sphinx-togglebutton==0.2.3 # via -r .reqs/doc.in, myst-nb +sphinx==3.3.1 # via -r .reqs/doc.in, jupyter-sphinx, myst-nb, myst-parser, pydata-sphinx-theme, sphinx-book-theme, sphinx-copybutton, sphinx-math-dollar, sphinx-panels, sphinx-thebe, sphinx-togglebutton, sphinxcontrib-bibtex +sphinxcontrib-applehelp==1.0.2 # via sphinx +sphinxcontrib-bibtex==1.0.0 # via -r .reqs/doc.in +sphinxcontrib-devhelp==1.0.2 # via sphinx +sphinxcontrib-htmlhelp==1.0.3 # via sphinx +sphinxcontrib-jsmath==1.0.1 # via sphinx +sphinxcontrib-qthelp==1.0.3 # via sphinx +sphinxcontrib-serializinghtml==1.1.4 # via sphinx +sqlalchemy==1.3.20 # via jupyter-cache +stdlib-list==0.8.0 # via pydeps +terminado==0.9.1 # via notebook +testpath==0.4.4 # via nbconvert +tornado==6.1 # via ipykernel, jupyter-client, nbdime, notebook, terminado +traitlets==5.0.5 # via ipykernel, ipython, ipywidgets, jupyter-client, jupyter-core, nbclient, nbconvert, nbformat, notebook, qtconsole +urllib3==1.26.2 # via requests +wcwidth==0.2.5 # via prompt-toolkit +webencodings==0.5.1 # via bleach +wheel==0.35.1 # via sphinx-togglebutton +widgetsnbextension==3.5.1 # via ipywidgets +zipp==3.4.0 # via importlib-metadata + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/.reqs/sty.in b/.reqs/sty.in new file mode 100644 index 00000000..53ed3f8b --- /dev/null +++ b/.reqs/sty.in @@ -0,0 +1,23 @@ +-r ../requirements.txt + +pre-commit >= 1.4.0 + +# Requirements for formatting files +black +isort +nbstripout + +# Lint Python source code +flake8 >= 3 # for per-file-ignores +flake8-blind-except +flake8-bugbear +flake8-builtins +flake8-rst-docstrings +mypy +pep8-naming +pydocstyle +pylint + +# Lint documentation files +doc8 +rstcheck diff --git a/.reqs/sty.txt b/.reqs/sty.txt new file mode 100644 index 00000000..78140c53 --- /dev/null +++ b/.reqs/sty.txt @@ -0,0 +1,68 @@ +# +# This file is autogenerated by pip-compile +# To update, run: +# +# pip-compile .reqs/sty.in +# +appdirs==1.4.4 # via black, virtualenv +astroid==2.4.2 # via pylint +attrs==20.3.0 # via flake8-bugbear, jsonschema +black==20.8b1 # via -r .reqs/sty.in +cfgv==3.2.0 # via pre-commit +chardet==3.0.4 # via doc8 +click==7.1.2 # via black +cycler==0.10.0 # via -r .reqs/../requirements.txt, matplotlib +distlib==0.3.1 # via virtualenv +doc8==0.8.1 # via -r .reqs/sty.in +docutils==0.16 # via doc8, restructuredtext-lint, rstcheck +filelock==3.0.12 # via virtualenv +flake8-blind-except==0.1.1 # via -r .reqs/sty.in +flake8-bugbear==20.11.1 # via -r .reqs/sty.in +flake8-builtins==1.5.3 # via -r .reqs/sty.in +flake8-polyfill==1.0.2 # via pep8-naming +flake8-rst-docstrings==0.0.14 # via -r .reqs/sty.in +flake8==3.8.4 # via -r .reqs/sty.in, flake8-bugbear, flake8-builtins, flake8-polyfill, flake8-rst-docstrings +identify==1.5.10 # via pre-commit +ipython-genutils==0.2.0 # via nbformat, traitlets +isort==5.6.4 # via -r .reqs/sty.in, pylint +jsonschema==3.2.0 # via nbformat +jupyter-core==4.7.0 # via nbformat +kiwisolver==1.3.1 # via -r .reqs/../requirements.txt, matplotlib +lazy-object-proxy==1.4.3 # via astroid +matplotlib==3.3.3 # via -r .reqs/../requirements.txt +mccabe==0.6.1 # via flake8, pylint +mypy-extensions==0.4.3 # via black, mypy +mypy==0.790 # via -r .reqs/sty.in +nbformat==5.0.8 # via nbstripout +nbstripout==0.3.9 # via -r .reqs/sty.in +nodeenv==1.5.0 # via pre-commit +numpy==1.19.4 # via -r .reqs/../requirements.txt, matplotlib +pathspec==0.8.1 # via black +pbr==5.5.1 # via stevedore +pep8-naming==0.11.1 # via -r .reqs/sty.in +pillow==8.0.1 # via -r .reqs/../requirements.txt, matplotlib +pre-commit==2.9.0 # via -r .reqs/sty.in +pycodestyle==2.6.0 # via flake8 +pydocstyle==5.1.1 # via -r .reqs/sty.in +pyflakes==2.2.0 # via flake8 +pygments==2.7.2 # via doc8 +pylint==2.6.0 # via -r .reqs/sty.in +pyparsing==2.4.7 # via -r .reqs/../requirements.txt, matplotlib +pyrsistent==0.17.3 # via jsonschema +python-dateutil==2.8.1 # via -r .reqs/../requirements.txt, matplotlib +pyyaml==5.3.1 # via pre-commit +regex==2020.11.13 # via black +restructuredtext-lint==1.3.2 # via doc8, flake8-rst-docstrings +rstcheck==3.3.1 # via -r .reqs/sty.in +six==1.15.0 # via -r .reqs/../requirements.txt, astroid, cycler, doc8, jsonschema, python-dateutil, virtualenv +snowballstemmer==2.0.0 # via pydocstyle +stevedore==3.2.2 # via doc8 +toml==0.10.2 # via black, pre-commit, pylint +traitlets==5.0.5 # via jupyter-core, nbformat +typed-ast==1.4.1 # via black, mypy +typing-extensions==3.7.4.3 # via black, mypy +virtualenv==20.2.1 # via pre-commit +wrapt==1.12.1 # via astroid + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/.vscode/settings.json b/.vscode/settings.json index 5da95153..ec70ee39 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,6 +15,9 @@ "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.wordWrap": "off" }, + "[pip-requirements]": { + "editor.wordWrap": "off" + }, "[python]": { "editor.codeActionsOnSave": { "source.organizeImports": true @@ -59,6 +62,7 @@ "rewrap.wrappingColumn": 79, "search.exclude": { "**/tests/**/__init__.py": true, + ".reqs/*.txt": true, "docs/tox.ini": true, "tests/tox.ini": true }, diff --git a/cspell.json b/cspell.json index d2b15611..7f3f165d 100644 --- a/cspell.json +++ b/cspell.json @@ -18,6 +18,7 @@ ], "ignorePaths": [ "*.bib", + "*.ico", "*.root", "*.rst_t", "*.svg", @@ -27,6 +28,8 @@ ".pre-commit-config.yaml", ".pylintrc", ".readthedocs.yml", + ".reqs/*.in", + ".reqs/*.txt", ".vscode/*", ".vscode/.gitignore", "Makefile", @@ -36,6 +39,7 @@ "docs/conf.py", "pyproject.toml", "pyrightconfig.json", + "requirements*.txt", "setup.cfg", "setup.py", "tox.ini" diff --git a/docs/develop.md b/docs/develop.md index 055c7fa1..fa78973b 100644 --- a/docs/develop.md +++ b/docs/develop.md @@ -1,7 +1,7 @@ # Develop @@ -21,7 +21,6 @@ To get started, simply run: ```shell conda env create conda activate pwa -pip install -e .[dev] pre-commit install ``` ```` @@ -30,7 +29,8 @@ pre-commit install ```shell python3 -m venv ./venv source ./venv/bin/activate -pip install -e .[dev] +pip install -r requirements-dev.txt # pin all dependencies +pip install -e . pre-commit install ```` @@ -126,34 +126,27 @@ python3 setup.py develop This will install all required dependencies for the package as well. -### Optional dependencies - -Packages can additionally define -[optional dependencies](https://setuptools.readthedocs.io/en/latest/userguide/dependency_management.html#optional-dependencies). -With `pip install` you can install these with -['extras' syntax](https://www.python.org/dev/peps/pep-0508/#extras) (e.g. -{command}`pip install -e .[dev]`). We follow the following structure to group -optional developer dependencies: - -- {code}`doc` ― tools required to - {ref}`build documentation ` -- {code}`format` ― tools that automate formatting, such as - [black](https://black.readthedocs.io) and - [isort](https://isort.readthedocs.io) -- {code}`lint` ― tools that point out bugs, typos, and other issues, such as - [pylint](https://www.pylint.org) -- {code}`test` ― requirements for {ref}`runtime tests ` -- {code}`dev` ― contains all of the above, as well as some other helpful tools - like {ref}`Jupyter Lab `. - -All dependencies relevant for the developer (see -{ref}`develop:Automated coding conventions`) can be installed with: +### Additional dependencies + +Developers require several additional tools besides the dependencies required +to run the package itself (see {ref}`develop:Automated coding conventions`). To +ensure that developers use exactly the same version of those tools +(deterministic and reproducible), we define those additional tools +[requirements files](https://pip.pypa.io/en/stable/user_guide/#requirements-files) +that have their dependencies 'pinned' through +[`pip-tools`](https://pypi.org/project/pip-tools). + +All these additional dependencies can be installed as follows. Note that we +install the package in {ref}`editable install ` +_after_ all requirements have been been pinned with the +{file}`requirements-dev.txt` file. ```bash -pip install -e .[dev] +pip install -r requirements-dev.txt +pip install -e . ``` -We explain some of those tools in the following sections. +We explain some of those additional tools in the following sections. ````{dropdown} Node.js packages If you have Node.js (`npm`) on your system, you can run a few additional @@ -162,10 +155,19 @@ checks. Install these packages as follows (possibly with administrator rights): ```bash npm install -g cspell pyright ``` +```` + +````{dropdown} Upgrading dependencies +The additional dependencies are defined (unpinned!) in the {file}`*.in` files +under the {file}`.reqs` folder. To upgrade the 'pinned' requirements under +{file}`requirements-dev.txt`, use {ref}`develop:Tox`: + +```bash +tox -e upgrade +``` -Note that [`pyright`](https://github.com/microsoft/pyright) requires Node.js -v12.x (see install instructions -[here](https://nodejs.org/en/download/package-manager)). +Internally, this command calls a specific sequence of +[`pip-compile`](https://pypi.org/project/pip-tools) commands. ```` ### Updating @@ -177,7 +179,7 @@ pulling new commits from the repository: ```bash git checkout master git pull -pip install -e .[dev] +pip install -r requirements-dev.txt ``` If you still have problems, it may be that certain dependencies have become @@ -247,7 +249,8 @@ overview of the progress. See {ref}`tox:parallel_mode`. tox -p ``` -This command will [run `pytest`](#testing), +This command will [run `pytest`](#testing), perform all +{ref}`style checks `, {ref}`build the documentation `, and verify cross-references in the documentation and the API. It's especially recommended to **run tox before submitting a pull request!** @@ -261,6 +264,10 @@ do, by running: tox -av ``` +Note that {command}`tox` works with its own virtual environments. These +environments install +{ref}`'pinned' dependencies `. + ### GitHub Actions All {ref}`style checks `, testing of the @@ -477,7 +484,7 @@ contains a few Jupyter notebooks. These notebooks are run and tested whenever you make a {ref}`pull request `. If you want to improve those notebooks, we recommend working with [Jupyter Lab](https://jupyterlab.readthedocs.io/en/stable), which is -{ref}`installed with the dev requirements `. +{ref}`installed with the dev requirements `. Jupyter Lab offers a nicer developer experience than the default Jupyter notebook editor does. @@ -684,7 +691,6 @@ git clone https://github.com/ComPWA/PWA-pages.git # or some other repo cd PWA-pages conda env create conda activate pwa # or whatever the name is -pip install -e .[dev] code . # open folder in VSCode ``` ```` diff --git a/environment.yml b/environment.yml index b7a159e3..1b9f166c 100644 --- a/environment.yml +++ b/environment.yml @@ -6,4 +6,5 @@ dependencies: - pip - graphviz # for binder - pip: - - -e .[dev] + - -r requirements-dev.txt + - -e . diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 00000000..ac10a22e --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,166 @@ +# +# This file is autogenerated by pip-compile +# To update, run: +# +# pip-compile --output-file=requirements-dev.txt .reqs/dev.in +# +alabaster==0.7.12 # via -r .reqs/doc.txt, sphinx +appdirs==1.4.4 # via -r .reqs/sty.txt, black, virtualenv +argon2-cffi==20.1.0 # via -r .reqs/doc.txt, notebook +astroid==2.4.2 # via -r .reqs/sty.txt, pylint +async-generator==1.10 # via -r .reqs/doc.txt, nbclient +attrs==20.3.0 # via -r .reqs/doc.txt, -r .reqs/sty.txt, flake8-bugbear, jsonschema, jupyter-cache, labels, markdown-it-py +babel==2.9.0 # via -r .reqs/doc.txt, sphinx +backcall==0.2.0 # via -r .reqs/doc.txt, ipython +beautifulsoup4==4.9.3 # via -r .reqs/doc.txt, sphinx-book-theme +black==20.8b1 # via -r .reqs/sty.txt +bleach==3.2.1 # via -r .reqs/doc.txt, nbconvert +certifi==2020.11.8 # via -r .reqs/doc.txt, requests +cffi==1.14.4 # via -r .reqs/doc.txt, argon2-cffi +cfgv==3.2.0 # via -r .reqs/sty.txt, pre-commit +chardet==3.0.4 # via -r .reqs/doc.txt, -r .reqs/sty.txt, doc8, requests +click==7.1.2 # via -r .reqs/doc.txt, -r .reqs/sty.txt, black, labels, pip-tools, sphinx-book-theme +colorama==0.4.4 # via -r .reqs/doc.txt, nbdime +cycler==0.10.0 # via -r .reqs/../requirements.txt, -r .reqs/doc.txt, -r .reqs/sty.txt, matplotlib +decorator==4.4.2 # via -r .reqs/doc.txt, ipython +defusedxml==0.6.0 # via -r .reqs/doc.txt, nbconvert +distlib==0.3.1 # via -r .reqs/sty.txt, virtualenv +doc8==0.8.1 # via -r .reqs/sty.txt +docutils==0.16 # via -r .reqs/doc.txt, -r .reqs/sty.txt, doc8, myst-nb, myst-parser, pybtex-docutils, restructuredtext-lint, rstcheck, sphinx, sphinx-book-theme, sphinx-panels, sphinx-togglebutton +entrypoints==0.3 # via -r .reqs/doc.txt, nbconvert +filelock==3.0.12 # via -r .reqs/sty.txt, tox, virtualenv +flake8-blind-except==0.1.1 # via -r .reqs/sty.txt +flake8-bugbear==20.11.1 # via -r .reqs/sty.txt +flake8-builtins==1.5.3 # via -r .reqs/sty.txt +flake8-polyfill==1.0.2 # via -r .reqs/sty.txt, pep8-naming +flake8-rst-docstrings==0.0.14 # via -r .reqs/sty.txt +flake8==3.8.4 # via -r .reqs/sty.txt, flake8-bugbear, flake8-builtins, flake8-polyfill, flake8-rst-docstrings +gitdb==4.0.5 # via -r .reqs/doc.txt, gitpython +gitpython==3.1.11 # via -r .reqs/doc.txt, nbdime +graphviz==0.15 # via -r .reqs/doc.txt +identify==1.5.10 # via -r .reqs/sty.txt, pre-commit +idna==2.10 # via -r .reqs/doc.txt, requests +imagesize==1.2.0 # via -r .reqs/doc.txt, sphinx +importlib-metadata==3.1.0 # via -r .reqs/doc.txt, myst-nb +ipykernel==5.3.4 # via -r .reqs/doc.txt, ipywidgets, jupyter, jupyter-console, notebook, qtconsole +ipython-genutils==0.2.0 # via -r .reqs/doc.txt, -r .reqs/sty.txt, nbformat, notebook, qtconsole, traitlets +ipython==7.19.0 # via -r .reqs/doc.txt, ipykernel, ipywidgets, jupyter-console, jupyter-sphinx, myst-nb +ipywidgets==7.5.1 # via -r .reqs/doc.txt, jupyter, jupyter-sphinx, myst-nb +isort==5.6.4 # via -r .reqs/sty.txt, pylint +jedi==0.17.2 # via -r .reqs/doc.txt, ipython +jinja2==2.11.2 # via -r .reqs/doc.txt, jupyterlab, jupyterlab-server, nbconvert, nbdime, notebook, sphinx +json5==0.9.5 # via jupyterlab-server +jsonschema==3.2.0 # via -r .reqs/doc.txt, -r .reqs/sty.txt, jupyterlab-server, nbformat +jupyter-cache==0.4.1 # via -r .reqs/doc.txt, myst-nb +jupyter-client==6.1.7 # via -r .reqs/doc.txt, ipykernel, jupyter-console, nbclient, notebook, qtconsole +jupyter-console==6.2.0 # via -r .reqs/doc.txt, jupyter +jupyter-core==4.7.0 # via -r .reqs/doc.txt, -r .reqs/sty.txt, jupyter-client, nbconvert, nbformat, notebook, qtconsole +jupyter-sphinx==0.3.2 # via -r .reqs/doc.txt, myst-nb +jupyter==1.0.0 # via -r .reqs/doc.txt +jupyterlab-code-formatter==1.3.8 # via -r .reqs/dev.in +jupyterlab-server==1.2.0 # via jupyterlab +jupyterlab==2.2.9 # via -r .reqs/dev.in +kiwisolver==1.3.1 # via -r .reqs/../requirements.txt, -r .reqs/doc.txt, -r .reqs/sty.txt, matplotlib +labels==20.1.0 # via -r .reqs/dev.in +latexcodec==2.0.1 # via -r .reqs/doc.txt, pybtex +lazy-object-proxy==1.4.3 # via -r .reqs/sty.txt, astroid +markdown-it-py==0.5.6 # via -r .reqs/doc.txt, myst-parser +markupsafe==1.1.1 # via -r .reqs/doc.txt, jinja2 +matplotlib==3.3.3 # via -r .reqs/../requirements.txt, -r .reqs/doc.txt, -r .reqs/sty.txt +mccabe==0.6.1 # via -r .reqs/sty.txt, flake8, pylint +mistune==0.8.4 # via -r .reqs/doc.txt, nbconvert +mypy-extensions==0.4.3 # via -r .reqs/sty.txt, black, mypy +mypy==0.790 # via -r .reqs/sty.txt +myst-nb==0.10.1 # via -r .reqs/doc.txt +myst-parser==0.12.10 # via -r .reqs/doc.txt, myst-nb +nbclient==0.5.1 # via -r .reqs/doc.txt, jupyter-cache +nbconvert==5.6.1 # via -r .reqs/doc.txt, jupyter, jupyter-sphinx, myst-nb, notebook +nbdime==2.1.0 # via -r .reqs/doc.txt, jupyter-cache +nbformat==5.0.8 # via -r .reqs/doc.txt, -r .reqs/sty.txt, ipywidgets, jupyter-cache, jupyter-sphinx, myst-nb, nbclient, nbconvert, nbdime, nbstripout, notebook +nbstripout==0.3.9 # via -r .reqs/sty.txt +nest-asyncio==1.4.3 # via -r .reqs/doc.txt, nbclient +nodeenv==1.5.0 # via -r .reqs/sty.txt, pre-commit +notebook==6.1.5 # via -r .reqs/doc.txt, jupyter, jupyterlab, jupyterlab-code-formatter, jupyterlab-server, nbdime, widgetsnbextension +numpy==1.19.4 # via -r .reqs/../requirements.txt, -r .reqs/doc.txt, -r .reqs/sty.txt, matplotlib +oset==0.1.3 # via -r .reqs/doc.txt, sphinxcontrib-bibtex +packaging==20.4 # via -r .reqs/doc.txt, bleach, jupyterlab-code-formatter, sphinx, tox +pandocfilters==1.4.3 # via -r .reqs/doc.txt, nbconvert +parso==0.7.1 # via -r .reqs/doc.txt, jedi +pathspec==0.8.1 # via -r .reqs/sty.txt, black +pbr==5.5.1 # via -r .reqs/sty.txt, stevedore +pep8-naming==0.11.1 # via -r .reqs/sty.txt +pexpect==4.8.0 # via -r .reqs/doc.txt, ipython +pickleshare==0.7.5 # via -r .reqs/doc.txt, ipython +pillow==8.0.1 # via -r .reqs/../requirements.txt, -r .reqs/doc.txt, -r .reqs/sty.txt, matplotlib +pip-tools==5.4.0 # via -r .reqs/dev.in +pluggy==0.13.1 # via tox +pre-commit==2.9.0 # via -r .reqs/sty.txt +prometheus-client==0.9.0 # via -r .reqs/doc.txt, notebook +prompt-toolkit==3.0.8 # via -r .reqs/doc.txt, ipython, jupyter-console +ptyprocess==0.6.0 # via -r .reqs/doc.txt, pexpect, terminado +py==1.9.0 # via tox +pybtex-docutils==0.2.2 # via -r .reqs/doc.txt, sphinxcontrib-bibtex +pybtex==0.23.0 # via -r .reqs/doc.txt, pybtex-docutils, sphinxcontrib-bibtex +pycodestyle==2.6.0 # via -r .reqs/sty.txt, flake8 +pycparser==2.20 # via -r .reqs/doc.txt, cffi +pydata-sphinx-theme==0.4.1 # via -r .reqs/doc.txt, sphinx-book-theme +pydeps==1.9.11 # via -r .reqs/doc.txt +pydocstyle==5.1.1 # via -r .reqs/sty.txt +pyflakes==2.2.0 # via -r .reqs/sty.txt, flake8 +pygments==2.7.2 # via -r .reqs/doc.txt, -r .reqs/sty.txt, doc8, ipython, jupyter-console, nbconvert, nbdime, qtconsole, sphinx +pylint==2.6.0 # via -r .reqs/sty.txt +pyparsing==2.4.7 # via -r .reqs/../requirements.txt, -r .reqs/doc.txt, -r .reqs/sty.txt, matplotlib, packaging +pyrsistent==0.17.3 # via -r .reqs/doc.txt, -r .reqs/sty.txt, jsonschema +python-dateutil==2.8.1 # via -r .reqs/../requirements.txt, -r .reqs/doc.txt, -r .reqs/sty.txt, jupyter-client, matplotlib +pytoml==0.1.21 # via labels +pytz==2020.4 # via -r .reqs/doc.txt, babel +pyyaml==5.3.1 # via -r .reqs/doc.txt, -r .reqs/sty.txt, myst-nb, myst-parser, pre-commit, pybtex, sphinx-book-theme +pyzmq==20.0.0 # via -r .reqs/doc.txt, jupyter-client, notebook, qtconsole +qtconsole==5.0.1 # via -r .reqs/doc.txt, jupyter +qtpy==1.9.0 # via -r .reqs/doc.txt, qtconsole +regex==2020.11.13 # via -r .reqs/sty.txt, black +requests==2.25.0 # via -r .reqs/doc.txt, jupyterlab-server, labels, nbdime, sphinx +restructuredtext-lint==1.3.2 # via -r .reqs/sty.txt, doc8, flake8-rst-docstrings +rstcheck==3.3.1 # via -r .reqs/sty.txt +send2trash==1.5.0 # via -r .reqs/doc.txt, notebook +six==1.15.0 # via -r .reqs/../requirements.txt, -r .reqs/doc.txt, -r .reqs/sty.txt, argon2-cffi, astroid, bleach, cycler, doc8, jsonschema, latexcodec, nbdime, packaging, pip-tools, pybtex, pybtex-docutils, python-dateutil, tox, virtualenv +smmap==3.0.4 # via -r .reqs/doc.txt, gitdb +snowballstemmer==2.0.0 # via -r .reqs/doc.txt, -r .reqs/sty.txt, pydocstyle, sphinx +soupsieve==2.0.1 # via -r .reqs/doc.txt, beautifulsoup4 +sphinx-book-theme==0.0.39 # via -r .reqs/doc.txt +sphinx-copybutton==0.3.1 # via -r .reqs/doc.txt +sphinx-math-dollar==1.2 # via -r .reqs/doc.txt +sphinx-panels==0.5.2 # via -r .reqs/doc.txt +sphinx-thebe==0.0.8 # via -r .reqs/doc.txt +sphinx-togglebutton==0.2.3 # via -r .reqs/doc.txt, myst-nb +sphinx==3.3.1 # via -r .reqs/doc.txt, jupyter-sphinx, myst-nb, myst-parser, pydata-sphinx-theme, sphinx-book-theme, sphinx-copybutton, sphinx-math-dollar, sphinx-panels, sphinx-thebe, sphinx-togglebutton, sphinxcontrib-bibtex +sphinxcontrib-applehelp==1.0.2 # via -r .reqs/doc.txt, sphinx +sphinxcontrib-bibtex==1.0.0 # via -r .reqs/doc.txt +sphinxcontrib-devhelp==1.0.2 # via -r .reqs/doc.txt, sphinx +sphinxcontrib-htmlhelp==1.0.3 # via -r .reqs/doc.txt, sphinx +sphinxcontrib-jsmath==1.0.1 # via -r .reqs/doc.txt, sphinx +sphinxcontrib-qthelp==1.0.3 # via -r .reqs/doc.txt, sphinx +sphinxcontrib-serializinghtml==1.1.4 # via -r .reqs/doc.txt, sphinx +sqlalchemy==1.3.20 # via -r .reqs/doc.txt, jupyter-cache +stdlib-list==0.8.0 # via -r .reqs/doc.txt, pydeps +stevedore==3.2.2 # via -r .reqs/sty.txt, doc8 +terminado==0.9.1 # via -r .reqs/doc.txt, notebook +testpath==0.4.4 # via -r .reqs/doc.txt, nbconvert +toml==0.10.2 # via -r .reqs/sty.txt, black, pre-commit, pylint, tox +tornado==6.1 # via -r .reqs/doc.txt, ipykernel, jupyter-client, jupyterlab, nbdime, notebook, terminado +tox==3.20.1 # via -r .reqs/dev.in +traitlets==5.0.5 # via -r .reqs/doc.txt, -r .reqs/sty.txt, ipykernel, ipython, ipywidgets, jupyter-client, jupyter-core, nbclient, nbconvert, nbformat, notebook, qtconsole +typed-ast==1.4.1 # via -r .reqs/sty.txt, black, mypy +typing-extensions==3.7.4.3 # via -r .reqs/sty.txt, black, mypy +urllib3==1.26.2 # via -r .reqs/doc.txt, requests +virtualenv==20.2.1 # via -r .reqs/sty.txt, pre-commit, tox +wcwidth==0.2.5 # via -r .reqs/doc.txt, prompt-toolkit +webencodings==0.5.1 # via -r .reqs/doc.txt, bleach +wheel==0.35.1 # via -r .reqs/doc.txt, sphinx-togglebutton +widgetsnbextension==3.5.1 # via -r .reqs/doc.txt, ipywidgets +wrapt==1.12.1 # via -r .reqs/sty.txt, astroid +zipp==3.4.0 # via -r .reqs/doc.txt, importlib-metadata + +# The following packages are considered to be unsafe in a requirements file: +# pip +# setuptools diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..862364c9 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,14 @@ +# +# This file is autogenerated by pip-compile +# To update, run: +# +# pip-compile +# +cycler==0.10.0 # via matplotlib +kiwisolver==1.3.1 # via matplotlib +matplotlib==3.3.3 # via PWA-pages (setup.py) +numpy==1.19.4 # via PWA-pages (setup.py), matplotlib +pillow==8.0.1 # via matplotlib +pyparsing==2.4.7 # via matplotlib +python-dateutil==2.8.1 # via matplotlib +six==1.15.0 # via cycler, python-dateutil diff --git a/setup.cfg b/setup.cfg index 2db226f3..a68abac0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,8 +41,8 @@ python_requires = >=3.6 setup_requires = setuptools_scm install_requires = - matplotlib==3.3.2 - numpy==1.19.2 + matplotlib + numpy packages = find: package_dir = =src @@ -54,59 +54,6 @@ where = src pwa_pages = py.typed -[options.extras_require] -doc = - graphviz==0.15 - ipywidgets==7.5.1 - jupyter==1.0.0 - myst-nb==0.10.1 - pybtex==0.23.0 - pydeps==1.9.11 - Sphinx==3.3.1 - sphinx-book-theme==0.0.39 - sphinx-copybutton==0.3.1 - sphinx-math-dollar==1.2 - sphinx-panels==0.5.2 - sphinx-thebe==0.0.8 - sphinx-togglebutton==0.2.3 - sphinxcontrib-bibtex==1.0.0 -format = - black==20.8b1 - isort==5.6.4 - nbstripout==0.3.9 -lint-doc = - doc8==0.8.1 - rstcheck==3.3.1 -lint-py = - flake8==3.8.4 - flake8-blind-except==0.1.1 - flake8-bugbear==20.1.4 - flake8-builtins==1.5.3 - flake8-rst-docstrings==0.0.14 - mypy==0.790 - pep8-naming==0.11.1 - pydocstyle==5.1.1 - pylint==2.6.0 -lint = - %(lint-doc)s - %(lint-py)s -precommit = - %(format)s - %(lint)s - pre-commit==2.9.0 -tox = - %(precommit)s - sphinx-autobuild==2020.9.1 - tox==3.20.1 -tools = - jupyterlab==2.2.9 - jupyterlab_code_formatter==1.3.6 - labels==20.1.0 -dev = - %(doc)s - %(tools)s - %(tox)s - [doc8] extension=.inc file-encoding=UTF-8 diff --git a/tox.ini b/tox.ini index 33605f1e..6e0f4e5c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,26 +1,31 @@ [tox] passenv = PYTHONPATH skip_install = True -skip_missing_interpreters=true skipsdist = True envlist = doc, sty, +skip_missing_interpreters = True [testenv:doc] description = Build documentation and API through Sphinx +deps = + -r .reqs/doc.txt +usedevelop = true changedir = docs whitelist_externals = make commands = make html -[testenv:doc-live] +[testenv:doclive] description = - Set up a server to preview changes to the HTML pages live -whitelist_externals = + Set up a server to directly preview changes to the HTML pages +deps = + -r .reqs/doc.txt sphinx-autobuild +usedevelop = true commands = sphinx-autobuild \ --watch docs \ @@ -34,6 +39,9 @@ commands = [testenv:linkcheck] description = Check external links in the documentation (requires internet connection) +deps = + -r .reqs/doc.txt +usedevelop = true changedir = docs whitelist_externals = make @@ -43,17 +51,30 @@ commands = [testenv:sty] description = Perform all linting, formatting, and spelling checks +deps = + -r .reqs/sty.txt +usedevelop = true setenv = SKIP = mypy whitelist_externals = bash - mypy - pre-commit commands = mypy . # run separately because of potential caching problems pre-commit run {posargs} -a - bash -ec "cspell $(git ls-files)" +[testenv:upgrade] +description = + Upgrade pinned dependencies +deps = + pip-tools +skip_install = true +commands = + pip-compile --upgrade + pip-compile --upgrade .reqs/doc.in + pip-compile --upgrade .reqs/sty.in + pip-compile --upgrade .reqs/dev.in -o requirements-dev.txt + [flake8] application-import-names = pwa_pages