Skip to main content

reko

AI Cost Tracking

AI Cost AI Model

This project uses AI-generated code. Total cost: $2.5346 with 4 AI commits.

Generated on 2026-06-29 using openrouter/qwen/qwen3-coder-next


Narzędzie do wykrywania i refaktoryzacji hardkodowanych wartości, struktur danych i kodu w projektach Python.

Co robi

  • scan — wykrywa magic numbers, długie stringi, osadzone słowniki/listy, powtarzające się literały
  • extract — wyciąga hardkod do modułu stałych (constants.py lub wskazany plik)
  • split — rozbija duże struktury (dict/list) na mniejsze nazwane fragmenty
  • move — przenosi stałe między modułami i aktualizuje importy
  • remove — usuwa nieużywane stałe modułowe
  • apply — stosuje plan refaktoryzacji (YAML/JSON)

Instalacja

cd ~/github/semcod/reko
pip install -e ".[apply,dev]"

Użycie

# skan projektu
reko scan .

# skan z raportem JSON
reko scan src/ --format json -o report.json

# wyciągnij hardkod do constants.py (dry-run)
reko extract src/ --target src/myapp/constants.py --dry-run

# rozbij dużą strukturę w pliku
reko split src/config.py --min-keys 5

# przenieś stałe
reko move src/old.py src/new_constants.py --names TIMEOUT,API_URL

# usuń nieużywane stałe
reko remove src/constants.py --dry-run

# zastosuj plan
reko apply plan.yaml

Konfiguracja

Plik reko.yaml w katalogu projektu:

scan:
  extensions: [".py"]
  exclude:
    - "**/tests/**"
    - "**/__pycache__/**"
  min_string_length: 8
  min_dict_keys: 4
  allowed_numbers: [0, 1, -1, 2, 10, 100, 1000]

extract:
  target: "constants.py"
  naming: "upper_snake"
  group_by: "file"  # file | kind | none

API

from pathlib import Path
from reko import scan_project, extract_constants, apply_plan

findings = scan_project(Path("src/"))
result = extract_constants(Path("src/app.py"), target=Path("src/constants.py"))

Licencja

Apache-2.0

Metadata

Release files for reku 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reku 0.1.4
File Size Uploaded
reku-0.1.4.tar.gz 23.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for reku 0.1.4
File Interpreter ABI Platform
reku-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 49.6 kB

Release files / reku-0.1.4.tar.gz

Download URL reku-0.1.4.tar.gz
Size 23.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6a23718d397c731c72a8abdd7a5e0d26ccc055f28f33e4eedbfcf9e9e63f60cb
BLAKE2b-256 checksum
How to use checksums
b6ea101c6014dd0ba18a9ba0c01951d3ccab0b4131e3782a64b7ecfdfcc81ce0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / reku-0.1.4-py3-none-any.whl

Download URL reku-0.1.4-py3-none-any.whl
Size 26.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04defd06c5b2f0e6652c1ac1d78173b6c3f510462f4ecfe25ebb21fa0bbddc7f
BLAKE2b-256 checksum
How to use checksums
399e32de40c069865a1e37f60ae7374123503815025c79adfc545bbd8e3bb8f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page