reku 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
reku-0.1.4/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work.
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Tom Sapletta
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
reku-0.1.4/PKG-INFO ADDED
@@ -0,0 +1,129 @@
1
+ Metadata-Version: 2.4
2
+ Name: reku
3
+ Version: 0.1.4
4
+ Summary: Refaktoryzacja hardkodowanych wartości, struktur i kodu w projektach Python
5
+ Author-email: Tom Sapletta <tom@sapletta.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/semcod/reko
8
+ Project-URL: Repository, https://github.com/semcod/reko
9
+ Project-URL: Issues, https://github.com/semcod/reko/issues
10
+ Keywords: refactoring,hardcoded,magic-numbers,constants,static-analysis,code-quality,python
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Software Development :: Quality Assurance
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: typer>=0.12.0
25
+ Requires-Dist: rich>=13.0
26
+ Requires-Dist: pydantic>=2.0
27
+ Requires-Dist: pyyaml>=6.0
28
+ Requires-Dist: tomli>=2.0; python_version < "3.11"
29
+ Provides-Extra: apply
30
+ Requires-Dist: libcst>=1.0; extra == "apply"
31
+ Provides-Extra: dev
32
+ Requires-Dist: reku[apply]; extra == "dev"
33
+ Requires-Dist: pytest>=7.0; extra == "dev"
34
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
35
+ Requires-Dist: ruff>=0.4; extra == "dev"
36
+ Requires-Dist: goal>=2.1.0; extra == "dev"
37
+ Requires-Dist: costs>=0.1.20; extra == "dev"
38
+ Requires-Dist: pfix>=0.1.60; extra == "dev"
39
+ Dynamic: license-file
40
+
41
+ # reko
42
+
43
+
44
+ ## AI Cost Tracking
45
+
46
+ ![AI Cost](https://img.shields.io/badge/AI%20Cost-$2.53-green) ![AI Model](https://img.shields.io/badge/AI%20Model-openrouter%2Fqwen%2Fqwen3-coder-next-lightgrey)
47
+
48
+ This project uses AI-generated code. Total cost: **$2.5346** with **4** AI commits.
49
+
50
+ Generated on 2026-06-29 using [openrouter/qwen/qwen3-coder-next](https://openrouter.ai/models/openrouter/qwen/qwen3-coder-next)
51
+
52
+ ---
53
+
54
+ Narzędzie do wykrywania i refaktoryzacji hardkodowanych wartości, struktur danych i kodu w projektach Python.
55
+
56
+ ## Co robi
57
+
58
+ - **scan** — wykrywa magic numbers, długie stringi, osadzone słowniki/listy, powtarzające się literały
59
+ - **extract** — wyciąga hardkod do modułu stałych (`constants.py` lub wskazany plik)
60
+ - **split** — rozbija duże struktury (dict/list) na mniejsze nazwane fragmenty
61
+ - **move** — przenosi stałe między modułami i aktualizuje importy
62
+ - **remove** — usuwa nieużywane stałe modułowe
63
+ - **apply** — stosuje plan refaktoryzacji (YAML/JSON)
64
+
65
+ ## Instalacja
66
+
67
+ ```bash
68
+ cd ~/github/semcod/reko
69
+ pip install -e ".[apply,dev]"
70
+ ```
71
+
72
+ ## Użycie
73
+
74
+ ```bash
75
+ # skan projektu
76
+ reko scan .
77
+
78
+ # skan z raportem JSON
79
+ reko scan src/ --format json -o report.json
80
+
81
+ # wyciągnij hardkod do constants.py (dry-run)
82
+ reko extract src/ --target src/myapp/constants.py --dry-run
83
+
84
+ # rozbij dużą strukturę w pliku
85
+ reko split src/config.py --min-keys 5
86
+
87
+ # przenieś stałe
88
+ reko move src/old.py src/new_constants.py --names TIMEOUT,API_URL
89
+
90
+ # usuń nieużywane stałe
91
+ reko remove src/constants.py --dry-run
92
+
93
+ # zastosuj plan
94
+ reko apply plan.yaml
95
+ ```
96
+
97
+ ## Konfiguracja
98
+
99
+ Plik `reko.yaml` w katalogu projektu:
100
+
101
+ ```yaml
102
+ scan:
103
+ extensions: [".py"]
104
+ exclude:
105
+ - "**/tests/**"
106
+ - "**/__pycache__/**"
107
+ min_string_length: 8
108
+ min_dict_keys: 4
109
+ allowed_numbers: [0, 1, -1, 2, 10, 100, 1000]
110
+
111
+ extract:
112
+ target: "constants.py"
113
+ naming: "upper_snake"
114
+ group_by: "file" # file | kind | none
115
+ ```
116
+
117
+ ## API
118
+
119
+ ```python
120
+ from pathlib import Path
121
+ from reko import scan_project, extract_constants, apply_plan
122
+
123
+ findings = scan_project(Path("src/"))
124
+ result = extract_constants(Path("src/app.py"), target=Path("src/constants.py"))
125
+ ```
126
+
127
+ ## Licencja
128
+
129
+ Apache-2.0
reku-0.1.4/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # reko
2
+
3
+
4
+ ## AI Cost Tracking
5
+
6
+ ![AI Cost](https://img.shields.io/badge/AI%20Cost-$2.53-green) ![AI Model](https://img.shields.io/badge/AI%20Model-openrouter%2Fqwen%2Fqwen3-coder-next-lightgrey)
7
+
8
+ This project uses AI-generated code. Total cost: **$2.5346** with **4** AI commits.
9
+
10
+ Generated on 2026-06-29 using [openrouter/qwen/qwen3-coder-next](https://openrouter.ai/models/openrouter/qwen/qwen3-coder-next)
11
+
12
+ ---
13
+
14
+ Narzędzie do wykrywania i refaktoryzacji hardkodowanych wartości, struktur danych i kodu w projektach Python.
15
+
16
+ ## Co robi
17
+
18
+ - **scan** — wykrywa magic numbers, długie stringi, osadzone słowniki/listy, powtarzające się literały
19
+ - **extract** — wyciąga hardkod do modułu stałych (`constants.py` lub wskazany plik)
20
+ - **split** — rozbija duże struktury (dict/list) na mniejsze nazwane fragmenty
21
+ - **move** — przenosi stałe między modułami i aktualizuje importy
22
+ - **remove** — usuwa nieużywane stałe modułowe
23
+ - **apply** — stosuje plan refaktoryzacji (YAML/JSON)
24
+
25
+ ## Instalacja
26
+
27
+ ```bash
28
+ cd ~/github/semcod/reko
29
+ pip install -e ".[apply,dev]"
30
+ ```
31
+
32
+ ## Użycie
33
+
34
+ ```bash
35
+ # skan projektu
36
+ reko scan .
37
+
38
+ # skan z raportem JSON
39
+ reko scan src/ --format json -o report.json
40
+
41
+ # wyciągnij hardkod do constants.py (dry-run)
42
+ reko extract src/ --target src/myapp/constants.py --dry-run
43
+
44
+ # rozbij dużą strukturę w pliku
45
+ reko split src/config.py --min-keys 5
46
+
47
+ # przenieś stałe
48
+ reko move src/old.py src/new_constants.py --names TIMEOUT,API_URL
49
+
50
+ # usuń nieużywane stałe
51
+ reko remove src/constants.py --dry-run
52
+
53
+ # zastosuj plan
54
+ reko apply plan.yaml
55
+ ```
56
+
57
+ ## Konfiguracja
58
+
59
+ Plik `reko.yaml` w katalogu projektu:
60
+
61
+ ```yaml
62
+ scan:
63
+ extensions: [".py"]
64
+ exclude:
65
+ - "**/tests/**"
66
+ - "**/__pycache__/**"
67
+ min_string_length: 8
68
+ min_dict_keys: 4
69
+ allowed_numbers: [0, 1, -1, 2, 10, 100, 1000]
70
+
71
+ extract:
72
+ target: "constants.py"
73
+ naming: "upper_snake"
74
+ group_by: "file" # file | kind | none
75
+ ```
76
+
77
+ ## API
78
+
79
+ ```python
80
+ from pathlib import Path
81
+ from reko import scan_project, extract_constants, apply_plan
82
+
83
+ findings = scan_project(Path("src/"))
84
+ result = extract_constants(Path("src/app.py"), target=Path("src/constants.py"))
85
+ ```
86
+
87
+ ## Licencja
88
+
89
+ Apache-2.0
@@ -0,0 +1,107 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "reku"
7
+ version = "0.1.4"
8
+ description = "Refaktoryzacja hardkodowanych wartości, struktur i kodu w projektach Python"
9
+ readme = "README.md"
10
+ license = "Apache-2.0"
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ { name = "Tom Sapletta", email = "tom@sapletta.com" },
14
+ ]
15
+ keywords = [
16
+ "refactoring",
17
+ "hardcoded",
18
+ "magic-numbers",
19
+ "constants",
20
+ "static-analysis",
21
+ "code-quality",
22
+ "python",
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 3 - Alpha",
26
+ "Intended Audience :: Developers",
27
+ "Programming Language :: Python :: 3",
28
+ "Programming Language :: Python :: 3.10",
29
+ "Programming Language :: Python :: 3.11",
30
+ "Programming Language :: Python :: 3.12",
31
+ "Programming Language :: Python :: 3.13",
32
+ "Topic :: Software Development :: Quality Assurance",
33
+ "Topic :: Software Development :: Libraries :: Python Modules",
34
+ "Typing :: Typed",
35
+ ]
36
+ dependencies = [
37
+ "typer>=0.12.0",
38
+ "rich>=13.0",
39
+ "pydantic>=2.0",
40
+ "pyyaml>=6.0",
41
+ "tomli>=2.0; python_version<'3.11'",
42
+ ]
43
+
44
+ [project.optional-dependencies]
45
+ apply = ["libcst>=1.0"]
46
+ dev = [
47
+ "reku[apply]",
48
+ "pytest>=7.0",
49
+ "pytest-cov>=4.0",
50
+ "ruff>=0.4",
51
+ "goal>=2.1.0",
52
+ "costs>=0.1.20",
53
+ "pfix>=0.1.60",
54
+ ]
55
+
56
+ [project.scripts]
57
+ reko = "reko.cli.main:app"
58
+
59
+ [project.urls]
60
+ Homepage = "https://github.com/semcod/reko"
61
+ Repository = "https://github.com/semcod/reko"
62
+ Issues = "https://github.com/semcod/reko/issues"
63
+
64
+ [tool.setuptools.packages.find]
65
+ where = ["src"]
66
+
67
+ [tool.ruff]
68
+ target-version = "py310"
69
+ line-length = 100
70
+
71
+ [tool.ruff.lint]
72
+ select = ["E", "F", "W", "I", "UP", "B", "SIM"]
73
+ ignore = ["B008"]
74
+
75
+ [tool.pytest.ini_options]
76
+ testpaths = ["tests"]
77
+ pythonpath = ["src"]
78
+ addopts = "-v --tb=short"
79
+
80
+ [tool.pfix]
81
+ # Self-healing Python configuration
82
+ model = "openrouter/qwen/qwen3-coder-next"
83
+ auto_apply = true
84
+ auto_install_deps = true
85
+ auto_restart = false
86
+ max_retries = 3
87
+ create_backups = false
88
+ git_auto_commit = false
89
+
90
+ [tool.pfix.runtime_todo]
91
+ enabled = true
92
+ todo_file = "TODO.md"
93
+ min_severity = "low"
94
+ deduplicate = true
95
+
96
+ [tool.costs]
97
+ # AI Cost tracking configuration
98
+ badge = true
99
+ update_readme = true
100
+ readme_path = "README.md"
101
+ default_model = "openrouter/qwen/qwen3-coder-next"
102
+ analysis_mode = "byok"
103
+ full_history = true
104
+ max_commits = 500
105
+
106
+ # Cost thresholds for badge colors (USD)
107
+ badge_color_thresholds = { low = 1.0, medium = 5.0, high = 10.0, critical = 50.0 }
reku-0.1.4/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,36 @@
1
+ """reko — refaktoryzacja hardkodowanych wartości w kodzie Python."""
2
+ __version__ = "0.1.4"
3
+
4
+ from reko.config import RekoConfig, load_config
5
+ from reko.models import (
6
+ Finding,
7
+ FindingKind,
8
+ RefactorAction,
9
+ RefactorPlan,
10
+ RefactorResult,
11
+ ScanReport,
12
+ )
13
+ from reko.refactor.engine import apply_plan
14
+ from reko.refactor.extract import extract_constants
15
+ from reko.refactor.move import move_constants
16
+ from reko.refactor.remove import remove_unused_constants
17
+ from reko.refactor.split import split_structures
18
+ from reko.scanner.detector import scan_file, scan_project
19
+
20
+ __all__ = [
21
+ "Finding",
22
+ "FindingKind",
23
+ "RefactorAction",
24
+ "RefactorPlan",
25
+ "RefactorResult",
26
+ "RekoConfig",
27
+ "ScanReport",
28
+ "apply_plan",
29
+ "extract_constants",
30
+ "load_config",
31
+ "move_constants",
32
+ "remove_unused_constants",
33
+ "scan_file",
34
+ "scan_project",
35
+ "split_structures",
36
+ ]
@@ -0,0 +1,6 @@
1
+ """Entry point: python -m reko."""
2
+
3
+ from reko.cli.main import app
4
+
5
+ if __name__ == "__main__":
6
+ app()
@@ -0,0 +1 @@
1
+ """CLI package."""