Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 22 additions & 29 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,48 +1,41 @@
```
# Python
# Dependencies
venv/
.venv/
__pycache__/
*.pyc
*.pyo
*.pyd
.Python
env/
venv/
.venv/
.ENV
.ENV.local
*.egg-info/
dist/
build/
*.so
*.dylib
*.dll

# Environment
.env
.env.local
.env.*
.venv/
venv/
env/
*.env.*

# Build/dist
build/
dist/
*.egg
*.egg-info/
*.so
*.whl
# Editors
.vscode/
.idea/
*.swp
*.swo
*.tmp

# Testing
# Logs
*.log

# Tests and coverage
.coverage
coverage/
htmlcov/
.pytest_cache/
.mypy_cache/

# Logs
*.log

# OS
.DS_Store
Thumbs.db

# Editors
.vscode/
.idea/
*.swp
*.swo
*.tmp
```
216 changes: 216 additions & 0 deletions SETUP_DEV.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
# 🚀 Setup Development Environment - Wunaraha

Panduan lengkap untuk menyiapkan environment development dan testing di localhost.

## 📋 Prerequisites

- Python 3.8 atau lebih tinggi
- pip (Python package manager)
- git

## 🔧 Langkah Instalasi

### Opsi 1: Menggunakan requirements-dev.txt (RECOMMENDED)

Instal semua dependensi yang diperlukan untuk development dan testing:

```bash
# Install semua dependencies
pip install -r requirements-dev.txt
```

### Opsi 2: Menggunakan pyproject.toml

Instal package dalam mode development dengan semua dependencies:

```bash
# Install package dalam mode editable dengan semua dependencies
pip install -e ".[all]"
```

Atau instal dengan kategori spesifik:

```bash
# 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]"
```

### Opsi 3: Menggunakan requirements.txt (Minimal)

Untuk instalasi minimal tanpa optional dependencies:

```bash
pip install -r requirements.txt
```

## 🎯 Quick Start Testing

Setelah instalasi selesai, jalankan tests:

```bash
# 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.py
```

## 🛠️ Development Tools

Setelah instalasi, Anda dapat menggunakan tools berikut:

### Code Formatting
```bash
# Format code dengan Black
black wunaraha/ tests/

# Sort imports dengan isort
isort wunaraha/ tests/
```

### Code Linting
```bash
# Check code style dengan flake8
flake8 wunaraha/ tests/

# Type checking dengan mypy
mypy wunaraha/
```

### Pre-commit Hooks
```bash
# Install pre-commit hooks
pre-commit install

# Run pre-commit manually
pre-commit run --all-files
```

## 📦 Struktur Dependencies

### Core Dependencies (Wajib)
- `transformers` - Model AI untuk validasi
- `torch` - Deep learning framework
- `pandas` - Data processing
- `numpy` - Numerical computing
- `requests` - HTTP client

### Testing Dependencies
- `pytest` - Testing framework
- `pytest-cov` - Coverage reporting
- `pytest-asyncio` - Async test support

### Development Tools
- `black` - Code formatter
- `flake8` - Code linter
- `mypy` - Type checker
- `isort` - Import sorter
- `pre-commit` - Git hooks manager

### Optional Dependencies

#### Machine Learning
- `scikit-learn` - ML utilities
- `sentence-transformers` - Sentence embeddings

#### Dashboard & Visualization
- `streamlit` - Web dashboard
- `plotly` - Interactive plots

#### API Clients
- `tweepy` - Twitter API
- `Mastodon.py` - Mastodon API
- `python-dotenv` - Environment variables

#### Utilities
- `ipython` - Interactive Python shell
- `jupyter` - Jupyter notebooks

## 🔍 Verifikasi Instalasi

Setelah instalasi, verifikasi bahwa semua package terinstall:

```bash
# Cek versi Python
python --version

# List semua installed packages
pip list

# Cek package spesifik
pip show pytest
pip show transformers
```

## 🐛 Troubleshooting

### Issue: torch installation gagal
```bash
# Install torch dari PyTorch index
pip install torch>=2.0.0 --index-url https://download.pytorch.org/whl/cpu
```

### Issue: dependencies conflict
```bash
# Upgrade pip terlebih dahulu
pip install --upgrade pip

# Clear cache dan reinstall
pip cache purge
pip install -r requirements-dev.txt --no-cache-dir
```

### Issue: permission error
```bash
# 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
```

## 💡 Best Practices

1. **Gunakan Virtual Environment** - Selalu gunakan venv atau conda untuk mengisolasi dependencies
2. **Pin Versions** - Untuk production, pertimbangkan untuk pin versi spesifik
3. **Regular Updates** - Update dependencies secara berkala untuk security patches
4. **Test Before Commit** - Selalu jalankan tests sebelum commit perubahan

## 📝 Contoh Penggunaan

```python
# Import library setelah instalasi
from wunaraha import Auditor

# Initialize auditor
auditor = Auditor()

# Run validation
result = auditor.validate("your-text-here")
print(result)
```

## 🆘 Butuh Bantuan?

- Dokumentasi: Lihat README.md
- Issues: https://github.com/wunaraha/wunaraha/issues
- Contributing: Lihat CONTRIBUTING.md
52 changes: 52 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Requirements untuk Wunaraha - Altmetric Validator AI
# Lengkap untuk development dan testing di localhost

# ===========================================
# CORE DEPENDENCIES
# ===========================================
transformers>=4.30.0
torch>=2.0.0
pandas>=1.5.0
numpy>=1.24.0
requests>=2.28.0

# ===========================================
# TESTING
# ===========================================
pytest>=7.0.0
pytest-cov>=4.0.0
pytest-asyncio>=0.21.0

# ===========================================
# DEVELOPMENT TOOLS
# ===========================================
black>=23.0.0
flake8>=6.0.0
mypy>=1.0.0
isort>=5.12.0
pre-commit>=3.0.0

# ===========================================
# MACHINE LEARNING (OPTIONAL)
# ===========================================
scikit-learn>=1.2.0
sentence-transformers>=2.2.0

# ===========================================
# DASHBOARD & VISUALIZATION (OPTIONAL)
# ===========================================
streamlit>=1.20.0
plotly>=5.14.0

# ===========================================
# API CLIENTS (OPTIONAL)
# ===========================================
tweepy>=4.14.0
Mastodon.py>=1.5.0
python-dotenv>=1.0.0

# ===========================================
# UTILITIES
# ===========================================
ipython>=8.0.0
jupyter>=1.0.0
Loading