Skip to main content

A utility toolkit including logging, configuration, HuggingFace helpers and more.

Project description

OpenBuffet Toolkit

GitHub Tag PyPI - Version GitHub License GitHub code size in bytes

OpenBuffet ekosistemi için geliştirilmiş modüler bir Python araç kütüphanesidir. Bu toolkit; konfigürasyon yönetimi, loglama, zaman profilleme ve Hugging Face entegrasyonu gibi çok yönlü yardımcı bileşenler içerir.

Modern uygulamalarda yeniden kullanılabilirliği artırmak, entegrasyonları sadeleştirmek ve yazılım kalitesini yükseltmek amacıyla tasarlanmıştır.

Uyumluluk

  • Python Versiyonu: 3.8+
  • Platform Desteği: Tüm platformlar
  • Kullanım Alanları: FastAPI servisleri, veri işleme pipeline'ları, model tabanlı uygulamalar

Özellikler

  • Ortam değişkenlerini .env dosyasından yükleyebilme (ConfiguratorEnvironment)
  • Dosyaya ve konsola loglama yapan, thread-safe LoggerManager
  • Fonksiyonları çalışma süresine göre profilleyen Profiler
  • Hugging Face üzerinde model ve veri yükleme/indirme işlemleri yapan HuggingFaceHelper
  • Açık kaynak, genişletilebilir yapı.

Kurulum

Pip ile Kurulum

pip install openbuffet-toolkit

Geliştirme Modunda Kurulum

git clone https://github.com/ferdikurnazdm/openbuffet_toolkit.git
cd openbuffet_toolkit
pip install -e .

Kullanım Örnekleri

LoggerManager Kullanımı

from openbuffet_toolkit.logger import LoggerManager

logger = LoggerManager().get_logger()
logger.info("Sistem başlatıldı.")

Ortam Değişkenlerini Yükleme

from openbuffet_toolkit.configurator import ConfiguratorEnvironment

config = ConfiguratorEnvironment()
api_key = config.get("API_KEY")

Profiler Dekoratörü

from openbuffet_toolkit.profiler import Profiler

@Profiler.time_taken(label="DEBUG: ")
def iş_yap():
    # İşlem kodları
    pass

HuggingFaceHelper ile Model Yönetimi

from openbuffet_toolkit.hfhelper import HuggingFaceHelper

hf = HuggingFaceHelper(
    hf_username="kullaniciadi",
    hf_token="hf_abc123",
    hf_reponame="proje-adi",
    local_dir="./model"
)

# Repository oluştur
hf.create_repo_if_not_exist()

# Dosya yükle
hf.upload_file("model_bundle.joblib")

# Dosya indir
hf.download_file("model_bundle.joblib", local_dir="./indirilenler")

TextOps ile Metin İşleme

from openbuffet_toolkit.textops import TextOps

Türkçe karakterleri ASCII'ye çevirme

text = "Çok güzel bir gün! Şöyle böyle..."
clean_text = TextOps.transliterate_turkish(text)
print(clean_text)  # "Cok guzel bir gun! Soyle boyle..."

Unicode normalizasyon

normalized = TextOps.normalize_unicode("Café naïve résumé")

Noktalama işaretlerini kaldırma

no_punct = TextOps.remove_punctuation("Merhaba, dünya!")
print(no_punct)  # "Merhaba dünya"

Boşlukları düzenleme

clean_spaces = TextOps.simplify_spaces("Çok    fazla\n\nboşluk\t\tvar")
print(clean_spaces)  # "Çok fazla boşluk var"

Tümünü bir arada temizleme

messy_text = "  Çağdaş    Türkiye'de...  teknoloji!!!  \n\n"
clean_result = TextOps.clean(
    messy_text,
    use_transliterate=True,    # Türkçe karakterleri çevir
    use_unicode=True,          # Unicode normalize et
    use_punctuation=True,      # Noktalama kaldır
    use_spaces=True,           # Boşlukları düzenle
    strip_result=True          # Baş/son boşlukları temizle
)
print(clean_result)  # "Cagdas Turkiyede teknoloji"

MSSQLHelper ile Veritabanı İşlemleri

from openbuffet_toolkit.tool_database import MSSQLHelper

db = MSSQLHelper(
    server="localhost",
    database="TestDB",
    user="sa",
    password="Password123",
    trusted_connection=False
)

# Veri çekme
rows = db.execute_query("SELECT * FROM Users WHERE IsActive = ?", [1])

# Veri ekleme
db.execute_non_query("INSERT INTO Users (Name, IsActive) VALUES (?, ?)", ["Ali", 1])

# Procedure çalıştırma
result = db.execute_stored_procedure("sp_GetActiveUsers")

db.close()

Testler

Projeyi test etmek için:

pytest tests/

Katkı ve İletişim

Bu proje açık kaynaklıdır ve katkılara açıktır. Geri bildirim veya katkı için lütfen GitHub üzerinden issue oluşturun veya pull request gönderin.

Lisans

Bu proje MIT Lisansı ile lisanslanmıştır.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openbuffet_toolkit-0.3.2.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openbuffet_toolkit-0.3.2-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file openbuffet_toolkit-0.3.2.tar.gz.

File metadata

  • Download URL: openbuffet_toolkit-0.3.2.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for openbuffet_toolkit-0.3.2.tar.gz
Algorithm Hash digest
SHA256 bd1dbeea6189b965be3403f68a2c2ac7aa2c6873a10d569c849555d102f1882f
MD5 2fec8ecd27b4e4686bbd1fce4e449ba6
BLAKE2b-256 12ac70b5f6e415fc2e282c3be0947a078e9b89ac1de64e1acc0aa67afdba37b4

See more details on using hashes here.

File details

Details for the file openbuffet_toolkit-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for openbuffet_toolkit-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 50bb540458142f1c331fc29c81e4f93cf792a72a599a26607284a031289a56df
MD5 85d2a9ab601215955ed7c5515434b6c3
BLAKE2b-256 8625b56a9f23095c424f09d54e31302566513c5f507156b29d3ee8b51661ee56

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page