We welcome contributions to make this template more useful for NEAR developers! Here's how you can help:
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/near_swarm_intelligence
cd near_swarm_intelligence
- Install dependencies:
pip install -e ".[dev]"
- Create a branch:
git checkout -b feature/your-feature-name
- Configure environment:
cp .env.example .env
# Edit .env with your credentials
- Install pre-commit hooks:
pre-commit install
- Run tests:
pytest tests/
We follow Google's Python Style Guide with these additions:
- Type Hints
def process_data(data: List[Dict[str, Any]]) -> Dict[str, float]:
"""Process market data and return metrics."""
- Docstrings
def analyze_market(symbol: str) -> MarketAnalysis:
"""Analyze market conditions for a given token.
Args:
symbol: Token symbol to analyze
Returns:
MarketAnalysis object with results
Raises:
MarketDataError: If market data cannot be fetched
"""
- Error Handling
try:
result = await agent.evaluate_proposal(proposal)
except MarketDataError as e:
logger.error(f"Market data error: {e}")
raise
except Exception as e:
logger.error(f"Unexpected error: {e}")
raise SwarmError(f"Evaluation failed: {e}")
- Unit Tests
def test_market_analysis():
"""Test market analysis functionality."""
analyzer = MarketAnalyzer()
result = analyzer.analyze("NEAR")
assert result.symbol == "NEAR"
assert 0 <= result.confidence <= 1
- Integration Tests
@pytest.mark.asyncio
async def test_swarm_consensus():
"""Test swarm consensus mechanism."""
agents = setup_test_swarm()
result = await agents[0].propose_action(test_proposal)
assert result["consensus"] is True
- Test Coverage
pytest --cov=near_swarm tests/
- Before Submitting
- Run all tests
- Update documentation
- Add test cases
- Follow code style
- PR Template
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Performance improvement
## Testing
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] All tests passing
## Documentation
- [ ] Documentation updated
- [ ] Examples added/updated
- Review Process
- Two approvals required
- All tests must pass
- Documentation must be updated
- Code Documentation
- Clear docstrings
- Type hints
- Inline comments for complex logic
- API Documentation
- Update api-reference.md
- Add examples
- Document breaking changes
- Examples
- Add example code
- Update existing examples
- Include test cases
- Bug Reports
## Bug Description
Clear description of the bug
## Steps to Reproduce
1. Step one
2. Step two
3. Step three
## Expected Behavior
What should happen
## Actual Behavior
What actually happens
## Environment
- Python version:
- OS:
- Package version:
- Feature Requests
## Feature Description
Clear description of the feature
## Use Case
Why this feature is needed
## Proposed Solution
How it could be implemented
## Alternatives Considered
Other approaches considered
- Reporting Security Issues
- Email: [email protected]
- Subject: "NEAR SWARM SECURITY"
- Do not disclose publicly
- Security Best Practices
- No secrets in code
- Input validation
- Rate limiting
- Error handling
- Version Numbering
- Follow semantic versioning
- Document breaking changes
- Release Checklist
- All tests passing
- Documentation updated
- CHANGELOG.md updated
- Version bumped
- Release notes prepared
- Release Notes
## [1.0.0] - YYYY-MM-DD
### Added
- New feature X
- New feature Y
### Changed
- Modified behavior of Z
### Fixed
- Bug in feature A
- Performance issue in B
Please read and follow our Code of Conduct.
By contributing, you agree that your contributions will be licensed under the MIT License.