Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ exclude: "^.idea"

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.11
rev: v0.15.1
hooks:
- id: ruff
args: ["--fix"]
Expand All @@ -14,7 +14,7 @@ repos:
- id: prettier

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: fix-byte-order-marker
- id: trailing-whitespace
Expand All @@ -29,7 +29,7 @@ repos:
- id: debug-statements

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: no-commit-to-branch
args: ["--branch", "main"]
4 changes: 4 additions & 0 deletions docs/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
This chapter describes the changes coming with each new version of
pygount.

## Version 3.1.1, 2025-02-17

- Update dependencies and drop support for Python 3.9 (issue [#205](https://github.com/roskakori/pygount/issues/205)).

## Version 3.1.0, 2025-05-27

- Add command line option [`--generated-names`](usage.md#-generated-names) to 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](background.md#generated-files)" for hints on how to do that (issue [#190](https://github.com/roskakori/pygount/issues/190)).
Expand Down
100 changes: 50 additions & 50 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
# This file was autogenerated by uv via the following command:
# uv export --no-hashes --format requirements-txt
-e .
babel==2.17.0
babel==2.18.0
# via mkdocs-material
backrefs==5.8
backrefs==6.2
# via mkdocs-material
certifi==2025.4.26
certifi==2026.1.4
# via requests
cfgv==3.4.0
cfgv==3.5.0
# via pre-commit
chardet==5.2.0
# via pygount
charset-normalizer==3.4.2
charset-normalizer==3.4.4
# via requests
click==8.1.8 ; python_full_version < '3.10'
# via
# mkdocs
# pur
click==8.2.1 ; python_full_version >= '3.10'
click==8.3.1
# via
# mkdocs
# pur
Expand All @@ -27,48 +23,44 @@ colorama==0.4.6
# mkdocs
# mkdocs-material
# pytest
coverage==7.8.2
coverage==7.13.4
# via
# coveralls
# pytest-cov
coveralls==4.0.1
distlib==0.3.9
coveralls==4.0.2
distlib==0.4.0
# via virtualenv
docopt==0.6.2
# via coveralls
exceptiongroup==1.3.0 ; python_full_version < '3.11'
exceptiongroup==1.3.1 ; python_full_version < '3.11'
# via pytest
filelock==3.18.0
filelock==3.24.2
# via virtualenv
ghp-import==2.1.0
# via mkdocs
gitdb==4.0.12
# via gitpython
gitpython==3.1.44
gitpython==3.1.46
# via pygount
identify==2.6.12
hatchling==1.28.0
identify==2.6.16
# via pre-commit
idna==3.10
idna==3.11
# via requests
importlib-metadata==8.7.0 ; python_full_version < '3.10'
# via
# markdown
# mkdocs
# mkdocs-get-deps
iniconfig==2.1.0
iniconfig==2.3.0
# via pytest
jinja2==3.1.6
# via
# mkdocs
# mkdocs-material
markdown==3.8
markdown==3.10.2
# via
# mkdocs
# mkdocs-material
# pymdown-extensions
markdown-it-py==3.0.0
markdown-it-py==4.0.0
# via rich
markupsafe==3.0.2
markupsafe==3.0.3
# via
# jinja2
# mkdocs
Expand All @@ -82,40 +74,47 @@ mkdocs==1.6.1
# via mkdocs-material
mkdocs-get-deps==0.2.0
# via mkdocs
mkdocs-material==9.6.14
mkdocs-material==9.7.1
mkdocs-material-extensions==1.3.1
# via mkdocs-material
nodeenv==1.9.1
nodeenv==1.10.0
# via pre-commit
packaging==25.0
packaging==26.0
# via
# hatchling
# mkdocs
# pytest
paginate==0.5.7
# via mkdocs-material
pathspec==0.12.1
# via mkdocs
platformdirs==4.3.8
pathspec==1.0.4
# via
# hatchling
# mkdocs
platformdirs==4.9.2
# via
# mkdocs-get-deps
# virtualenv
pluggy==1.6.0
# via pytest
pre-commit==4.2.0
# via
# hatchling
# pytest
# pytest-cov
pre-commit==4.5.1
pur==7.3.3
pygments==2.19.1
pygments==2.19.2
# via
# mkdocs-material
# pygount
# pytest
# rich
pymdown-extensions==10.15
pymdown-extensions==10.21
# via mkdocs-material
pytest==8.3.5
pytest==9.0.2
# via pytest-cov
pytest-cov==6.1.1
pytest-cov==7.0.0
python-dateutil==2.9.0.post0
# via ghp-import
pyyaml==6.0.2
pyyaml==6.0.3
# via
# mkdocs
# mkdocs-get-deps
Expand All @@ -124,30 +123,31 @@ pyyaml==6.0.2
# pyyaml-env-tag
pyyaml-env-tag==1.1
# via mkdocs
requests==2.32.3
requests==2.32.5
# via
# coveralls
# mkdocs-material
rich==14.0.0
rich==14.3.2
# via pygount
ruff==0.11.11
ruff==0.15.1
six==1.17.0
# via python-dateutil
smmap==5.0.2
# via gitdb
tomli==2.2.1 ; python_full_version <= '3.11'
tomli==2.4.0 ; python_full_version <= '3.11'
# via
# coverage
# hatchling
# pytest
typing-extensions==4.13.2 ; python_full_version < '3.11'
trove-classifiers==2026.1.14.14
# via hatchling
typing-extensions==4.15.0 ; python_full_version < '3.11'
# via
# exceptiongroup
# rich
urllib3==2.4.0
# virtualenv
urllib3==2.6.3
# via requests
virtualenv==20.31.2
virtualenv==20.37.0
# via pre-commit
watchdog==6.0.0
# via mkdocs
zipp==3.21.0 ; python_full_version < '3.10'
# via importlib-metadata
4 changes: 2 additions & 2 deletions pygount/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def from_state(
assert group is not None
assert state != SourceState.analyzed, "use from() for analyzable sources"
SourceAnalysis._check_state_info(state, state_info)
reduced_path = source_path.split(tmp_dir)[-1].lstrip(os.sep) if tmp_dir else source_path
reduced_path = source_path.rsplit(tmp_dir, maxsplit=1)[-1].lstrip(os.sep) if tmp_dir else source_path
return SourceAnalysis(
path=reduced_path,
language=f"__{state.name}__",
Expand Down Expand Up @@ -442,7 +442,7 @@ def from_file(
if mark_to_check in line_parts:
mark_to_increment = mark_to_check
mark_to_count_map[mark_to_increment] += 1
reduced_path = source_path.split(tmp_dir)[-1].lstrip(os.sep) if tmp_dir else source_path
reduced_path = source_path.rsplit(tmp_dir, maxsplit=1)[-1].lstrip(os.sep) if tmp_dir else source_path
result = SourceAnalysis(
path=reduced_path,
language=language,
Expand Down
5 changes: 4 additions & 1 deletion pygount/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def source_count(self) -> int:

@property
def source_percentage(self) -> float:
"""percentage of source lines for code for this language across entire project"""
"""percentage of source lines for code for this language across the entire project"""
return _percentage_or_0(self.source_count, self.line_count)

@property
Expand All @@ -114,6 +114,9 @@ def sort_key(self) -> Hashable:
"""sort key to sort multiple languages by importance"""
return self.code_count, self.documentation_count, self.string_count, self.empty_count, self.language

def __hash__(self):
return hash(self.language)

def __eq__(self, other):
return self.sort_key() == other.sort_key()

Expand Down
17 changes: 7 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[project]
name = "pygount"
version = "3.1.0"
version = "3.1.1"
description = "count source lines of code (SLOC) using pygments"
authors = [{ name = "Thomas Aglassinger", email = "roskakori@users.sourceforge.net" }]
requires-python = ">=3.9, <4"
requires-python = ">=3.10, <4"
readme = "README.md"
license = "BSD-3-Clause"
keywords = [
Expand All @@ -19,18 +19,18 @@ classifiers = [
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Software Development",
]
dependencies = [
"chardet>=5,<6",
"gitpython~=3.1",
"pygments>=2,<3",
"rich>=9",
"rich>=14",
]

[project.urls]
Expand Down Expand Up @@ -59,11 +59,11 @@ dev = [
"hatchling>=1.27.0",
"mkdocs>=1,<2",
"mkdocs-material>=9,<10",
"pytest>=8,<9",
"pytest-cov>=6,<7",
"pytest>=9.0.2,<10",
"pytest-cov>=7,<8",
"pre-commit>=4,<5",
"pur>=7,<8",
"ruff~=0.11.11",
"ruff~=0.15.1",
]

[tool.uv]
Expand Down Expand Up @@ -195,6 +195,3 @@ select = [

[tool.ruff.lint.isort]
known-first-party = ["pygount", "scripts", "tests"]

[tool.ruff.lint.per-file-ignores]
"docs/conf.py" = ["INP001"]
Loading
Loading