First off, thank you for considering a contribution! nsefetch is a community project and every bug report, feature idea, and pull request makes it better.
- Code of Conduct
- Getting Started
- Running Tests
- Code Style
- Submitting a Pull Request
- Reporting Bugs
- Requesting Features
This project follows the Contributor Covenant Code of Conduct. By participating, you agree to uphold this standard. Please report unacceptable behavior to the maintainer via GitHub issues.
- Python 3.12 or 3.13
- uv or
pip
# Clone the repo
git clone https://github.com/harsh-kumar-rai/nsefetch.git
cd nsefetch
# Create and activate a virtual environment
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # macOS/Linux
# Install in editable mode with dev dependencies
pip install -e ".[dev]"pytest tests/ -v --tb=shortNote: Tests that hit live NSE endpoints are gated behind the
NSEFETCH_LIVE_PROBE_ENABLED=1environment variable and will be skipped in normal test runs. Do not add live-network tests to the standard suite.
This project uses ruff for linting and formatting.
# Check for lint issues
ruff check src/ tests/
# Auto-fix safe issues
ruff check --fix src/ tests/
# Format code
ruff format src/ tests/
# Check formatting without modifying files
ruff format --check src/ tests/All PRs must pass ruff check and ruff format --check before merging.
-
Fork the repository and create your branch from
main:git checkout -b feature/your-feature-name
-
Write tests for any new functionality. The test suite uses
pytestandpytest-asyncio. -
Ensure all checks pass locally:
ruff check src/ tests/ ruff format --check src/ tests/ pytest tests/ -v --tb=short
-
Write a clear PR description explaining:
- What the change does
- Why it's needed
- Any trade-offs or limitations
-
Keep PRs focused — one logical change per PR makes review faster.
Use the Bug Report issue template. Please include:
- Python version and OS
- nsefetch version (
pip show nsefetch) - Minimal reproducible example
- Expected vs actual behavior
- Full traceback if applicable
Use the Feature Request issue template. Good candidates include:
- New NSE endpoints (pre-open, corporate actions, IPO data)
- BSE support
- Historical data integration
- pandas / polars output helpers
- New index names
- Export utilities (CSV, Excel)
Check existing issues first to avoid duplicates — and feel free to comment "+1" on open requests you care about.
nsefetch/
├── src/nsefetch/
│ ├── __init__.py # Public API surface
│ ├── client.py # HTTP client with cookie bootstrap
│ ├── transport.py # Swappable transport boundary
│ ├── fetcher.py # NSE endpoint fetching
│ ├── normalizer.py # Raw payload → typed schema
│ ├── schemas.py # Pydantic data models
│ ├── circuit_breaker.py # Failure isolation
│ ├── rate_limiter.py # GCRA rate limiter
│ ├── cache.py # In-memory / Redis cache
│ ├── config.py # Settings via pydantic-settings
│ ├── exceptions.py # Exception hierarchy
│ ├── live_probe.py # Live connectivity probe
│ ├── providers/ # Provider base classes
│ └── services/ # MarketService / AsyncMarketService
├── tests/ # pytest test suite
├── docs/ # User-facing documentation
└── examples/ # Runnable usage examples (Wave 2)
Thank you for contributing! 🎉