pysayme
Finds project code that duplicates functions or constants that the project's own installed dependencies already export, and fails a pytest test naming the library function to call instead.
Clone detectors such as pylint R0801, jscpd and PMD CPD compare a project with itself, and they compare text. pysayme compares a project with its dependencies, and it compares normalized AST structure, so renamed copies still match.
Install
pip install pysayme
Use
As a pytest gate
Add a [tool.pysayme] table to pyproject.toml:
[tool.pysayme]
roots = ["src", "tests"]
[tool.pysayme.allow]
"src/app/util.py:runs -> somelib.masks:runs" = "why this copy is deliberate"
A full pytest run (no path arguments) then includes one pyproject.toml::pysayme
item. The item fails if any of these hold:
- project code duplicates a public dependency function or constant;
- an allowlist entry no longer matches (so the list only shrinks);
- an allowlist entry has no reason.
| Flag | Effect |
|---|---|
--pysayme |
run the gate even when paths or tests are selected |
--no-pysayme |
never run it |
-m "not pysayme" |
deselect it |
From the command line
pysayme # check, using pyproject.toml
pysayme --dist numpy scipy -- src tests # explicit dependencies and roots
pysayme check --all # include allowlisted matches
pysayme rank --top 3 # rank shape-independent look-alikes
check exits 1 when there are new duplicates or allowlist problems.
Configuration
| Key | Default | Meaning |
|---|---|---|
roots |
["."] |
project paths to check; git-tracked and unignored .py files |
dists |
discovered | installed distributions to check against |
requirements |
requirements file(s) to take dists from |
|
extra-dists, ignore-dists |
[] |
add to / remove from the discovered dists |
exclude |
[] |
fnmatch globs of project paths to skip |
allow |
{} |
"path:qualname -> module:qualname" keys mapped to reasons |
copy |
0.45 |
shingle Jaccard for a copy |
inlined |
0.70 |
share of a library function found inside a project one |
min-shingles, min-inlined |
12, 30 |
smallest function compared, and smallest one inlined |
private |
false |
also match private library code |
ambiguous |
false |
also report matches that fit several library functions |
jobs |
all CPUs | indexing processes |
cache |
true |
cache dependency indexes ($PYSAYME_CACHE, else ~/.cache/pysayme) |
When dists and requirements are both unset, pysayme uses the installed
[project] dependencies and extras, falling back to requirements.txt.
Docs
- docs/design.md: how matching works
- docs/validation.md: results on real projects
- docs/releasing.md: CI and PyPI publishing
License
Apache-2.0
Metadata
Release files for pysayme 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pysayme-0.1.0.tar.gz | 72.8 kB | With provenance | Details for pysayme-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pysayme-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pysayme-0.1.0-py3-none-any.whl |
Total release size: 98.5 kB
Release files / pysayme-0.1.0.tar.gz
| Download URL | pysayme-0.1.0.tar.gz |
|---|---|
| Size | 72.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8fb21e578b06be52e84538b9019f57fa0bd5e21ad937439b95cc5558252ceb5d
|
|
BLAKE2b-256 checksum How to use checksums |
60fd1216c9221a6999f76ed6bc8daf4c463f5c10fe5b8a479d0fb21c02621d01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logRelease files / pysayme-0.1.0-py3-none-any.whl
| Download URL | pysayme-0.1.0-py3-none-any.whl |
|---|---|
| Size | 25.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a36a45a0c837ffae1a471dd759f68ed190b976efbafbbc39359841548d3c1bb
|
|
BLAKE2b-256 checksum How to use checksums |
52a8297199f98a18040efde9d638f8a9ab30729109fe16e674910943b6221f3f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logSecurity for pysayme 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pysayme-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.