Skip to main content

general purpose python toolkit

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-1.3.4.tar.gz (16.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-1.3.4-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: openbuffet_toolkit-1.3.4.tar.gz
  • Upload date:
  • Size: 16.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-1.3.4.tar.gz
Algorithm Hash digest
SHA256 deea0996960bc33590cb1954f4ee9ca865445e528092bb385ef1957715dd7c04
MD5 95aa771c36d8b6599db6b1eda00f6e9f
BLAKE2b-256 8d47f266b94c9b785b8e228ba2a6afc5f389c2840ff8bf523930be0581a9ad6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for openbuffet_toolkit-1.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 10c1dce311ba807358c70652922b2a14e8df6bed51d8d1cc95e3a31ca1b947c7
MD5 942400368e4d811dfac637cda311f890
BLAKE2b-256 c6bc520e1bc4a7f8b7ab19cec3549968bd836a69b6e2eaef96bc278c1fd22229

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