code2logic 1.0.43__tar.gz → 1.0.44__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.
- {code2logic-1.0.43 → code2logic-1.0.44}/PKG-INFO +50 -37
- {code2logic-1.0.43 → code2logic-1.0.44}/README.md +49 -36
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/__init__.py +1 -1
- {code2logic-1.0.43 → code2logic-1.0.44}/pyproject.toml +1 -1
- {code2logic-1.0.43 → code2logic-1.0.44}/LICENSE +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/__main__.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/adaptive.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/analyzer.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/base.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/base_generator.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/benchmark.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/benchmarks/__init__.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/benchmarks/common.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/benchmarks/results.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/benchmarks/runner.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/chunked_reproduction.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/cli.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/code_review.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/config.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/core/__init__.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/dependency.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/errors.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/file_formats.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/formats/__init__.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/function_logic.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/generators.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/gherkin.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/integrations/__init__.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/intent.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/llm/__init__.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/llm.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/llm_clients.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/llm_profiler.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/logicml.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/markdown_format.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/mcp_server.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/metrics.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/models.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/parsers.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/project_comparison.md +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/project_reproducer.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/prompts.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/py.typed +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/quality.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/refactor.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/reproducer.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/reproduction.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/schemas/__init__.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/schemas/json_schema.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/schemas/logicml_schema.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/schemas/markdown_schema.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/schemas/yaml_schema.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/shared_utils.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/similarity.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/terminal.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/tools/__init__.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/toon_format.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/universal.py +0 -0
- {code2logic-1.0.43 → code2logic-1.0.44}/code2logic/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: code2logic
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.44
|
|
4
4
|
Summary: Code2Logic - Source code to logical representation converter for LLM analysis, featuring Tree-sitter parsing, dependency graph analysis, and multi-language support.
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
@@ -94,10 +94,18 @@ pip install code2logic[nlp] # Enhanced intents
|
|
|
94
94
|
|
|
95
95
|
## 📖 Quick Start
|
|
96
96
|
```bash
|
|
97
|
-
|
|
98
|
-
code2logic ./ -f toon --
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
# TOON compact (best token efficiency — 5.9x smaller than JSON)
|
|
98
|
+
code2logic ./ -f toon --compact --name project -o ./
|
|
99
|
+
|
|
100
|
+
# TOON with function-logic + structural context
|
|
101
|
+
code2logic ./ -f toon --compact --no-repeat-module \
|
|
102
|
+
--function-logic function.toon --function-logic-context minimal --name project -o ./
|
|
103
|
+
|
|
104
|
+
# TOON-Hybrid (project structure + function details for hub modules)
|
|
105
|
+
code2logic ./ -f toon --hybrid --no-repeat-module --name project -o ./
|
|
106
|
+
|
|
107
|
+
# YAML compact (human-readable, good compromise)
|
|
108
|
+
code2logic ./ -f yaml --compact --name project -o ./
|
|
101
109
|
```
|
|
102
110
|
|
|
103
111
|
### Command Line
|
|
@@ -312,14 +320,20 @@ Similar Functions:
|
|
|
312
320
|
|
|
313
321
|
```text
|
|
314
322
|
code2logic/
|
|
315
|
-
├── analyzer.py
|
|
316
|
-
├── parsers.py
|
|
317
|
-
├── dependency.py
|
|
318
|
-
├── similarity.py
|
|
319
|
-
├── intent.py
|
|
320
|
-
├── generators.py
|
|
321
|
-
├──
|
|
322
|
-
|
|
323
|
+
├── analyzer.py # Main orchestrator
|
|
324
|
+
├── parsers.py # Tree-sitter + fallback parser
|
|
325
|
+
├── dependency.py # NetworkX dependency analysis
|
|
326
|
+
├── similarity.py # Rapidfuzz similar detection
|
|
327
|
+
├── intent.py # NLP intent generation
|
|
328
|
+
├── generators.py # Output generators (MD/Compact/JSON/YAML/CSV)
|
|
329
|
+
├── toon_format.py # TOON generator (compact, hybrid)
|
|
330
|
+
├── logicml.py # LogicML generator (typed signatures)
|
|
331
|
+
├── function_logic.py # Function-logic TOON with structural context
|
|
332
|
+
├── metrics.py # AST-based quality metrics
|
|
333
|
+
├── models.py # Data structures
|
|
334
|
+
├── cli.py # Command-line interface
|
|
335
|
+
├── benchmarks/ # Benchmark runner, results, common utils
|
|
336
|
+
└── llm_clients.py # Unified LLM client (OpenRouter/Ollama/LiteLLM)
|
|
323
337
|
```
|
|
324
338
|
|
|
325
339
|
## 🔌 Integration Examples
|
|
@@ -415,40 +429,39 @@ Compact format is ~10-15x smaller than Markdown.
|
|
|
415
429
|
|
|
416
430
|
## 🔬 Code Reproduction Benchmarks
|
|
417
431
|
|
|
418
|
-
|
|
432
|
+
Benchmark results (20 files, model: `arcee-ai/trinity-large-preview`, 2026-02-25):
|
|
419
433
|
|
|
420
|
-
### Format Comparison
|
|
434
|
+
### Project Benchmark — Format Comparison
|
|
421
435
|
|
|
422
|
-
| Format | Score |
|
|
423
|
-
|
|
424
|
-
| **
|
|
425
|
-
|
|
|
426
|
-
|
|
|
427
|
-
|
|
|
436
|
+
| Format | Score | Syntax OK | Runs OK | ~Tokens | Efficiency (p/kT) |
|
|
437
|
+
|--------|------:|----------:|--------:|--------:|---------:|
|
|
438
|
+
| **toon** | **63,8%** | 100% | 60% | 17 875 | **3,57** |
|
|
439
|
+
| json | 62,9% | 100% | 60% | 104 914 | 0,60 |
|
|
440
|
+
| markdown | 62,5% | 100% | 55% | 36 851 | 1,70 |
|
|
441
|
+
| yaml | 62,4% | 100% | 55% | 68 651 | 0,91 |
|
|
442
|
+
| logicml | 60,4% | 100% | 55% | ~30 000 | ~2,01 |
|
|
443
|
+
| csv | 53,0% | 100% | 40% | 80 779 | 0,66 |
|
|
444
|
+
| function.toon | 49,3% | 95% | 35% | 29 271 | 1,68 |
|
|
445
|
+
| gherkin | 38,6% | 95% | 30% | ~25 000 | ~1,54 |
|
|
446
|
+
|
|
447
|
+
**Behavioral benchmark:** 85,7% (6/7 functions passed).
|
|
428
448
|
|
|
429
449
|
### Key Findings
|
|
430
450
|
|
|
431
|
-
- **
|
|
432
|
-
- **
|
|
433
|
-
- **
|
|
434
|
-
- **
|
|
451
|
+
- **TOON wins on efficiency** — best score (63,8%) at 5,9x fewer tokens than JSON
|
|
452
|
+
- **Syntax OK = 100%** for all major formats — LLM always generates valid syntax
|
|
453
|
+
- **function.toon paradox** — worse than project.toon despite larger file, due to missing class/module context (fixed in v1.0.43 with `--function-logic-context`)
|
|
454
|
+
- **gherkin/csv** — poor fit for code description, their structure doesn't map to programming constructs
|
|
435
455
|
|
|
436
456
|
### Run Benchmarks
|
|
437
457
|
|
|
438
458
|
```bash
|
|
439
|
-
#
|
|
440
|
-
python examples/11_token_benchmark.py --folder tests/samples/ --no-llm
|
|
441
|
-
|
|
442
|
-
# Async multi-format benchmark
|
|
443
|
-
python examples/09_async_benchmark.py --folder tests/samples/ --no-llm
|
|
444
|
-
|
|
445
|
-
# Function-level reproduction
|
|
446
|
-
python examples/10_function_reproduction.py --file tests/samples/sample_functions.py --no-llm
|
|
447
|
-
|
|
448
|
-
python examples/15_unified_benchmark.py --folder tests/samples/ --no-llm
|
|
459
|
+
make benchmark # Full benchmark suite (requires OPENROUTER_API_KEY)
|
|
449
460
|
|
|
450
|
-
#
|
|
451
|
-
python examples/
|
|
461
|
+
# Or individually:
|
|
462
|
+
python examples/15_unified_benchmark.py --type format --folder tests/samples/ --limit 20
|
|
463
|
+
python examples/15_unified_benchmark.py --type project --folder tests/samples/ --limit 20
|
|
464
|
+
python examples/15_unified_benchmark.py --type function --file tests/samples/sample_functions.py
|
|
452
465
|
```
|
|
453
466
|
|
|
454
467
|
## 🤝 Contributing
|
|
@@ -48,10 +48,18 @@ pip install code2logic[nlp] # Enhanced intents
|
|
|
48
48
|
|
|
49
49
|
## 📖 Quick Start
|
|
50
50
|
```bash
|
|
51
|
-
|
|
52
|
-
code2logic ./ -f toon --
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
# TOON compact (best token efficiency — 5.9x smaller than JSON)
|
|
52
|
+
code2logic ./ -f toon --compact --name project -o ./
|
|
53
|
+
|
|
54
|
+
# TOON with function-logic + structural context
|
|
55
|
+
code2logic ./ -f toon --compact --no-repeat-module \
|
|
56
|
+
--function-logic function.toon --function-logic-context minimal --name project -o ./
|
|
57
|
+
|
|
58
|
+
# TOON-Hybrid (project structure + function details for hub modules)
|
|
59
|
+
code2logic ./ -f toon --hybrid --no-repeat-module --name project -o ./
|
|
60
|
+
|
|
61
|
+
# YAML compact (human-readable, good compromise)
|
|
62
|
+
code2logic ./ -f yaml --compact --name project -o ./
|
|
55
63
|
```
|
|
56
64
|
|
|
57
65
|
### Command Line
|
|
@@ -266,14 +274,20 @@ Similar Functions:
|
|
|
266
274
|
|
|
267
275
|
```text
|
|
268
276
|
code2logic/
|
|
269
|
-
├── analyzer.py
|
|
270
|
-
├── parsers.py
|
|
271
|
-
├── dependency.py
|
|
272
|
-
├── similarity.py
|
|
273
|
-
├── intent.py
|
|
274
|
-
├── generators.py
|
|
275
|
-
├──
|
|
276
|
-
|
|
277
|
+
├── analyzer.py # Main orchestrator
|
|
278
|
+
├── parsers.py # Tree-sitter + fallback parser
|
|
279
|
+
├── dependency.py # NetworkX dependency analysis
|
|
280
|
+
├── similarity.py # Rapidfuzz similar detection
|
|
281
|
+
├── intent.py # NLP intent generation
|
|
282
|
+
├── generators.py # Output generators (MD/Compact/JSON/YAML/CSV)
|
|
283
|
+
├── toon_format.py # TOON generator (compact, hybrid)
|
|
284
|
+
├── logicml.py # LogicML generator (typed signatures)
|
|
285
|
+
├── function_logic.py # Function-logic TOON with structural context
|
|
286
|
+
├── metrics.py # AST-based quality metrics
|
|
287
|
+
├── models.py # Data structures
|
|
288
|
+
├── cli.py # Command-line interface
|
|
289
|
+
├── benchmarks/ # Benchmark runner, results, common utils
|
|
290
|
+
└── llm_clients.py # Unified LLM client (OpenRouter/Ollama/LiteLLM)
|
|
277
291
|
```
|
|
278
292
|
|
|
279
293
|
## 🔌 Integration Examples
|
|
@@ -369,40 +383,39 @@ Compact format is ~10-15x smaller than Markdown.
|
|
|
369
383
|
|
|
370
384
|
## 🔬 Code Reproduction Benchmarks
|
|
371
385
|
|
|
372
|
-
|
|
386
|
+
Benchmark results (20 files, model: `arcee-ai/trinity-large-preview`, 2026-02-25):
|
|
373
387
|
|
|
374
|
-
### Format Comparison
|
|
388
|
+
### Project Benchmark — Format Comparison
|
|
375
389
|
|
|
376
|
-
| Format | Score |
|
|
377
|
-
|
|
378
|
-
| **
|
|
379
|
-
|
|
|
380
|
-
|
|
|
381
|
-
|
|
|
390
|
+
| Format | Score | Syntax OK | Runs OK | ~Tokens | Efficiency (p/kT) |
|
|
391
|
+
|--------|------:|----------:|--------:|--------:|---------:|
|
|
392
|
+
| **toon** | **63,8%** | 100% | 60% | 17 875 | **3,57** |
|
|
393
|
+
| json | 62,9% | 100% | 60% | 104 914 | 0,60 |
|
|
394
|
+
| markdown | 62,5% | 100% | 55% | 36 851 | 1,70 |
|
|
395
|
+
| yaml | 62,4% | 100% | 55% | 68 651 | 0,91 |
|
|
396
|
+
| logicml | 60,4% | 100% | 55% | ~30 000 | ~2,01 |
|
|
397
|
+
| csv | 53,0% | 100% | 40% | 80 779 | 0,66 |
|
|
398
|
+
| function.toon | 49,3% | 95% | 35% | 29 271 | 1,68 |
|
|
399
|
+
| gherkin | 38,6% | 95% | 30% | ~25 000 | ~1,54 |
|
|
400
|
+
|
|
401
|
+
**Behavioral benchmark:** 85,7% (6/7 functions passed).
|
|
382
402
|
|
|
383
403
|
### Key Findings
|
|
384
404
|
|
|
385
|
-
- **
|
|
386
|
-
- **
|
|
387
|
-
- **
|
|
388
|
-
- **
|
|
405
|
+
- **TOON wins on efficiency** — best score (63,8%) at 5,9x fewer tokens than JSON
|
|
406
|
+
- **Syntax OK = 100%** for all major formats — LLM always generates valid syntax
|
|
407
|
+
- **function.toon paradox** — worse than project.toon despite larger file, due to missing class/module context (fixed in v1.0.43 with `--function-logic-context`)
|
|
408
|
+
- **gherkin/csv** — poor fit for code description, their structure doesn't map to programming constructs
|
|
389
409
|
|
|
390
410
|
### Run Benchmarks
|
|
391
411
|
|
|
392
412
|
```bash
|
|
393
|
-
#
|
|
394
|
-
python examples/11_token_benchmark.py --folder tests/samples/ --no-llm
|
|
395
|
-
|
|
396
|
-
# Async multi-format benchmark
|
|
397
|
-
python examples/09_async_benchmark.py --folder tests/samples/ --no-llm
|
|
398
|
-
|
|
399
|
-
# Function-level reproduction
|
|
400
|
-
python examples/10_function_reproduction.py --file tests/samples/sample_functions.py --no-llm
|
|
401
|
-
|
|
402
|
-
python examples/15_unified_benchmark.py --folder tests/samples/ --no-llm
|
|
413
|
+
make benchmark # Full benchmark suite (requires OPENROUTER_API_KEY)
|
|
403
414
|
|
|
404
|
-
#
|
|
405
|
-
python examples/
|
|
415
|
+
# Or individually:
|
|
416
|
+
python examples/15_unified_benchmark.py --type format --folder tests/samples/ --limit 20
|
|
417
|
+
python examples/15_unified_benchmark.py --type project --folder tests/samples/ --limit 20
|
|
418
|
+
python examples/15_unified_benchmark.py --type function --file tests/samples/sample_functions.py
|
|
406
419
|
```
|
|
407
420
|
|
|
408
421
|
## 🤝 Contributing
|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "code2logic"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.44"
|
|
8
8
|
description = "Code2Logic - Source code to logical representation converter for LLM analysis, featuring Tree-sitter parsing, dependency graph analysis, and multi-language support."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "Apache-2.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|