keynet-core
Keynet 패키지들의 핵심 유틸리티와 공통 모델
설치
pip install keynet-core
주요 기능
🔧 공통 유틸리티
- 환경 변수 관리
- 설정 파일 처리
- 로깅 설정
📦 공유 모델
- 데이터 검증 모델
- API 응답 모델
- 설정 스키마
🔌 의존성
- 최소한의 의존성 유지
- 다른 Keynet 패키지의 기반
🔒 Security Features
자동 민감정보 마스킹 (Automatic Sensitive Data Redaction)
keynet-core는 stdout/stderr에 출력되는 민감정보를 자동으로 마스킹합니다.
보호되는 정보:
- AWS Access Keys (AKIA...)
- KEYNET_ prefix credentials (KEYNET_minio, KEYNET_storage 등)
- Passwords, tokens, API keys (key=value 형태, 최소 3자)
- Private keys (PEM format)
- MLflow URIs with credentials
- 환경변수 (AWS_, MLFLOW_, RABBIT_, KEYNET_, APP_API_KEY 등)
자동 활성화:
keynet-core를 설치하면 자동으로 redaction이 활성화됩니다:
pip install keynet-core
# Python 시작 시 자동으로 redaction 활성화!
# import 순서와 무관하게 보호됨
import os
# 환경변수 형태로 출력하면 자동 마스킹
os.environ["AWS_ACCESS_KEY_ID"] = "KEYNET_myaccess"
print(f"AWS_ACCESS_KEY_ID={os.getenv('AWS_ACCESS_KEY_ID')}")
# 출력: AWS_ACCESS_KEY_ID=***ENV_VAR_xxxx***
# KEYNET_ prefix 사용 시 명시적 감지
print("Using credential: KEYNET_myaccess")
# 출력: Using credential: ***KEYNET_KEY_xxxx***
권장사항: KEYNET_ Prefix 사용
개발 환경에서 MinIO credential에 KEYNET_ prefix를 사용하세요:
export AWS_ACCESS_KEY_ID=KEYNET_myaccess
export AWS_SECRET_ACCESS_KEY=KEYNET_mysecret
- ✅ 자동 감지 보장
- ✅ keynet 프로젝트 credential임을 명시
예외 메시지 sanitization:
from keynet_core.security import sanitize_exception
try:
raise ValueError("Error: AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE")
except ValueError as e:
sanitized = sanitize_exception(e)
print(sanitized)
# 출력: Error: AWS_ACCESS_KEY_ID=***ENV_VAR_xxxx***
디버깅 시 비활성화:
export KEYNET_DISABLE_REDACTION=1
python train.py
사용 예제
from keynet_core import Config, check_env
# 환경 변수 검증
if check_env():
print("필수 환경 변수 설정 완료")
# 설정 로드
config = Config()
print(f"MLflow URI: {config.mlflow_tracking_uri}")
API 문서
자세한 API 문서는 GitHub Wiki 참조
라이선스
MIT License
Metadata
Release files for keynet-core 0.8.5
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 |
|---|---|---|---|---|
| keynet_core-0.8.5.tar.gz | 29.5 kB | Without provenance | Details for keynet_core-0.8.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| keynet_core-0.8.5-py3-none-any.whl | Python 3 | none | any | Details for keynet_core-0.8.5-py3-none-any.whl |
Total release size: 56.3 kB
Release files / keynet_core-0.8.5.tar.gz
| Download URL | keynet_core-0.8.5.tar.gz |
|---|---|
| Size | 29.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c69ebc8aa85f4d7e3c78793f3860301345873a0917dcf99b369f3b5f1e123a0
|
|
BLAKE2b-256 checksum How to use checksums |
644b094303669e7e5ef9b4d5a70b3cfe7bfe8ffdd7219fd181a54c0bfd1fb073
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|
Release files / keynet_core-0.8.5-py3-none-any.whl
| Download URL | keynet_core-0.8.5-py3-none-any.whl |
|---|---|
| Size | 26.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
36cc38f1eeb53db9228a2ed7aa4c5e80dea81da6d2a321bf58c7ab7b25484215
|
|
BLAKE2b-256 checksum How to use checksums |
439403e29116ed7030d38bbabce6304c566d229751ad6abd92ac67a7e6ddcf0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|
Security for keynet-core 0.8.5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.