duplicatecode 0.3.1__py3-none-win_amd64.whl → 0.4.0__py3-none-win_amd64.whl
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.
- {duplicatecode-0.3.1.data → duplicatecode-0.4.0.data}/scripts/duplicatecode.exe +0 -0
- {duplicatecode-0.3.1.dist-info → duplicatecode-0.4.0.dist-info}/METADATA +25 -8
- duplicatecode-0.4.0.dist-info/RECORD +5 -0
- {duplicatecode-0.3.1.dist-info → duplicatecode-0.4.0.dist-info}/sboms/duplicatecode.cyclonedx.json +15 -14
- duplicatecode-0.3.1.dist-info/RECORD +0 -5
- {duplicatecode-0.3.1.dist-info → duplicatecode-0.4.0.dist-info}/WHEEL +0 -0
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: duplicatecode
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Environment :: Console
|
|
6
6
|
Summary: Static (LLM-free) detection of duplicate/similar code in Python, TypeScript/JavaScript, SQL and C#
|
|
@@ -71,13 +71,28 @@ Two optional signals, both off by default (the detector stays static and offline
|
|
|
71
71
|
> **Privacy warning.** `--embed openai`, `--embed cohere`, and `--embed-code` / `--embeddings` pointed at any
|
|
72
72
|
> hosted endpoint (OpenAI, Cohere, Azure, ...) **upload the source text of your units** to that provider
|
|
73
73
|
> (`--embeddings` sends identifier names only). `find` embeds **every unit under the given paths**, so
|
|
74
|
-
> `find ... --embed openai` uploads all of it. The local presets (`minilm`, `qwen3`, `potion`) are meant for a
|
|
75
|
-
> server on loopback (
|
|
74
|
+
> `find ... --embed openai` uploads all of it. The local presets (`gemma`, `minilm`, `qwen3`, `potion`) are meant for a
|
|
75
|
+
> server on loopback (`gemma`: ollama on `127.0.0.1:11434`, the others `127.0.0.1:8099`; `DUPLICATECODE_EMBED_ENDPOINT` overrides it): pointing that
|
|
76
76
|
> variable at a remote host sends text there too. Do not use hosted embeddings on code you may not share.
|
|
77
77
|
|
|
78
78
|
- `--embeddings` embeds identifier *names* (cheap) as an extra name-similarity signal.
|
|
79
|
-
- `--embed
|
|
80
|
-
|
|
79
|
+
- `--embed` is the short form and implies `--embed-code`. A bare `--embed` uses **`gemma`** (embeddinggemma via a local
|
|
80
|
+
[ollama](https://ollama.com): `ollama pull embeddinggemma`), the best model in the codebase benchmark (issue #12: re-implementation
|
|
81
|
+
retrieval R@1 0.94 vs 0.89 for the static detector alone, unchanged when function names are masked). Other presets:
|
|
82
|
+
`--embed=minilm|qwen3|potion|openai|cohere`; MiniLM is smaller but clearly weaker (0.85) and leans on names. Model ids go into the cache key, so vectors of different models never mix.
|
|
83
|
+
**How much it helps, and what is not proven.** On the labeled holdout (`eval-groups`) the score goes from 0.76 to
|
|
84
|
+
0.91 with `--embed` (gemma): independently written solutions to the same task improve most (Python 0.66 to 0.95,
|
|
85
|
+
JavaScript 0.50 to 0.79, TypeScript functions 0.73 to 0.92); sets that were already easy (SQL, React) barely move.
|
|
86
|
+
Without `--embed` nothing changes. Not measured yet:
|
|
87
|
+
- the false-positive rate of a real `scan` on a real repository (the benchmark measures ranking, not how many wrong
|
|
88
|
+
pairs you see); the thresholds used with embeddings were tuned for MiniLM, so expect to adjust `--threshold`;
|
|
89
|
+
- the CodeNet holdout shares a few problems with the dev set (13 of 60 Python, 4 of 60 JavaScript), so those two
|
|
90
|
+
numbers are somewhat optimistic;
|
|
91
|
+
- the public-library part of the retrieval benchmark is probably inflated because the model that wrote the
|
|
92
|
+
re-implementations may have seen those libraries; the internal codebases are the cleaner signal.
|
|
93
|
+
It also needs ollama with the model pulled, and a GPU to be fast (about 5 ms per unit; much slower on CPU).
|
|
94
|
+
Details: issue #12.
|
|
95
|
+
|
|
81
96
|
- `--embed-code` embeds the *whole text of every unit* (function, class, file, SQL statement) and blends
|
|
82
97
|
the cosine into the score (`--embed-weight`, default 0.35, others scaled by 1 - weight). It finds
|
|
83
98
|
re-implementations that share no tokens. On function-level LLM re-implementations it lifted Python from
|
|
@@ -97,7 +112,8 @@ export OPENAI_BASE_URL=http://localhost:11434/v1 OPENAI_API_KEY=anything OPENAI_
|
|
|
97
112
|
export AZURE_AI_FOUNDRY_ENDPOINT=https://<res>.services.ai.azure.com
|
|
98
113
|
export AZURE_AI_FOUNDRY_API_KEY=... AZURE_AI_FOUNDRY_EMBEDDING_DEPLOYMENT=text-embedding-3-small
|
|
99
114
|
# Azure OpenAI: AZURE_OPENAI_ENDPOINT / AZURE_OPENAI_API_KEY / AZURE_OPENAI_EMBEDDING_DEPLOYMENT
|
|
100
|
-
# Fully local, no key:
|
|
115
|
+
# Fully local, no key, recommended: ollama pull embeddinggemma && duplicatecode scan . --embed (GPU: ~5 ms per unit)
|
|
116
|
+
# Other local models: start the server once (CPU; it loads whichever model a request names)
|
|
101
117
|
# uv run --no-project --python 3.12 eval/embed_server.py
|
|
102
118
|
# duplicatecode scan . --embed minilm # or: qwen3, potion (default endpoint 127.0.0.1:8099)
|
|
103
119
|
# Hosted presets: --embed openai (OPENAI_API_KEY), --embed cohere (COHERE_API_KEY)
|
|
@@ -127,7 +143,7 @@ Shared options: `--profile copies|reimpl`, `--threshold`, `--min-tokens`, `--min
|
|
|
127
143
|
`--embed-weight`, `--embed-max-chars`, `--embeddings`, `--embed-cache`, `--embed-dims`.
|
|
128
144
|
|
|
129
145
|
```sh
|
|
130
|
-
duplicatecode scan . --profile reimpl --
|
|
146
|
+
duplicatecode scan . --profile reimpl --embed minilm --pairs --explain
|
|
131
147
|
duplicatecode fragments src/ --min-stmts 4 --min-tokens 30 --cross-file --json
|
|
132
148
|
duplicatecode find "retry with exponential backoff" src/ --top 5 --json
|
|
133
149
|
duplicatecode diff --repo . < change.diff --embed openai
|
|
@@ -220,7 +236,8 @@ Self-scans of three internal repositories (Python + TypeScript), 189 pairs judge
|
|
|
220
236
|
judged sample gives ~50% true duplicates and ~76% incl. partial while keeping ~70% of the true ones.
|
|
221
237
|
These numbers are partly in-sample (weights and filters were chosen on the same pairs) — re-judge a fresh sample
|
|
222
238
|
before trusting them. A structure-heavy `--profile reimpl` exists for renamed re-implementations
|
|
223
|
-
(
|
|
239
|
+
(implies `--min-name 0` and `--min-lines 12`; on a 11k-unit repo the name gate off adds many small wrappers, so the
|
|
240
|
+
line floor matters) but has no judged real-repo precision data yet.
|
|
224
241
|
|
|
225
242
|
### Fresh held-out check (copies profile, threshold 0.6 = the `copies` default for `scan`)
|
|
226
243
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
duplicatecode-0.4.0.data/scripts/duplicatecode.exe,sha256=dcE4Zx4lEQQh3VYEM7-wQGkVHcMsqZ7vaSJc3iPa2cE,17586688
|
|
2
|
+
duplicatecode-0.4.0.dist-info/METADATA,sha256=bMbhlMhg-jM7gWFvFq_CW2ZGJqEJqxfAsYZ5CmUwqL0,22353
|
|
3
|
+
duplicatecode-0.4.0.dist-info/WHEEL,sha256=8Aej0W0a6Cz6apA3IzJrTnxLRVLAt-w0Oh8SA3Con_c,94
|
|
4
|
+
duplicatecode-0.4.0.dist-info/sboms/duplicatecode.cyclonedx.json,sha256=M1Ppro4VOyzoROrLuC7rA1TYGAKm2SpPczSI1OzryvI,126828
|
|
5
|
+
duplicatecode-0.4.0.dist-info/RECORD,,
|
{duplicatecode-0.3.1.dist-info → duplicatecode-0.4.0.dist-info}/sboms/duplicatecode.cyclonedx.json
RENAMED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"bomFormat": "CycloneDX",
|
|
3
3
|
"specVersion": "1.5",
|
|
4
4
|
"version": 1,
|
|
5
|
-
"serialNumber": "urn:uuid:
|
|
5
|
+
"serialNumber": "urn:uuid:bd315273-c92a-49b6-a190-2514407341c6",
|
|
6
6
|
"metadata": {
|
|
7
|
-
"timestamp": "2026-10-
|
|
7
|
+
"timestamp": "2026-10-27T15:21:21.586204300Z",
|
|
8
8
|
"tools": [
|
|
9
9
|
{
|
|
10
10
|
"vendor": "CycloneDX",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
],
|
|
15
15
|
"component": {
|
|
16
16
|
"type": "application",
|
|
17
|
-
"bom-ref": "path+file:///D:/a/duplicatecode/duplicatecode/crates/duplicatecode-cli#duplicatecode@0.
|
|
17
|
+
"bom-ref": "path+file:///D:/a/duplicatecode/duplicatecode/crates/duplicatecode-cli#duplicatecode@0.4.0",
|
|
18
18
|
"name": "duplicatecode",
|
|
19
|
-
"version": "0.
|
|
19
|
+
"version": "0.4.0",
|
|
20
20
|
"description": "CLI to detect duplicate/similar code in Python and TypeScript",
|
|
21
21
|
"scope": "required",
|
|
22
22
|
"licenses": [
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
"expression": "MIT"
|
|
25
25
|
}
|
|
26
26
|
],
|
|
27
|
-
"purl": "pkg:cargo/duplicatecode@0.
|
|
27
|
+
"purl": "pkg:cargo/duplicatecode@0.4.0?download_url=file://.",
|
|
28
28
|
"components": [
|
|
29
29
|
{
|
|
30
30
|
"type": "application",
|
|
31
|
-
"bom-ref": "path+file:///D:/a/duplicatecode/duplicatecode/crates/duplicatecode-cli#duplicatecode@0.
|
|
31
|
+
"bom-ref": "path+file:///D:/a/duplicatecode/duplicatecode/crates/duplicatecode-cli#duplicatecode@0.4.0 bin-target-0",
|
|
32
32
|
"name": "duplicatecode",
|
|
33
|
-
"version": "0.
|
|
34
|
-
"purl": "pkg:cargo/duplicatecode@0.
|
|
33
|
+
"version": "0.4.0",
|
|
34
|
+
"purl": "pkg:cargo/duplicatecode@0.4.0?download_url=file://.#src/main.rs"
|
|
35
35
|
}
|
|
36
36
|
]
|
|
37
37
|
},
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"components": [
|
|
46
46
|
{
|
|
47
47
|
"type": "library",
|
|
48
|
-
"bom-ref": "path+file:///D:/a/duplicatecode/duplicatecode/crates/duplicatecode-engine#0.
|
|
48
|
+
"bom-ref": "path+file:///D:/a/duplicatecode/duplicatecode/crates/duplicatecode-engine#0.4.0",
|
|
49
49
|
"name": "duplicatecode-engine",
|
|
50
|
-
"version": "0.
|
|
50
|
+
"version": "0.4.0",
|
|
51
51
|
"description": "Static duplicate/similar code detection engine for Python, TypeScript/JavaScript, SQL and C#",
|
|
52
52
|
"scope": "required",
|
|
53
53
|
"licenses": [
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"expression": "MIT"
|
|
56
56
|
}
|
|
57
57
|
],
|
|
58
|
-
"purl": "pkg:cargo/duplicatecode-engine@0.
|
|
58
|
+
"purl": "pkg:cargo/duplicatecode-engine@0.4.0?download_url=file://..\\duplicatecode-engine"
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
"type": "library",
|
|
@@ -3324,11 +3324,11 @@
|
|
|
3324
3324
|
],
|
|
3325
3325
|
"dependencies": [
|
|
3326
3326
|
{
|
|
3327
|
-
"ref": "path+file:///D:/a/duplicatecode/duplicatecode/crates/duplicatecode-cli#duplicatecode@0.
|
|
3327
|
+
"ref": "path+file:///D:/a/duplicatecode/duplicatecode/crates/duplicatecode-cli#duplicatecode@0.4.0",
|
|
3328
3328
|
"dependsOn": [
|
|
3329
3329
|
"registry+https://github.com/rust-lang/crates.io-index#anyhow@1.0.104",
|
|
3330
3330
|
"registry+https://github.com/rust-lang/crates.io-index#clap@4.6.7",
|
|
3331
|
-
"path+file:///D:/a/duplicatecode/duplicatecode/crates/duplicatecode-engine#0.
|
|
3331
|
+
"path+file:///D:/a/duplicatecode/duplicatecode/crates/duplicatecode-engine#0.4.0",
|
|
3332
3332
|
"registry+https://github.com/rust-lang/crates.io-index#rayon@1.12.0",
|
|
3333
3333
|
"registry+https://github.com/rust-lang/crates.io-index#serde@1.0.229",
|
|
3334
3334
|
"registry+https://github.com/rust-lang/crates.io-index#serde_json@1.0.151",
|
|
@@ -3337,9 +3337,10 @@
|
|
|
3337
3337
|
]
|
|
3338
3338
|
},
|
|
3339
3339
|
{
|
|
3340
|
-
"ref": "path+file:///D:/a/duplicatecode/duplicatecode/crates/duplicatecode-engine#0.
|
|
3340
|
+
"ref": "path+file:///D:/a/duplicatecode/duplicatecode/crates/duplicatecode-engine#0.4.0",
|
|
3341
3341
|
"dependsOn": [
|
|
3342
3342
|
"registry+https://github.com/rust-lang/crates.io-index#ignore@0.4.33",
|
|
3343
|
+
"registry+https://github.com/rust-lang/crates.io-index#rayon@1.12.0",
|
|
3343
3344
|
"registry+https://github.com/rust-lang/crates.io-index#serde@1.0.229",
|
|
3344
3345
|
"registry+https://github.com/rust-lang/crates.io-index#serde_json@1.0.151",
|
|
3345
3346
|
"registry+https://github.com/rust-lang/crates.io-index#tree-sitter@0.27.0",
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
duplicatecode-0.3.1.data/scripts/duplicatecode.exe,sha256=33sUDGbK4bx4ia2FRp7sr2VNCqXbDEv8d2PB-586Ydw,17516032
|
|
2
|
-
duplicatecode-0.3.1.dist-info/METADATA,sha256=O5SLA8he4Y3B-lFxwEAIERR0oQAO9uvq_FcKHJVVSMM,20682
|
|
3
|
-
duplicatecode-0.3.1.dist-info/WHEEL,sha256=8Aej0W0a6Cz6apA3IzJrTnxLRVLAt-w0Oh8SA3Con_c,94
|
|
4
|
-
duplicatecode-0.3.1.dist-info/sboms/duplicatecode.cyclonedx.json,sha256=XyVdeAxDdFGNhcXz_Jq2o4fltkDfZerwCTzRKtU6dSo,126750
|
|
5
|
-
duplicatecode-0.3.1.dist-info/RECORD,,
|
|
File without changes
|