Changes¶
This chapter describes the changes coming with each new version of pygount.
Version 3.3.0, 2026-xx-xx¶
Development:
- Migrate ReadTheDocs documentation to uv (issue #221).
Version 3.2.0, 2026-04-08¶
- Add detection of SVG as XML dialect (issue #209).
- Fix detecttion of XML dialect when a
<?xml>header was present.
Version 3.1.1, 2025-02-17¶
- Update dependencies and drop support for Python 3.9 (issue #205).
Version 3.1.0, 2025-05-27¶
- Add command line option
--generated-namesto specify which file names should be considered to be generated. The current patterns recognized are somewhat limited, so contributions are welcome. See the section on "Generated files" for hints on how to do that (issue #190). - Change documentation from Sphinx to MkDocs in the hope to avoid it breaking regularly (issue #191).
Development:
- Replace
format()with f-strings (contributed by Ben Allen, issue #166). - Change sdist archive to include more than just the Python source code.
Version 3.0.0, 2025-05-23¶
- Count pure markup files as documentation: (contributed by Tytus Bucholc, issue #6).
- Fix silent error on git failing (contributed by Tom De Bièvre, issue #162)
- Transform common project URLs to repository: (contributed by Tom De Bièvre, issue #164)
- Change dependency rules for rich to be more lenient (suggested by Brian McGillion, issue #193)
Version 2.0.0, 2025-03-16¶
- Fix
TypeErrorwhen processing files with a magic encoding comment specifying an unknown encoding and using--format=json(contributed by PyHedgehog, issue #176) - Fix false positives when extracting the encoding from magic coding comments (issue #184)
- Add support for Python 3.13 and later (issue #174)
- Remove temporary directory in the output of a git analysis (contributed by Isabel Beckenbach, issue #113)
- Remove support for Python 3.8 (issue #158)
- Development: Change packaging to uv (issue #180).
- Development: Change linter to ruff and in turn, clean up code (issue #157).
- Development: Change default branch to main (issue #160).
- Removed deprecated code: (contributed by Marco Gambone and Niels Vanden Bussche, issue #47).
Version 1.8.0, 2024-05-13¶
- Add all available counts and percentages to JSON format (issue #122).
In particular, this makes available the codeCount, which is similar to the already existing sourceCount but does exclude lines that contain only strings. You can check their availability by validating that the formatVersion is at least 1.1.0.
The documentation about "How to count code has more information about the available counts and the ways they are computed.
Pygount 2.0 will probably introduce some breaking changes in this area, which can already be previewed and discussed at issue #152.
Version 1.7.0, 2024-05-13¶
- Fix analysis with FIPS mode by changing computation of hash for duplicate detection from MD5 to SHA256. As a side effect, reasonably modern machines should receive a (probably unnoticeable) minor performance boost (contributed by Matthew Vine, issue #137).
- Add command line option
--merge-embedded-languagesto merge embedded languages into their base language. For example, "HTML+Django/Jinja" counts as "HTML" (issue #105). - Add Python 3.12 and make it the main version for CI (issue #145).
Version 1.6.1, 2023-07-02¶
- Fix missing check for seekable file handles (issue #114).
- Fix the ReadTheDocs documentation build by switching to the built-in alabaster Sphinx theme (issue #116).
Version 1.6.0, 2023-06-26¶
- Add support for analysis of remote git URL\'s in addition to local files (contributed by Rojdi Thomallari, issue #109).
- Removed support for Python 3.7.
- Improve API:
- Add an option to pass a file handle to
SourceAnalysis.from_file()(contributed by Dominik George, issue #100).
Version 1.5.1, 2023-01-02¶
- Remove progress bar for
--format=sloccountbecause it resulted into blank lines when running on Windows and could cause interwoven output on Unix (issue #91).
Version 1.5.0, 2022-12-30¶
- Remove support for Python 3.6 and update dependencies (issue #93).
Version 1.4.0, 2022-04-09¶
- Add progress bar during scan phase and improve visual design of
--format=summary(contributed by Stanislav Zmiev, issue #73). - Add percentages to API. For example in addition to
code_countnow there also iscode_percentage.
Version 1.3.0, 2022-01-06¶
- Fix computation of "lines per second", which was a copy and paste of "files per second".
- Add JSON as additional output
--format, see JSON for details (issue #62). - Add detection of GitHub community files without a suffix as text (issue #54).
- Change the build process to poetry to change several messy configuration files into a single even more messy configuration file.
Version 1.2.5, 2021-05-16¶
- Remove support for Python 3.5. Probably it still works, but there is no easy way to test this anymore because 3.5 reached its end of life a while ago.
Version 1.2.4, 2020-08-11¶
- Fix scanning of "." (for current folder), which was skipped entirely (issue #56).
Version 1.2.3, 2020-07-05¶
- Improve detection of text files by trying to guess a lexer for
*.txtbefore assuming it is text. This basically fixes the detection ofCMakelists.txtas CMake file #53). However, it will only work with some files due to multiple issues with the regular expression Pygments used in versions up to 2.6.1 to detect CMake headers. This should be fixed once pull request #1491 is applied.
Version 1.2.2, 2020-06-24¶
- Changed preprocessor statements to count as code, unlike Pygments which treats them as special comments (contributed by nkr0, issue #51).
Version 1.2.1, 2020-04-02¶
- Fix broken links in README on PyPI by moving the documentation to ReadTheDocs.
- Improv API:
- Change factory functions to methods and added deprecation warnings:
source_analysis→SourceAnalysis.from_filepseudo_source_analysis→SourceAnalysis.from_state
- Change attributes in
SourceAnalysisto read-only properties. - Rename properties holding counts from
xxxtoxxx_count. - Add API reference to documentation.
- Add a couple of type hints and assertions.
Version 1.2.0, 2020-03-30¶
- Add file count to summary.
- Change installation to fail when attempting to install on Python earlier than 3.5.
- Improve API:
- Change
SourceAnalysis.stateto be a proper enum instead of a string. - Add
ProjectSummaryto summarize multiple files. - Clean up the project:
- Change continuous integration from Travis CI to GitHub actions in the hope that the CI build does not automatically break after a while because things constantly change in the CI backend.
- Change README format from reStructuredText to Markdown.
- Improve badges in README: added a badge for supported Python versions and unified the layout by using https://shields.io.
- Remove obsolete development files (for ant, tox etc).
Version 1.1.0, 2020-03-10¶
- Fix
--folders-to-skipand--names-to-skipwhich simply were ignored (contributed by pclausen, issue #17). - Add option
--format=summaryto get a language overview and sum total (based on a contribution by Yuriy Petrovskiy, issue #16). - Add Python 3.7 and 3.8 to the list of supported versions.
- Drop support for Python 3.3 and 3.4, mostly because it became hard to test without going through major hoops.
Version 1.0.0, 2017-07-04¶
- Fix confusing warning about XML file
<unknown>caused by SAX parser. As a workaround,<unknown>is now replaced by the actual path of the XML file that cannot be parsed. - Add Python 3.6 to the list of supported versions (issue #14).
Version 0.9, 2017-05-04¶
- Fix
AssertionErrorwhen option--encoding=chardetwas specified. - Change the warning message "no fallback encoding specified, using \<encoding>" to a debug message because it did not add any interesting information as the encoding actually used is visible in the info message for each file.
- Add detection of binary files and exclude them from the analysis. In particular Django model objects (
*.mo) are not considered Modelica source code anymore (issue #11). - Add detection of DocBook XML by DTD (issue #10).
- Add support for suffices to indicate PL/SQL files according to Oracle FAQ entry on file extensions (issue #12).
- Add possibility to specify a fallback encoding for encoding 'chardet'. Use e.g.
--encoding=chardet;cp1252.
Version 0.8, 2016-10-07¶
- Fix option
--verbose. Now each analyzed source code results in at least one informational message in the log. - Add detection of duplicates using size and then MD5 code as criteria (issue #2). Use the option
--duplicatesto still count duplicate source code. - Improve detection of programming language, which is now more consistent and yields the same language between Python invocations.
Version 0.7, 2016-09-28¶
- Fix that option
--generatedwas ignored. - Add support for a couple of languages not supported by
pygmentsyet: - m4, VBScript, and WebFOCUS use minimalistic lexers that can distinguish between comments and code.
- OMG IDL repurposes the existing Java lexer.
- Add detection of certain XML dialects as separate language (issue #8).
Version 0.6, 2016-09-26¶
- Fix that source files could end up as
__error__if the first non-ASCII characters showed up only after kilobyte 16 and the encoding was not UTF-8. Now pygount attempts to read the whole file as UTF-8 before assuming it actually is UTF-8. - Change lines in plain text files to count as comments (issue #9). Before pygments treated them as
ResourceBundle. - Change that empty files have
__empty__as language (issue #7). - Extend workaround for pygments issue #1284 to replace any lexer
*+Evoqueby*.
Version 0.5, 2016-09-22¶
- Add that generated source code is excluded from analysis (issue #1). Use option
--generatedto specify patterns that indicate generated code. - Add workaround for pygments sometimes detecting the same XML file as XML and other times as XML+Evoque (probably depending on the hash seed). Now XML+Evoque is always changed to XML.
- Add
__pycache__as default--folders-to-skip. - Add notes on pseudo languages for source code that cannot be analyzed.
Version 0.4, 2016-09-11¶
- Fixed
LookupErroron broken encoding in magic comment (issue #4). - Add options
--folders-to-skipand--names-to-skipto specify which files should be excluded from analysis. - Add comma (
,) and colon (:) to list of "white characters" that do not count as code if there is nothing else in the line. - Improve pattern matching: for all options that according to
--helptakePATTERNSyou can now specify that the patterns are regular expressions instead of shell patterns (using[regex]) and that they should extend the default patterns (using[...]). - Improve documentation: added notes on how code is counted and how pygount compares to other similar tools.
Version 0.3, 2016-08-20¶
- Fix
@remcomments in DOS batch files (issue #3). - Clean up code.
Version 0.2, 2016-07-10¶
- Fix that files starting with underscore (e.g.
__init__.py) were excluded from analysis. - Change
chardetpackage to be optional. - Add possibility to specify single files and glob patterns to analyze.
- Add that lines containing only certain characters are treated as white space instead of code. Currently, this concerns brackets (
()[]{}) and semicolon (;). - Add that Python's
passstatement is treated as white space instead of code. - Clean up and (slightly) optimized code.
Version 0.1, 2016-07-05¶
- Initial public release.