Panduan lengkap untuk menyiapkan environment development dan testing di localhost.
- Python 3.8 atau lebih tinggi
- pip (Python package manager)
- git
Instal semua dependensi yang diperlukan untuk development dan testing:
# Install semua dependencies
pip install -r requirements-dev.txtInstal package dalam mode development dengan semua dependencies:
# Install package dalam mode editable dengan semua dependencies
pip install -e ".[all]"Atau instal dengan kategori spesifik:
# Hanya dependencies development
pip install -e ".[dev]"
# Development + Machine Learning
pip install -e ".[dev,ml]"
# Development + Dashboard
pip install -e ".[dev,dashboard]"
# Development + API clients
pip install -e ".[dev,api]"Untuk instalasi minimal tanpa optional dependencies:
pip install -r requirements.txtSetelah instalasi selesai, jalankan tests:
# Jalankan semua tests
pytest
# Jalankan tests dengan coverage report
pytest --cov=wunaraha --cov-report=html
# Jalankan tests dengan verbose output
pytest -v
# Jalankan test spesifik
pytest tests/test_auditor.pySetelah instalasi, Anda dapat menggunakan tools berikut:
# Format code dengan Black
black wunaraha/ tests/
# Sort imports dengan isort
isort wunaraha/ tests/# Check code style dengan flake8
flake8 wunaraha/ tests/
# Type checking dengan mypy
mypy wunaraha/# Install pre-commit hooks
pre-commit install
# Run pre-commit manually
pre-commit run --all-filestransformers- Model AI untuk validasitorch- Deep learning frameworkpandas- Data processingnumpy- Numerical computingrequests- HTTP client
pytest- Testing frameworkpytest-cov- Coverage reportingpytest-asyncio- Async test support
black- Code formatterflake8- Code lintermypy- Type checkerisort- Import sorterpre-commit- Git hooks manager
scikit-learn- ML utilitiessentence-transformers- Sentence embeddings
streamlit- Web dashboardplotly- Interactive plots
tweepy- Twitter APIMastodon.py- Mastodon APIpython-dotenv- Environment variables
ipython- Interactive Python shelljupyter- Jupyter notebooks
Setelah instalasi, verifikasi bahwa semua package terinstall:
# Cek versi Python
python --version
# List semua installed packages
pip list
# Cek package spesifik
pip show pytest
pip show transformers# Install torch dari PyTorch index
pip install torch>=2.0.0 --index-url https://download.pytorch.org/whl/cpu# Upgrade pip terlebih dahulu
pip install --upgrade pip
# Clear cache dan reinstall
pip cache purge
pip install -r requirements-dev.txt --no-cache-dir# Gunakan user install
pip install -r requirements-dev.txt --user
# Atau gunakan virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Linux/Mac
# atau
venv\Scripts\activate # Windows
pip install -r requirements-dev.txt- Gunakan Virtual Environment - Selalu gunakan venv atau conda untuk mengisolasi dependencies
- Pin Versions - Untuk production, pertimbangkan untuk pin versi spesifik
- Regular Updates - Update dependencies secara berkala untuk security patches
- Test Before Commit - Selalu jalankan tests sebelum commit perubahan
# Import library setelah instalasi
from wunaraha import Auditor
# Initialize auditor
auditor = Auditor()
# Run validation
result = auditor.validate("your-text-here")
print(result)- Dokumentasi: Lihat README.md
- Issues: https://github.com/wunaraha/wunaraha/issues
- Contributing: Lihat CONTRIBUTING.md