Skip to content

Commit 2e7a220

Browse files
committed
use warning instead of print when logging tiktoken errors, fix changelog.md markdownlint errors
1 parent 2882cc0 commit 2e7a220

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
## [0.2.0](https://github.com/coderamp-labs/gitingest/compare/v0.1.5...v0.2.0) (2025-07-26)
44

5-
65
### ⚠ BREAKING CHANGES
76

8-
*
9-
*
7+
*
8+
*
109

1110
### Features
1211

@@ -20,7 +19,6 @@
2019
* Refactor backend to a rest api ([#346](https://github.com/coderamp-labs/gitingest/issues/346)) ([2b1f228](https://github.com/coderamp-labs/gitingest/commit/2b1f228ae1f6d1f7ee471794d258b13fcac25a96))
2120
* **ui:** add inline PAT info tooltip inside token field ([#348](https://github.com/coderamp-labs/gitingest/issues/348)) ([2592303](https://github.com/coderamp-labs/gitingest/commit/25923037ea6cd2f8ef33a6cf1f0406c2b4f0c9b6))
2221

23-
2422
### Bug Fixes
2523

2624
* enable metrics if env var is defined instead of being "True" ([#407](https://github.com/coderamp-labs/gitingest/issues/407)) ([fa2e192](https://github.com/coderamp-labs/gitingest/commit/fa2e192c05864c8db90bda877e9efb9b03caf098))
@@ -33,14 +31,12 @@
3331
* **ui:** update layout in PAT section to avoid overlaps & overflows ([#331](https://github.com/coderamp-labs/gitingest/issues/331)) ([b39ef54](https://github.com/coderamp-labs/gitingest/commit/b39ef5416c1f8a7993a8249161d2a898b7387595))
3432
* **windows:** warn if Git long path support is disabled, do not fail ([b8e375f](https://github.com/coderamp-labs/gitingest/commit/b8e375f71cae7d980cf431396c4414a6dbd0588c))
3533

36-
3734
### Documentation
3835

3936
* add GitHub Issue Form for bug reports ([#403](https://github.com/coderamp-labs/gitingest/issues/403)) ([4546449](https://github.com/coderamp-labs/gitingest/commit/4546449bbc1e4a7ad0950c4b831b8855a98628fd))
4037
* add GitHub Issue Form for feature requests ([#404](https://github.com/coderamp-labs/gitingest/issues/404)) ([9b1fc58](https://github.com/coderamp-labs/gitingest/commit/9b1fc58900ae18a3416fe3cf9b5e301a65a8e9fd))
4138
* Fix CLI help text accuracy ([#332](https://github.com/coderamp-labs/gitingest/issues/332)) ([fdcbc53](https://github.com/coderamp-labs/gitingest/commit/fdcbc53cadde6a5dc3c3626120df1935b63693b2))
4239

43-
4440
### Code Refactoring
4541

4642
* centralize PAT validation, streamline repo checks & misc cleanup ([#349](https://github.com/coderamp-labs/gitingest/issues/349)) ([cea0edd](https://github.com/coderamp-labs/gitingest/commit/cea0eddce8c6846bc6271cb3a8d15320e103214c))

src/gitingest/output_formatter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import ssl
6+
import warnings
67
from typing import TYPE_CHECKING
78

89
import requests.exceptions
@@ -192,11 +193,11 @@ def _format_token_count(text: str) -> str | None:
192193
encoding = tiktoken.get_encoding("o200k_base") # gpt-4o, gpt-4o-mini
193194
total_tokens = len(encoding.encode(text, disallowed_special=()))
194195
except (ValueError, UnicodeEncodeError) as exc:
195-
print(exc)
196+
warnings.warn(f"Failed to estimate token size: {exc}", RuntimeWarning, stacklevel=3)
196197
return None
197198
except (requests.exceptions.RequestException, ssl.SSLError) as exc:
198199
# If network errors, skip token count estimation instead of erroring out
199-
print(f"Failed to download tiktoken model: {exc}")
200+
warnings.warn(f"Failed to download tiktoken model: {exc}", RuntimeWarning, stacklevel=3)
200201
return None
201202

202203
for threshold, suffix in _TOKEN_THRESHOLDS:

0 commit comments

Comments
 (0)