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

Revert a private API in the HTML formatter #1655

merged 1 commit into from Dec 30, 2020


Copy link

@kurtmckee kurtmckee commented Dec 30, 2020

This should revert the behavior of the function without losing the overall caching behavior that was intended.

In addition to running the unit tests, I confirmed identical SHA1 checksums for before-and-after HTML documents generated with (and without) the -O noclasses option.

@asottile, please confirm that this fixes #1644. Thanks!

This should revert the behavior of the function without losing
the overall caching behavior that was intended.

Closes pygments#1644
Copy link

@asottile asottile commented Dec 30, 2020

yep! can confirm -- thanks!

$ git clone
Cloning into 'pygments-ansi-color'...
remote: Enumerating objects: 92, done.
remote: Total 92 (delta 0), reused 0 (delta 0), pack-reused 92
Receiving objects: 100% (92/92), 21.86 KiB | 621.00 KiB/s, done.
Resolving deltas: 100% (46/46), done.

$ cd pygments-ansi-color/

$ tox --devenv venv
py create: /tmp/pygments-ansi-color/venv
py installdeps: -rrequirements-dev.txt
py develop-inst: /tmp/pygments-ansi-color
py installed: appdirs==1.4.4,attrs==20.3.0,cfgv==3.2.0,coverage==5.3.1,distlib==0.3.1,filelock==3.0.12,identify==1.5.10,iniconfig==1.1.1,nodeenv==1.5.0,packaging==20.8,pluggy==0.13.1,pre-commit==2.9.3,py==1.10.0,Pygments==2.7.3,-e,pyparsing==2.4.7,pytest==6.2.1,PyYAML==5.3.1,six==1.15.0,toml==0.10.2,virtualenv==20.2.2
___________________________________ summary ____________________________________
  py: skipped tests
  congratulations :)

$ venv/bin/pip install git+
Collecting git+
  Cloning (to revision fix-1644) to /tmp/pip-req-build-6medy8pu
Building wheels for collected packages: Pygments
  Building wheel for Pygments ( ... done
  Created wheel for Pygments: filename=Pygments-2.7.3.dev20201229-py3-none-any.whl size=951640 sha256=13c0bc3a35db5ea9e3740647b42d8a1acefcb07f05050b9ba3bf1bafc1217233
  Stored in directory: /tmp/pip-ephem-wheel-cache-ypriv75o/wheels/5a/f4/4f/e090c5a32f60b106eea9c6a23e5d75fc866eae9b6f24b526c1
Successfully built Pygments
Installing collected packages: Pygments
  Attempting uninstall: Pygments
    Found existing installation: Pygments 2.7.3
    Uninstalling Pygments-2.7.3:
      Successfully uninstalled Pygments-2.7.3
Successfully installed Pygments-2.7.3.dev20201229
WARNING: You are using pip version 20.2.4; however, version 20.3.3 is available.
You should consider upgrading via the '/tmp/pygments-ansi-color/venv/bin/python -m pip install --upgrade pip' command.

$ venv/bin/pytest tests
============================= test session starts ==============================
platform linux -- Python 3.8.5, pytest-6.2.1, py-1.10.0, pluggy-0.13.1
rootdir: /tmp/pygments-ansi-color
collected 30 items                                                             

tests/ ..............................         [100%]

============================== 30 passed in 0.07s ==============================

Copy link

@Anteru Anteru commented Dec 30, 2020

@kurtmckee Thanks for the timely fix, much appreciated! I'll merge this for now, but I'd like to encourage @asottile to come up with either an alternative solution or a proposal for an API which would prevent this kind of breakage in the future. I definitely don't want people to rely on private APIs, and if it's generally useful (or can be made generally useful), we should move it to some well-defined public API.

@Anteru Anteru merged commit 9d44d9a into pygments:master Dec 30, 2020
13 checks passed
@kurtmckee kurtmckee deleted the fix-1644 branch Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants