GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add "color" install extra · Issue #7683 · pytest-dev/pytest

Add "color" install extra #7683

New issue
Copy link
New issue
Copy link
Closed
#13189
Closed
Add "color" install extra#7683
#13189
Copy link
Labels
topic: reportingrelated to terminal output and user-facing messages and errorstype: proposalproposal for a new feature, often to gather opinions or design the API around the new feature

Description

@GergelyKalmar
GergelyKalmar
opened on Aug 24, 2020
Issue body actions

Allowing the user to install color support through an install extra (e.g. pip install pytest[color]) would be nicer than requiring that a random package be placed in the long list of requirements, I think.

It should be quite straightforward to implement this (see https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies).

Reacted by Connor Brinton, Axel Haustant and KotlinIsland
Reacted by Éloi Rivard, Patrick Lehmann and Axel Haustant

Activity

  1. GergelyKalmar commented on Aug 24, 2020

    @GergelyKalmar
    GergelyKalmar
    on Aug 24, 2020
    ContributorAuthor
    More actions

    Related to #7132 as well.

  2. Zac-HD
    added
    topic: reportingrelated to terminal output and user-facing messages and errors
    type: proposalproposal for a new feature, often to gather opinions or design the API around the new feature
    on Aug 25, 2020
  3. asottile commented on Aug 25, 2020

    @asottile
    asottile
    on Aug 25, 2020
    Member
    More actions

    iirc the plan of record is to make pygments a normal dependency of pytest, the syntax coloring right now is considered experimental

  4. nicoddemus commented on Aug 25, 2020

    @nicoddemus
    nicoddemus
    on Aug 25, 2020
    Member
    More actions

    @asottile is correct: it is experimental at the moment and we're not 100% sure we will go with pygments just yet, that's why also there's no option to configure styles.

    Because it is uncertain, I would not like to add an extra just now because extras can be considered part of the public API.

    Reacted by Gergely Kalmár
  5. GergelyKalmar commented on Feb 7, 2022

    @GergelyKalmar
    GergelyKalmar
    on Feb 7, 2022
    ContributorAuthor
    More actions

    With pytest 7 out it seems that Pygments-based coloring is now less of an experimental feature – would it perhaps make sense to consider adding it to the list of regular requirements (or as an extra if the opt-in route is preferred)?

    Reacted by Freya Bruhin
    Reacted by Axel Haustant
  6. The-Compiler
    marked (📚) document pygments #13174 as a duplicate of this issue on Jan 30, 2025
  7. nicoddemus commented on Jan 30, 2025

    @nicoddemus
    nicoddemus
    on Jan 30, 2025
    Member
    More actions

    It has been some years now and I we don't have plans to move away from pygments any time soon.

    I think the safest approach is to add it as an extra dependency (color?). I would avoid making it a normal dependency for now, because pygments itself uses pytest.

    It would be great if anyone could contribute a PR with that. 👍

  8. The-Compiler commented on Jan 31, 2025

    @The-Compiler
    The-Compiler
    on Jan 31, 2025
    Member
    More actions

    I would avoid making it a normal dependency for now, because pygments itself uses pytest.

    Is that really as much as a problem as it used to be in previous years, and if so, can we do something about that?

    For what it's worth, we already are in the same situation for exceptiongroup, packaging and (maybe to a lesser extent, as under our control) iniconfig and pluggy. We also were in the same situation with attrs, and from what I can see in #10669 this never was an argument (at least when removing it).

  9. The-Compiler commented on Jan 31, 2025

    @The-Compiler
    The-Compiler
    on Jan 31, 2025
    Member
    More actions

    Oh, and as for why it IMHO shouldn't be an optional dependency:

    • Just more moving parts. Our testsuite breaks without pygments installed, so if we accidentally do a change that makes Pygments non-optional, we would never notice.
    • Way less discoverability. Even if documented, most people will just pip install pytest and not know they're missing out on nicer output.
    • Convenience. I test a lot of things in throw-away virtualenvs (also for reproducing pytest bugs and whatnot), and I usually don't think about also installing pygments even if I know that pytest would use it if present.
    Reacted by Gergely Kalmár
  10. nicoddemus commented on Jan 31, 2025

    @nicoddemus
    nicoddemus
    on Jan 31, 2025
    Member
    More actions

    Thanks @The-Compiler, good points about this already being a problem for exceptiongroup and packaging, I guess this is not much of a problem in practice then.

    That said then I'm OK with just adding pygments as a normal dependency.

  11. The-Compiler
    added a commit that references this issue on Feb 3, 2025

    Make pygments dependency required

    This issue will close once commit 52a5ff3 is merged into the 'master' branch.
    52a5ff3
  12. The-Compiler commented on Feb 3, 2025

    @The-Compiler
    The-Compiler
    on Feb 3, 2025
    Member
    More actions

    Opened #13189 to turn it into a regular dependency.

    Reacted by Gergely Kalmár
  13. The-Compiler
    added a commit that references this issue on Feb 3, 2025

    Make pygments dependency required

    This issue will close once commit ef07401 is merged into the 'master' branch.
    ef07401
  14. bluetech commented on Feb 4, 2025

    @bluetech
    bluetech
    on Feb 4, 2025
    Member
    More actions

    Personally I have projects which want minimal dependencies so I appreciate that pygments is optional. But I understand that the way it's currently done is not ideal, so I support making it a required dependency.

    Hopefully if Python packaging gains the ability to have "default extras" we could switch to that - add a color extra, make it a default but allow people who really want to turn it off. Quick search shows that there is now a draft PEP for this PEP 771 – Default Extras for Python Software Packages so there is hope.

    Reacted by Freya Bruhin
  15. The-Compiler commented on Feb 4, 2025

    @The-Compiler
    The-Compiler
    on Feb 4, 2025
    Member
    More actions

    Personally I have projects which want minimal dependencies

    I can see wanting to have minimal direct dependencies, and I can see wanting to have minimal runtime dependencies. I think for a transitive dependency that's also development-only, it might be less of an issue?

    Hopefully if Python packaging gains the ability to have "default extras" we could switch to that

    That would be cool! From looking at python/peps#4198 that's only some 2-3 weeks old, but it would definitely make this kind of thing easier!

  16. The-Compiler
    added 2 commits that reference this issue on Feb 4, 2025

    Make pygments dependency required

    This issue will close once commit 48994ca is merged into the 'master' branch.
    48994ca

    Make pygments dependency required

    This issue will close once commit 0332aa0 is merged into the 'master' branch.
    0332aa0
  17. The-Compiler
    closed this as completedin #13189on Feb 8, 2025
  18. The-Compiler
    closed this as completedin a3d55a6on Feb 8, 2025
  19. hugovk
    added a commit that references this issue on Feb 9, 2025

    Make pygments mandatory and fix string highlighting (pytest-dev#13189)

    This issue will close once commit a3d55a6 is merged into the 'main' branch.
    a3d55a6
  20. luketainton
    added a commit that references this issue on Jan 5, 2026

    chore(deps): update dependency pytest to v9 (#305)

    4b75154
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: reportingrelated to terminal output and user-facing messages and errorstype: proposalproposal for a new feature, often to gather opinions or design the API around the new feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.