Skip to main content

kalkan (Python)

Türkçe kişisel verileri (TC kimlik, VKN, IBAN, telefon, kart, ad-soyad, adres, SGK sicil no, IP, doğum tarihi...) LLM'e gitmeden maskeleyen, cevapta geri yükleyen hızlı KVKK motoru. Rust ile yazılmıştır; saf Python regex çözümlerine göre tek çekirdekte yaklaşık 8 kat hızlıdır ve mask_batch GIL'i bırakarak tüm çekirdekleri kullanır.

Kullanım

pip install kalkan
import kalkan

k = kalkan.Kalkan(terms=["Proje Atlas"])
s = k.session()                       # her sohbet için bir oturum

istem = s.mask("Ayşe Kaya Hanım, TC 10000000146, Proje Atlas bütçesi")
# "[AD_SOYAD_1] Hanım, TC [TCKN_1], [OZEL_1] bütçesi"

cevap = llm(istem)
rapor = s.audit(cevap)                # model yeni kişisel veri üretti mi?
if not rapor:
    log.warning(rapor)
print(s.restore(cevap))

# Akış (streaming)
akis = s.stream()
for parca in llm_akisi(istem):
    gonder(akis.push(parca))
gonder(akis.finish())

# Toplu anonimleştirme: tüm çekirdeklerde, GIL serbest
temiz = kalkan.Kalkan(strategy="label").mask_batch(milyonlarca_kayit)

detect() sonuçlarındaki start/end karakter indeksidir: metin[e.start:e.end] doğrudan çalışır. Kasa s.vault ile sözlük olarak alınır ve başka bir süreçte import_vault ile yüklenebilir.

Entegrasyonlar

from kalkan.messages import mask_messages                 # OpenAI SDK, bağımlılıksız
from kalkan.integrations.litellm import completion        # pip install "kalkan[litellm]"
from kalkan.integrations.litellm import KalkanGuardrail   # LiteLLM Proxy guardrail'i
from kalkan.integrations.langchain import with_kalkan     # pip install "kalkan[langchain]"

Hepsi akış cevaplarını da geri yükler; yer tutucu parçalar arasında bölünse bile.

LiteLLM Proxy'de (config.yaml):

guardrails:
  - guardrail_name: kalkan
    litellm_params:
      guardrail: kalkan.integrations.litellm.KalkanGuardrail
      mode: [pre_call, post_call]
      default_on: true

LangChain'de:

model = with_kalkan(ChatOpenAI(model="gpt-4o"))
zincir = prompt | model | StrOutputParser()

Tüm özellikler, sınırlamalar ve ölçümler için: github.com/CelkMehmett/kalkan.

kalkan bir yardımcı araçtır, hukuki uyum garantisi değildir. Tespit %100 değildir.

Metadata

Release files for kalkan 0.3.1

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

Source distribution (sdist)

Source distribution for kalkan 0.3.1
File Size Uploaded Provenance Actions
kalkan-0.3.1.tar.gz 88.6 kB With provenance Details for kalkan-0.3.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for kalkan 0.3.1
File Actions
kalkan-0.3.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for kalkan-0.3.1-cp39-abi3-win_amd64.whl
kalkan-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details for kalkan-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl
kalkan-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details for kalkan-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl
kalkan-0.3.1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for kalkan-0.3.1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
kalkan-0.3.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for kalkan-0.3.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
kalkan-0.3.1-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for kalkan-0.3.1-cp39-abi3-macosx_11_0_arm64.whl
kalkan-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for kalkan-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 2.9 MB

Release files / kalkan-0.3.1.tar.gz

Download URL kalkan-0.3.1.tar.gz
Size 88.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0ec2ee5ba715559cbf276d05c0933ebe06dca16739eb1ec6c01a62f296376c63
BLAKE2b-256 checksum
How to use checksums
de8634658ddfb7eac2a404414452ef2fd1ca67aee6a7fec40b5820d5d02ccc76
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 18, 2026.

Transparency log

Release files / kalkan-0.3.1-cp39-abi3-win_amd64.whl

Download URL kalkan-0.3.1-cp39-abi3-win_amd64.whl
Size 244.8 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
27a4420d99a086413b4246c061604e516bcf67f64bc789dc77f53c8f39dfa484
BLAKE2b-256 checksum
How to use checksums
a13b96b7610c1e555843c7ddf51cac945e08a2fa67cce216487a6171aa12d56f
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 18, 2026.

Transparency log

Release files / kalkan-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL kalkan-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl
Size 591.1 kB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
9e8e5ee10c772a9acc927906c6e4941a8f34b1213b3f21dec645b351392c4bb3
BLAKE2b-256 checksum
How to use checksums
cded303ba590505f6e96739e7d23d7984e041c3de15e11aaa91c8033418a4ea4
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 18, 2026.

Transparency log

Release files / kalkan-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL kalkan-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl
Size 552.8 kB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
78ed9dd6d0803603188554a1634c851046d89d214048a945324441a4270362a2
BLAKE2b-256 checksum
How to use checksums
273d1001dd0b7eb7499f1b2dbf53a9db7f56d17cdf64c423a09ffadbe9163399
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 18, 2026.

Transparency log

Release files / kalkan-0.3.1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kalkan-0.3.1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 378.9 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
f20a1127222c98008f99050b64e882c4693fae50426948acd0c2237a99fd16bc
BLAKE2b-256 checksum
How to use checksums
fd73a300910e70d562f93dec733e7bd73933890252841a14bee36a520999958a
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 18, 2026.

Transparency log

Release files / kalkan-0.3.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL kalkan-0.3.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 374.2 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
e16b63840c2b8585be3be31df038ec61ccf051583f6ca94b1aec3a568d50e4a9
BLAKE2b-256 checksum
How to use checksums
fe7d1faf9a7a987e86b404f26bbdd3c222363d0e6cd23564f7cbb8f00b612a80
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 18, 2026.

Transparency log

Release files / kalkan-0.3.1-cp39-abi3-macosx_11_0_arm64.whl

Download URL kalkan-0.3.1-cp39-abi3-macosx_11_0_arm64.whl
Size 331.5 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
92956b223bd485426a50e39012ff853ea05d62b58a32c69560f304100cfa8f2d
BLAKE2b-256 checksum
How to use checksums
e39a7247ea3d9ed8dd750fd0edd77f67f791b6939d475415569a4cd80d5241da
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 18, 2026.

Transparency log

Release files / kalkan-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl

Download URL kalkan-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl
Size 350.2 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
4edf4fda48c94ecf7f5d6998b0ab41fd476c8a947c4e617dabbbdbcda8def2b4
BLAKE2b-256 checksum
How to use checksums
cf8a7cf31212a0c6b96d999ad39e9d5faaf855fc9aec1688462bd6301a8b837f
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 18, 2026.

Transparency log

Security for kalkan 0.3.1

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

All 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for kalkan-0.3.1.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 18, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.3.1 This release

8 release files Full provenance

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