Skip to content

Commit 069272a

Browse files
Junyi-99claude
andcommitted
chore: migrate to uv for dependency management
- Replace `requirements.txt` with `pyproject.toml` + `uv.lock` (runtime deps in `[project]`, lint/format tools in `[dependency-groups].dev`). - Pin Python via `.python-version` (3.14) so uv provisions the right interpreter automatically. - Turn the root `main.py` stub from `uv init` into a thin launcher that delegates to `src/main.py`, so `uv run main.py` just works without restructuring the flat imports inside `src/`. - Update README Prerequisites / Installation / Usage to uv workflow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f314570 commit 069272a

6 files changed

Lines changed: 642 additions & 17 deletions

File tree

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.14

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ This project has been tested and works perfectly on macOS, Windows and WSL2 (see
3535
Ensure you have the following installed on your system:
3636

3737
- Google Chrome
38-
- Python3
38+
- [uv](https://docs.astral.sh/uv/) (Python package manager; handles Python install automatically)
3939

4040
## Installation
4141

@@ -47,18 +47,24 @@ Ensure you have the following installed on your system:
4747
cd ChatGPT-API-Scanner
4848
```
4949

50-
2. Install required pypi packages
50+
2. Install dependencies (uv reads `pyproject.toml` / `uv.lock` and provisions the matching Python version from `.python-version`):
5151

5252
```bash
53-
pip install selenium tqdm openai rich
53+
uv sync
54+
```
55+
56+
To include dev tools (pylint, flake8, ruff):
57+
58+
```bash
59+
uv sync --all-groups
5460
```
5561

5662
## Usage
5763

5864
1. Run the main script:
5965

6066
```bash
61-
python3 src/main.py
67+
uv run main.py
6268
```
6369

6470
2. You will be prompted to log in to your GitHub account in the browser. Please do so.
@@ -81,13 +87,13 @@ Examples:
8187
8288
```bash
8389
# Start scanning from iteration 100
84-
python3 src/main.py --from-iter 100
90+
uv run main.py --from-iter 100
8591
8692
# Only check existing keys
87-
python3 src/main.py --check-existed-keys-only
93+
uv run main.py --check-existed-keys-only
8894
8995
# Use custom keywords and languages
90-
python3 src/main.py -k "openai" "chatgpt" -l python javascript
96+
uv run main.py -k "openai" "chatgpt" -l python javascript
9197
```
9298
9399
## Results

main.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import runpy
2+
import sys
3+
from pathlib import Path
4+
5+
SRC = Path(__file__).parent / "src"
6+
sys.path.insert(0, str(SRC))
7+
runpy.run_path(str(SRC / "main.py"), run_name="__main__")

pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[project]
2+
name = "chatgpt-api-scanner"
3+
version = "0.1.0"
4+
description = "Scan GitHub for leaked OpenAI API keys (for security research)"
5+
readme = "README.md"
6+
requires-python = ">=3.14"
7+
dependencies = [
8+
"openai>=2.32.0",
9+
"rich>=15.0.0",
10+
"selenium>=4.43.0",
11+
"tqdm>=4.67.3",
12+
]
13+
14+
[dependency-groups]
15+
dev = [
16+
"pylint>=3.0.0",
17+
"flake8>=7.0.0",
18+
"ruff>=0.2.0",
19+
]

requirements.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)