Erotemic / xdoctest

A rewrite of Python's builtin doctest module (with pytest plugin integration) with AST instead of REGEX.
Apache License 2.0
205 stars 12 forks source link

HUGE list of dependencies - accident or intention? #154

Open hoffch opened 6 months ago

hoffch commented 6 months ago

I am using xdoctest 1.1.3 installed with poetry. I just realized by chance that the list of xdoctest's dependencies is surprisingly large:

 - attrs >=19.2.0
 - colorama >=0.4.1
 - debugpy >=1.6.0
 - ipykernel >=6.11.0
 - IPython >=7.23.1
 - ipython-genutils >=0.2.0
 - jedi >=0.16
 - jinja2 >=3.0.0
 - jupyter-client >=7.0.0
 - jupyter-core >=4.7.0
 - nbconvert >=6.1.0
 - pyflakes >=2.2.0
 - Pygments >=2.4.1
 - pytest >=6.2.5
 - pytest-cov >=3.0.0
 - tomli >=0.2.0

With transitive dependencies, this sums up to 41 packages that are required by xdoctest. While I really like xdoctest, this actually prevents me from using it anymore. Too much complexity for the provided functionality. Plus the dependency installation slows down the CI unnecessarily.

Is that huge list really required? Or did some dev dependency (e.g. pyflakes) accidentally sneak into the main deps?

EDIT: It seems a lot of dependencies are related to doctests in Jupyter notebooks. Maybe Jupyter support can be made an opt-in feature on installation using extras (pip install xdoctest[jupyter]). That would drastically reduce the dependencies for everyone not working with Jupyter notebooks.

Erotemic commented 6 months ago

There are no runtime dependencies for xdoctest. Poetry is being too aggressive extracting optional dependencies.

All requirements are separated by type here: https://github.com/Erotemic/xdoctest/tree/main/requirements Notice that runtime.txt is empty.

The reason I'm still on setuptools is because I parse these requirement.txt files and will optionally replace a ">=" with a "==" to pin to strict versions on user request. The extra_requires are defined here: https://github.com/Erotemic/xdoctest/blob/main/setup.py#L208 but the relevent code is:

    setupkw["extras_require"] = {
        "all": parse_requirements("requirements.txt", versions="loose"),
        "tests": parse_requirements("requirements/tests.txt", versions="loose"),
        "optional": parse_requirements("requirements/optional.txt", versions="loose"),
        "all-strict": parse_requirements("requirements.txt", versions="strict"),
        "runtime-strict": parse_requirements(
            "requirements/runtime.txt", versions="strict"
        ),
        "tests-strict": parse_requirements("requirements/tests.txt", versions="strict"),
        "optional-strict": parse_requirements(
            "requirements/optional.txt", versions="strict"
        ),
        'tests-binary': parse_requirements('requirements/tests-binary.txt'),
        'tests-binary-strict': parse_requirements('requirements/tests-binary.txt', versions='strict'),
        'colors': parse_requirements('requirements/colors.txt'),
        'jupyter': parse_requirements('requirements/jupyter.txt'),
    }