Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major Refactor: Add Ruff Linting, Nox, and Pre-Commit Hook #266

Merged
merged 172 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
172 commits
Select commit Hold shift + click to select a range
58d7c2b
added ruff and nox.
BalzaniEdoardo Feb 21, 2024
720dcd4
config nox for the py3.12
BalzaniEdoardo Feb 21, 2024
cdda670
add `nox`, `ruff` and a section on managing multiple python versions
BalzaniEdoardo Feb 21, 2024
2b94867
adds src to ruff config
billbrod Feb 28, 2024
d25dea2
updates ruff version (to work with src config)
billbrod Feb 28, 2024
fbb55c9
added ruff and pre-commit configurations
hmd101 Jul 6, 2024
e5adecc
basic precommit confi
hmd101 Jul 6, 2024
870d2d6
ruff linter added to ci
hmd101 Jul 6, 2024
dc40707
formatter added
hmd101 Jul 9, 2024
c802033
default check added to ci
hmd101 Jul 9, 2024
5f61b94
assigned separate github actions to ruff code formatter and linters
hmd101 Jul 9, 2024
b0a392c
test
hmd101 Jul 9, 2024
48a571d
test
hmd101 Jul 9, 2024
4302b55
ruff badge added to readme
hmd101 Jul 10, 2024
8d44d45
noxfile added for automated testing across environments after commits
hmd101 Jul 12, 2024
83a3e41
ruff linters, both ignore and select, specified
hmd101 Jul 12, 2024
1badbad
ruff check runs
hmd101 Jul 12, 2024
3fe5fec
linting merge
hmd101 Jul 18, 2024
0c50992
toml formatting
hmd101 Jul 18, 2024
7f8aec4
added addtional pre-commit hooks
hmd101 Jul 18, 2024
3e78c47
pre-commit edits
hmd101 Jul 18, 2024
089497c
default for max line length is 88
hmd101 Jul 19, 2024
1ae3d11
error in deploy file: pypi environment not defined
hmd101 Jul 19, 2024
1e9fc9c
link changed to previous one in ci.yml
hmd101 Jul 20, 2024
1d8a57f
ruff linting and formatting combined in 1 action in CI and added to n…
hmd101 Aug 4, 2024
e0678b8
ci -- calling ruff directly instead of via action
hmd101 Aug 5, 2024
8272ba2
test
hmd101 Aug 5, 2024
34524f5
.
hmd101 Aug 5, 2024
593fd23
Merge branch 'main' into code-formatting
hmd101 Aug 5, 2024
9b5fb54
null changes in notebook reverted
hmd101 Aug 5, 2024
38a4150
in ci, specifying to use ruff config from pyproject.toml
hmd101 Aug 5, 2024
c1fd8bc
updating some deprecated imports, isinstance for union of types, unso…
hmd101 Aug 8, 2024
4bb4333
notebooks 00-quickstart and 02-eigendistortions line-length correction
hmd101 Aug 8, 2024
7786cad
Revert "notebooks 00-quickstart and 02-eigendistortions line-length c…
hmd101 Aug 8, 2024
79e93d3
Revert "updating some deprecated imports, isinstance for union of typ…
hmd101 Aug 8, 2024
3bb9ce1
additional line length and double quote fixes in 02-eigendistortions.…
hmd101 Aug 8, 2024
633d489
all notebooks in experiments refactored to meet pydocstyle and pyflak…
hmd101 Aug 8, 2024
47acd99
all files in metric refactored to meet pydocstyle and pyflakes criteria
hmd101 Aug 8, 2024
618ef87
all files in simulate and models refactored to meet pydocstyle and p…
hmd101 Aug 8, 2024
43937bc
all files in src refactored to meet pydocstyle and pyflakes criteria
hmd101 Aug 8, 2024
01bbaf9
running pyupgrade linter to upgrade syntac for newer versions
hmd101 Aug 9, 2024
bb714bf
running flake8 simplify on entire codebase
hmd101 Aug 9, 2024
8724a2b
removing # noqa: UP035 tag
hmd101 Aug 9, 2024
fa29088
test coverage session added to noxfile
hmd101 Aug 13, 2024
13f3db2
pytest ini_options adjustments to accomodate module not implemented e…
hmd101 Aug 13, 2024
d3e825c
updating test session in nox file to install all dependencies as list…
hmd101 Aug 13, 2024
4aa2765
pytest can now be run with nox including test coverage
hmd101 Aug 13, 2024
180a17e
resolving some too long lines
hmd101 Aug 14, 2024
5c16f7e
resolving merge conflict
hmd101 Aug 14, 2024
cec2844
too long lines in validate.py corrected
hmd101 Aug 14, 2024
1230ef6
formatting with line-length set to 88
hmd101 Aug 14, 2024
d367c22
too long lines shortened to 88 characters in data and metric
hmd101 Aug 14, 2024
5b76b6a
.
hmd101 Aug 15, 2024
f3eb287
some more fixes
hmd101 Aug 15, 2024
46bc834
removed .keys() from dictionary iteration, replaced if-else with 1-l…
hmd101 Aug 15, 2024
e10f8dd
ignored SIM105 or do we want to use contextlib package instead of try…
hmd101 Sep 13, 2024
d375f32
ambigious variable name in external refactored
hmd101 Sep 17, 2024
07fd3ef
tests test_metric and test_models fail
hmd101 Sep 17, 2024
bda1de7
replacing if-else block with ternary conditional operator
hmd101 Sep 19, 2024
45a9890
removing too long lines
hmd101 Sep 19, 2024
d7fbd6e
replacing if-else block by returning boolean expression directly
hmd101 Sep 19, 2024
e623302
returning boolean expression as opposed to if-if-else block
hmd101 Sep 19, 2024
4d29fd9
replacing nested if-else blocks with elif for readability
hmd101 Sep 19, 2024
4abbc02
too long lines fixed
hmd101 Sep 27, 2024
309e040
in optimizer_step in metamer.py condensed if statements and added che…
hmd101 Sep 27, 2024
302e97e
simplified decision tree conditions in check_convergence
hmd101 Sep 27, 2024
3fba75b
metamers.py refactoring finnished and all tests in test_metamers.py pass
hmd101 Sep 27, 2024
73db7cf
checking if module is available without importing it unnecessarily
hmd101 Sep 27, 2024
0c720a6
ignoring import not being at top of file for fetch.py
hmd101 Sep 27, 2024
d8e1f6a
updating union syntax to python 3.10 bar version, unrelated 420 sha-e…
hmd101 Sep 27, 2024
7d77488
ignoring unused imports linting error F401 in tools init file
hmd101 Sep 27, 2024
8555474
ignoring unused imports linting error F401 in metric init file
hmd101 Sep 27, 2024
bd9b0ec
ignoring wildcard imports linting error F403 in canonical computati…
hmd101 Sep 27, 2024
d1ab319
ignoring wildcard imports linting error F403 and unused imports F401…
hmd101 Sep 27, 2024
d028c67
added predicate ignore-init-module-imports to tool.ruff.lint in pypro…
hmd101 Sep 27, 2024
eabaf30
removed predicate ignore-init-module-imports since deprecated
hmd101 Sep 27, 2024
1952d40
ignoring unused imports F401 and wildcard imports F403
hmd101 Sep 27, 2024
5f54512
ignoring unused imports F401 in synthesize init file
hmd101 Sep 27, 2024
daa38ee
ignoring wildcard imports F401 in simlute init file
hmd101 Sep 27, 2024
1203e89
resolving linting error E402 imports not at top of cell
hmd101 Sep 27, 2024
4e0fa0d
replacing union with pipe operator which resolves UP007 in steerable_…
hmd101 Sep 27, 2024
f08c142
cutting line lenght
hmd101 Sep 27, 2024
a5fb657
making if-blocks more readable and cutting long lines in mad_compteti…
hmd101 Sep 27, 2024
4150226
placing imports to top of cell and shortening too long lines
hmd101 Sep 27, 2024
b2c5a18
fixing too long lines and placing imports at top of cell in notebookd…
hmd101 Sep 27, 2024
718440d
reordering imports and fixing too long lines in notebook geodesics
hmd101 Sep 27, 2024
47aa63d
.
hmd101 Sep 27, 2024
07ff382
shortening lines in eigendistortions.py
hmd101 Sep 27, 2024
12daada
too long lines fixed in notebook metamer-portilla-simoncelli
hmd101 Sep 27, 2024
bd34ed0
too long lines fixed in notebook metamer-portilla-simoncelli
hmd101 Sep 27, 2024
bfda72c
too long lines fixed in notebooks
hmd101 Sep 27, 2024
3db6e8b
too long lines fixed in notebooks
hmd101 Sep 27, 2024
6413588
too long lines fixed in notebooks
hmd101 Sep 27, 2024
bb9c581
too long lines fixed in notebooks
hmd101 Sep 27, 2024
b1e771b
too long lines fixed in notebooks
hmd101 Sep 27, 2024
cca5220
replacing misleading characters l
hmd101 Sep 27, 2024
aec45b7
replacing ambigious l with layer
hmd101 Sep 27, 2024
f47db30
shortening lines
hmd101 Sep 27, 2024
1d34294
replacing ambigious variable names
hmd101 Sep 27, 2024
380112f
.
hmd101 Sep 27, 2024
eb56114
fixing too long lines
hmd101 Sep 27, 2024
e6f10f2
ignoring too long lines in notebook 05 does not work for curl statement
hmd101 Sep 27, 2024
4e62eae
added isort linter and fixed 44 isort errors
hmd101 Sep 27, 2024
1bc6ed1
reformatting
hmd101 Sep 28, 2024
b2c81cd
resolving merge conflict
hmd101 Sep 28, 2024
a4e2f57
tests run again and circular import error resolved
hmd101 Sep 28, 2024
244948d
adding missing import data to init file
hmd101 Sep 28, 2024
9d572e7
fixing linting error
hmd101 Sep 28, 2024
3c1b3db
ruff version updated to 0.6.8, same as on cluster
hmd101 Sep 28, 2024
9975ef0
adding missing import conv to init in tools
hmd101 Sep 28, 2024
a159b1d
formatting fix
hmd101 Sep 28, 2024
5c9e28d
editing string to mitigate notebook error for versions 3.10 and 3.11
hmd101 Sep 28, 2024
6050344
updated 3 cns links from http to https
hmd101 Oct 1, 2024
fb2f5a0
imports sorted in init
hmd101 Oct 1, 2024
3951c79
isort ignored in init file, otherwise errors due to circulr inputs
hmd101 Oct 1, 2024
c2912b0
unused imports uncommented
hmd101 Oct 1, 2024
e13a7ad
when unused imports are removed, tests fail, so included them again
hmd101 Oct 1, 2024
54ebe85
reformatting tests and updating contributing file
hmd101 Oct 1, 2024
a777133
contributing file update completed
hmd101 Oct 1, 2024
9c38e15
ierge branch 'main' of github.com:LabForComputationalVision/plenoptic…
hmd101 Oct 14, 2024
e6e2906
deleting pypi environment in deploy.yml which slipped in from a merge…
hmd101 Oct 14, 2024
3d89cc7
Update CONTRIBUTING.md
hmd101 Oct 14, 2024
2d95a3c
Update CONTRIBUTING.md
hmd101 Oct 14, 2024
f8be38a
Update CONTRIBUTING.md
hmd101 Oct 14, 2024
ef059ff
Update CONTRIBUTING.md
hmd101 Oct 14, 2024
3c2d043
Update CONTRIBUTING.md
hmd101 Oct 14, 2024
7f45b90
Update CONTRIBUTING.md
hmd101 Oct 14, 2024
83da52a
Update CONTRIBUTING.md
hmd101 Oct 14, 2024
dad2a56
Update CONTRIBUTING.md
hmd101 Oct 14, 2024
64a1911
Update CONTRIBUTING.md
hmd101 Oct 14, 2024
b28b63f
replacing os.path.join with pathlib and / operator to concatenate paths
hmd101 Oct 14, 2024
7faf97a
removing ignore in nox lint session
hmd101 Oct 14, 2024
e58e76c
nox removed from mandatory installments
hmd101 Oct 14, 2024
1d72d25
moved import pathlib to top of fetch.py file
hmd101 Oct 14, 2024
89138f8
adding two singleton dimensinos using the unsqueeze function twice, r…
hmd101 Oct 14, 2024
ccd53a9
added examples to tool.ruff in pyproject.toml
hmd101 Oct 14, 2024
bbf8929
removed pydocstyle inting from pyproject.toml as we are currently not…
hmd101 Oct 14, 2024
044dd70
Update CONTRIBUTING.md
hmd101 Oct 14, 2024
a1a3542
Update CONTRIBUTING.md
hmd101 Oct 14, 2024
a386dd3
pyproject.toml parse error for ruff linter, to be fixed
hmd101 Oct 15, 2024
eca8dc2
Merge branch 'code-formatting' of github.com:hmd101/plenoptic into co…
hmd101 Oct 15, 2024
7b96a5d
ruff actions on ci should work now, removed numpy convention, to be a…
hmd101 Oct 15, 2024
f241d9e
fixed SIM105 errors, i.e., replaced try-except blocks using contextl…
hmd101 Oct 15, 2024
a2b1b4f
reverting flowcharts to original version with too long lines and igno…
hmd101 Oct 15, 2024
b0b73f0
removed file extension to be excluded by ruff as they should be ignor…
hmd101 Oct 15, 2024
3047632
replace assert with if/raise
billbrod Oct 15, 2024
3a21c05
mention pre-commit.ci in contributing
billbrod Oct 15, 2024
8d6c4c2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 15, 2024
8935a2c
linting tests and import order
hmd101 Oct 16, 2024
b8d37de
added explicit isort skips to imports which need to be in a specific …
hmd101 Oct 16, 2024
5cf2a12
fixing failing tests by making it catch Value error as opposed to ass…
hmd101 Oct 16, 2024
5a0751f
fixing too long lines in tests
hmd101 Oct 16, 2024
38ac6c3
lambda functions assigned to variables are replaced by acutal functio…
hmd101 Oct 16, 2024
23d5523
removing unused variables in test_models.py in TestNaive class resolv…
hmd101 Oct 16, 2024
9ae80de
removing .keys() when iterating over dictionary keys resolving SIM118
hmd101 Oct 16, 2024
036164c
replacing if-else blocks with ternary operator resolving SIM108
hmd101 Oct 16, 2024
793c0d5
resolving SIM105 by using contextlib instead of try except block
hmd101 Oct 16, 2024
a06e714
replacing percentage sign in print statements with format
hmd101 Oct 16, 2024
9774f49
replacing lambda assigned to variable with function
hmd101 Oct 16, 2024
0fbbf57
replacing for loop keeping track of each index with enumerate resolvi…
hmd101 Oct 16, 2024
e79f873
resoving 2 failed tests by calling model on image in test_models
hmd101 Oct 16, 2024
424bf70
removing unused variabl assignments in test_models
hmd101 Oct 16, 2024
79620e2
simplifying counter variable in enumeration loop
hmd101 Oct 16, 2024
174e0d7
updating contributing file: introducing examples for ruff noqa and ad…
hmd101 Oct 17, 2024
5db20d2
move cones/primaries to json file
billbrod Oct 18, 2024
abb0890
run ruff on conceptual intro
billbrod Oct 21, 2024
f4f1365
remove unnecessary isort:skip
billbrod Oct 21, 2024
431c4aa
puts """ on newline
billbrod Oct 21, 2024
47bfe58
be consistent with contextlib.suppress
billbrod Oct 21, 2024
9e001fa
more changes for suppress
billbrod Oct 21, 2024
2590aa2
switch nox test install to use ".[dev]"
billbrod Oct 21, 2024
90b4472
Apply suggestions from code review
billbrod Oct 21, 2024
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
1 change: 0 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ jobs:
name: Upload release to Test PyPI
needs: [build]
runs-on: ubuntu-latest
environment: pypi
permissions:
hmd101 marked this conversation as resolved.
Show resolved Hide resolved
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
Expand Down
1 change: 0 additions & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,3 @@ conduct enforcement ladder](https://github.com/mozilla/diversity).
For answers to common questions about this code of conduct, see the
FAQ at https://www.contributor-covenant.org/faq. Translations are
available at https://www.contributor-covenant.org/translations.

76 changes: 60 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,18 @@ At this point, we will be notified of the pull request and will read it over. We

If your changes are integrated, you will be added as a Github contributor and as one of the authors of the package. Thank you for being part of `plenoptic`!

### Code Quality and Linting
We use [Ruff](https://docs.astral.sh/ruff/) for linting and formatting our Python code to maintain a consistent code style and catch potential errors early. To ensure your contributions meet these standards, please follow the guidelines below:
### Code Style and Linting
We use [Ruff](https://docs.astral.sh/ruff/) for linting and formatting our Python code to maintain a consistent code style and catch potential errors early. We run ruff as part of our CI and non-compliant code will not be merged!

#### Using Ruff

Ruff is a fast and comprehensive Python formatter and linter that checks for common style and code quality issues. It combines multiple tools, like Pyflakes, pycodestyle, isort, and other linting rules into one efficient tool, which are specified in `pyproject.toml`. Before submitting your code, make sure to run Ruff to catch any issues.
Ruff is a fast and comprehensive Python formatter and linter that checks for common style and code quality issues. It combines multiple tools, like black, Pyflakes, pycodestyle, isort, and other linting rules into one efficient tool, which are specified in `pyproject.toml`. Before submitting your code, make sure to run Ruff to catch any issues. See other sections of this document for how to use `nox` and `pre-commit` to simplify this process.

**Using Ruff for [Formatting](https://docs.astral.sh/ruff/formatter/#philosophy):**
Ruff has two components, a [formatter](https://docs.astral.sh/ruff/formatter/) and a [linter](https://docs.astral.sh/ruff/linter/). Formatters and linters are both static analysis tools, but formatters "quickly check and reformat your code for stylistic consistency without changing the runtime behavior of the code", while linters "detect not just stylistic inconsistency but also potential logical bugs, and often suggest code fixes" (per [GitHub's readme project](https://github.com/readme/guides/formatters-linters-compilers)). There are many choices of formatters and linters in python; ruff aims to combine the features of many of them while being very fast.

For both the formatter and the linter, you can run ruff without any additional arguments; our configuration option are stored in the `pyproject.toml` file and so don't need to be specified explicitly.

##### Formatting:

`ruff format` is the primary entrypoint to the formatter. It accepts a list of files or directories, and formats all discovered Python files:
```bash
Expand All @@ -143,7 +147,7 @@ ruff format path/to/file.py # Format a single file.
```
For the full list of supported options, run `ruff format --help`.

**Using Ruff for [Linting](https://docs.astral.sh/ruff/linter/):**
##### Using Ruff for Linting:

To run Ruff on your code:
```bash
Expand All @@ -160,15 +164,29 @@ ruff --fix .
Be careful with **unsafe fixes**, safe fixes are symbolized with the tools emoji and are listed [here](https://docs.astral.sh/ruff/rules/)!

#### Ignoring Ruff Linting
You may want to suppress lint errors, for example when too long lines (code `E501`) are desired because otherwise the url might not be readable anymore.
In some cases, it may be acceptable to suppress lint errors, for example when too long lines (code `E501`) are desired because otherwise the url might not be readable anymore. These ignores will be evaluated on a case-by-case basis.
You can do this by adding the following to the end of the line:

```bash
# noqa: E501
This line is tooooooo long. # noqa: E501
```
If you want to suppress an error across an entire file, do this:
If you want to suppress an error across an entire file, do this at the top of the file:
```bash
# ruff: noqa: E501
Below is my python script
...
...
And any line living in this file can be as long as it wants ...
...
```


In some cases, you want to not only suppress the error message a linter throws but actually _disable_ a linting rule. An example might be if the import order matters and running `isort` would mess with this.
Then you can introduce an [action comment](https://pycqa.github.io/isort/docs/configuration/action_comments.html) like this such that isort does _not_ sort the following packages alphabetically:
billbrod marked this conversation as resolved.
Show resolved Hide resolved

```bash
import numpy as np # isort: skip
import my_package as mp # isort: skip
```

For more details, refer to the [documentation](https://docs.astral.sh/ruff/linter/#error-suppression).
Expand All @@ -183,15 +201,22 @@ For more details, refer to the [documentation](https://docs.astral.sh/ruff/linte
complete docstrings, but they probably should.

#### Pre-Commit Hooks: Identifying simple issues before submission to code review (and how to ignore those)
Pre-commit hooks are useful for the developer to check if all the linting and formatting rules (see Ruff above) are honored _before_ committing. That is, when you commit, pre-commit hooks are run and auto-fixed where applicable (e.g., trailing whitespace). You then need to add _again_ if you want these changes to be included in your commit.
[Pre-commit](https://pre-commit.com/) hooks are useful for the developer to check if all the linting and formatting rules (see Ruff above) are honored _before_ committing. That is, when you commit, pre-commit hooks are run and auto-fixed where possible (e.g., trailing whitespace). You then need to add _again_ if you want these changes to be included in your commit. If the problem is not automatically fixable, you will need to manually update your code before you are able to commit.

Using pre-commit is optional. We use [pre-commit.ci](https://pre-commit.ci/) to run pre-commit as part of PRs (auto-fixing wherever possible), but it may simplify your life to integrate pre-commit into your workflow.

In order to use pre-commit, you must install the `pre-commit` package into your development environment, and then install the hooks:

```bash
pip install pre-commit
pre-commit install
```

Should you want to ignore pre-commit hooks, you can add `--no-verify` to your commit message like this:
After installation, should you want to ignore pre-commit hooks for some reason (e.g., because you have to run to a meeting but don't have time to fix all the linting errors but still want your changes to be commited), you can add `--no-verify` to your commit message like this:
billbrod marked this conversation as resolved.
Show resolved Hide resolved
```bash
git commit -m <my commit message> --no-verify
```

All of the above only applies, if you have the pre-commit package manager installed using
`pip install pre-commit`.

### Adding models or synthesis methods

Expand Down Expand Up @@ -272,6 +297,25 @@ nox

`nox` will read the configuration from the `noxfile.py` script.

If you only want to run an individual session (e.g., lint or test), you can first check which sessions are available with the following command:

```bash
nox -l
```
or
```bash
nox -list
```
billbrod marked this conversation as resolved.
Show resolved Hide resolved

Then you can use

```bash
nox -s <your_nox_session>
```
to run the session of your choice.

Here are some examples:

If you want to run just the tests, add the following option,
billbrod marked this conversation as resolved.
Show resolved Hide resolved

```bash
Expand All @@ -293,12 +337,14 @@ nox -s coverage
`nox` offers a variety of configuration options, you can learn more about it from their
[documentation](https://nox.thea.codes/en/stable/config.html).

hmd101 marked this conversation as resolved.
Show resolved Hide resolved
Note that nox works particularly well with pyenv, discussed later in this file, which makes it easy to install the multiple python versions used in testing.

#### Multi-python version testing with pyenv
Sometimes, before opening a pull-request that will trigger the `.github/workflow/ci.yml` continuous
integration workflow, you may want to test your changes over all the supported python versions locally.

Handling multiple installed python versions on the same machine can be challenging and confusing.
[`pyenv`](https://github.com/pyenv/pyenv) is a great tool that really comes to the rescue.
[`pyenv`](https://github.com/pyenv/pyenv) is a great tool that really comes to the rescue. Note that `pyenv` just handles python versions --- virtual environments have to be handled separately, using [`pyenv-virtualenv`](https://github.com/pyenv/pyenv-virtualenv)!

This tool doesn't come with the package dependencies and has to be installed separately. Installation instructions
are system specific but the package readme is very details, see
Expand Down Expand Up @@ -346,9 +392,7 @@ If you want to run `nox` on multiple python versions, all you need to do is:

Note that `noxfile.py` lists the available option as keyword arguments in a session specific manner.

If you have multiple python version installed, we recommend to manage your virtual environments
through `pyenv`. For that you'll need to install the extension
[`pyenv-virtualenv`](https://github.com/pyenv/pyenv-virtualenv).
As mentioned earlier, if you have multiple python version installed, we recommend you manage your virtual environments through `pyenv` using the [`pyenv-virtualenv`](https://github.com/pyenv/pyenv-virtualenv) extension.

This tool works with most of the environment managers including (`venv` and `conda`).
Creating an environment with it is as simple as calling,
Expand Down
10 changes: 5 additions & 5 deletions docs/conceptual_intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ only use three numbers, often called RGB (red, green, and blue) --- why can we
get away with throwing away so much information? Trichromacy and color metamers
can help explain.

Researchers studying color perception arrived at a standard procedure -- the bipartite color-matching experiment -- for
Researchers studying color perception arrived at a standard procedure -- the bipartite color-matching experiment -- for
constraining a model for trichromatic metamers, illustrated in :numref:`trichromacy`. An observer matches a monochromatic test
color (i.e., a light with energy at only a single wavelength) with the physical
mixture of three different monochromatic stimuli, called **primaries**. Thus,
the goal is to create two perceptually-indistinguishable stimuli (**metamers**).
the goal is to create two perceptually-indistinguishable stimuli (**metamers**).
Perhaps surprisingly, not only is this possible for any test
color, it is also possible for just about any selection of primaries (as long as they're within the
visible light spectrum and sufficiently different from each other). For most human observers, three
visible light spectrum and sufficiently different from each other). For most human observers, three
primaries are required: there are many colors that cannot be matched with only two primaries, and four yields non-unique responses.
However, there are some people, for whom two primaries are sufficient.

Expand All @@ -87,9 +87,9 @@ However, there are some people, for whom two primaries are sufficient.

Color matching experiment

Requiring three primaries for most people, but two for some provided a hint regarding the underlying mechanisms:
Requiring three primaries for most people, but two for some provided a hint regarding the underlying mechanisms:
most people have cone photorecpetors from three distinct classes (generally
referred to as S, M, and L, for "short", "medium", and "long"). But some forms of color blindness arise from genetic
referred to as S, M, and L, for "short", "medium", and "long"). But some forms of color blindness arise from genetic
deviations in which only two classes are represented. Color metamers are created when cone
responses have been matched. Human cones transform colors from a
high-dimensional space (i.e., a vector describing the energy at each wavelength)
Expand Down
108 changes: 58 additions & 50 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,24 @@
#
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath('./tutorials/'))

import plenoptic

sys.path.insert(0, os.path.abspath(".."))
sys.path.insert(0, os.path.abspath("./tutorials/"))


# -- Project information -----------------------------------------------------

project = 'plenoptic'
copyright = '2019, Plenoptic authors'
author = 'Plenoptic authors'
project = "plenoptic"
copyright = "2019, Plenoptic authors"
author = "Plenoptic authors"

# The short X.Y version
version = ''
version = ""
# The full version, including alpha/beta/rc tags
import plenoptic


release = plenoptic.__version__

# -- General configuration ---------------------------------------------------
Expand All @@ -34,51 +38,51 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinx.ext.napoleon',
'numpydoc',
'nbsphinx',
'nbsphinx_link',
'sphinxcontrib.apidoc',
'matplotlib.sphinxext.plot_directive',
'matplotlib.sphinxext.mathmpl',
'sphinx.ext.autodoc',
'sphinx_autodoc_typehints',
'sphinx.ext.intersphinx',
'sphinx_copybutton',
'sphinxemoji.sphinxemoji',
'sphinx_inline_tabs'
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.viewcode",
"sphinx.ext.githubpages",
"sphinx.ext.napoleon",
"numpydoc",
"nbsphinx",
"nbsphinx_link",
"sphinxcontrib.apidoc",
"matplotlib.sphinxext.plot_directive",
"matplotlib.sphinxext.mathmpl",
"sphinx.ext.autodoc",
"sphinx_autodoc_typehints",
"sphinx.ext.intersphinx",
"sphinx_copybutton",
"sphinxemoji.sphinxemoji",
"sphinx_inline_tabs",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '**.ipynb_checkpoints']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "**.ipynb_checkpoints"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# Napoleon settings
napoleon_google_docstring = False
Expand All @@ -101,23 +105,22 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# these are for the sphinx_rtd_theme
html_theme_options = {
'display_version': True,

"display_version": True,
}

# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'plenopticdoc'
htmlhelp_basename = "plenopticdoc"


# -- Options for LaTeX output ------------------------------------------------
Expand All @@ -126,15 +129,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -144,19 +144,21 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'plenoptic.tex', 'plenoptic Documentation',
'Plenoptic authors', 'manual'),
(
master_doc,
"plenoptic.tex",
"plenoptic Documentation",
"Plenoptic authors",
"manual",
),
]


# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'plenoptic', 'plenoptic Documentation',
[author], 1)
]
man_pages = [(master_doc, "plenoptic", "plenoptic Documentation", [author], 1)]


# -- Options for Texinfo output ----------------------------------------------
Expand All @@ -165,9 +167,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'plenoptic', 'plenoptic Documentation',
author, 'plenoptic', 'Visual Information Processing',
'Miscellaneous'),
(
master_doc,
"plenoptic",
"plenoptic Documentation",
author,
"plenoptic",
"Visual Information Processing",
"Miscellaneous",
),
]


Expand All @@ -186,7 +194,7 @@
# epub_uid = ''

# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
epub_exclude_files = ["search.html"]


# -- Extension configuration -------------------------------------------------
Expand Down
Loading
Loading