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

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.4.0
File Size Uploaded Provenance Actions
kalkan-0.4.0.tar.gz 128.2 kB With provenance Details for kalkan-0.4.0.tar.gz

Built distributions (wheels)

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

Total release size: 3.4 MB

Release files / kalkan-0.4.0.tar.gz

Download URL kalkan-0.4.0.tar.gz
Size 128.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5b61ceb559a1eb0bda821f3e476fb24f2aded4a5ecae69fb8496e608fe6a0a76
BLAKE2b-256 checksum
How to use checksums
f0cc98b47c539871ce7a817a6c7ef7f8bcbc9391e4ca1d0cc908228d62dbcfb5
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 log

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

Download URL kalkan-0.4.0-cp39-abi3-win_amd64.whl
Size 310.3 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
cc465c86fee91cac89b8516c4bd70110b708a7d3325d20b920e74af4a5b1c8ba
BLAKE2b-256 checksum
How to use checksums
0c666e397d544225b08a6dcee0eb8ff577ee83d16ce156e9e70b3963d03bd1c7
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 log

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

Download URL kalkan-0.4.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 657.5 kB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
e4fcf97e0e621d13c436a8070f3493a9d8b132c05e63f989ed68602b1e955c94
BLAKE2b-256 checksum
How to use checksums
bdf50b03279fffa783486c2971ff27a4bf7f6b15b251a69299e357724ea667cd
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 log

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

Download URL kalkan-0.4.0-cp39-abi3-musllinux_1_2_aarch64.whl
Size 617.8 kB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
3d4c2a70418668f6ef13e6fc9b790cf4e05ffbe0fb8bfc0dfbc952d08386e37f
BLAKE2b-256 checksum
How to use checksums
a87a4951cf2b25b870261cf42285ffbc1dcf3ac03cc12bdbcd27760b300688b2
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 log

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

Download URL kalkan-0.4.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 444.8 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
7daa371709ed5f3898305f23dd2a4482278c433684b058264b65b16c9bae9a01
BLAKE2b-256 checksum
How to use checksums
7f40d16e7d0276d6a6c322689c11ae7923ca7d9c4e5a302f5340206d911eb5d7
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 log

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

Download URL kalkan-0.4.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 440.0 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
5417d5f94ff1ef9b563752f26e4aebaec41c66161dd51f9242916ce211519a89
BLAKE2b-256 checksum
How to use checksums
537235c7bf69c9faa8fc9b41ff567240f089ce171c67b246b9d21ce194fc9d44
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 log

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

Download URL kalkan-0.4.0-cp39-abi3-macosx_11_0_arm64.whl
Size 394.0 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
058111049b39445f4ab174e75387fec9c79495e6aa70521f1806d6276171d076
BLAKE2b-256 checksum
How to use checksums
3009a263f765435f4eaf9822f4814817969a92520b85d985ed40094ff4905d3b
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 log

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

Download URL kalkan-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 416.9 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
05e4c7ab9c268463f217b34c2a305ddfdd11fa1ac0ce95a0dd4e048377f6e11a
BLAKE2b-256 checksum
How to use checksums
56549773d9b9f29379a615f487fe33684c8254f6e783b579eb58fe942be02b1c
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 log

Security for kalkan 0.4.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

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

Select from 8 files

Attestation for kalkan-0.4.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 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.

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