smarie / mkdocs-gallery

Same features as sphinx-gallery (https://sphinx-gallery.github.io/) but on mkdocs (https://www.mkdocs.org/) (no sphinx dependency !).
https://smarie.github.io/mkdocs-gallery
BSD 3-Clause "New" or "Revised" License
40 stars 16 forks source link

Required packages for documentation build only listed in nox [docs] session #30

Open mchaaler opened 2 years ago

mchaaler commented 2 years ago

Move (or duplicate?) list of packages needed to build mkdocs-gallery documentation from noxfile.py (MKDOCS_GALLERY_EXAMPLES_REQS list) to setup.cfg as optional dependencies?

Refer to https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#optional-dependencies.

For example:

[options.extras_require]
docs =
    matplotlib,
    seaborn,
    statsmodels,
    plotly,
    # memory_profiler,
    pillow  # PIL, required for image rescaling

Thus, the following command can be used to install these dependencies in the current Python virtual env: pip install -e .[docs]

This can be useful for debugging puposes, when one needs to run mkdocs build without using nox.

smarie commented 2 years ago

I am not against it, but I am not sure that my nox_utils tool would know which ones to install with conda and which ones to install with pip...

An alternative is to provide requirements files in a folder named requirements:

Users not wishing to use conda can install all requirements files with pip. Would that be something ok for you ?

Note that personally I use PyCharm, and I simply tell PyCharm to use the python.exe created by nox in the .nox/doc/ folder. So I debug using the exact same session that nox uses.

smarie commented 2 years ago

Note: there is already a flake8_requirements.txt in ci_tools/ and a nox_requirements.txt at the root (this one should remain at the root)

mchaaler commented 2 years ago

No problem, I was just asking. I find the possibility to install extra dependencies by specifying a [keyword] to pip install rather elegant and was wondering if it was something that could be applied to mkdocs-gallery.

I am not against it, but I am not sure that my nox_utils tool would know which ones to install with conda and which ones to install with pip...

Why do you need some packages to be installed by conda, and the others by pip? Why not everything through pip? I usually consider that 'if it works with pip, it should work with conda as well'...

Note that personally I use PyCharm, and I simply tell PyCharm to use the python.exe created by nox in the .nox/doc/ folder. So I debug using the exact same session that nox uses.

Understood. That's clever and might be useful sometimes.

It's just that I like to be able to do everything in the conda virtual environment I create when I start a project (no need to switch between environments in PyCharm, whether I want to build the docs, run the tests or check the CLI).