This guide covers development practices and workflows for the HASTE project.
HASTE uses Azurite to emulate Azure Blob, Queue, and Table Storage for local development. It is not a project dependency — install it globally before use:
npm install -g azuriteAzurite must never be used outside of local development. It is not hardened for network exposure. The safe mitigation is use-restriction:
- Run azurite only on
localhost(the default). Never bind it to0.0.0.0or expose it through any port-forwarding, tunnel, or container network. - Do not use azurite in CI pipelines that run with production secrets in scope.
- Switch to a real Azure Storage account (via connection string or managed identity) for any non-local environment.
The project uses pre-commit hooks to automatically format and lint code:
# Install pre-commit hooks
pre-commit install
# Run hooks manually
pre-commit run --all-filesThe pre-commit configuration includes:
- Black: Code formatting (79 character line length)
- isort: Import sorting
- flake8: Linting and style checking
- detect-secrets: Scans staged changes for accidentally committed secrets
All public functions and classes should have comprehensive docstrings:
async def MyAPIFunction(req: func.HttpRequest) -> func.HttpResponse:
"""
Brief description of what the function does.
Detailed description with more context about the function's purpose,
how it fits into the larger system, and any important notes.
Args:
req (func.HttpRequest): The HTTP request with parameters:
- param1 (str): Description of parameter
- param2 (int, optional): Description of optional parameter
Returns:
func.HttpResponse: JSON response with:
- 200: Success with data
- 400: Bad request
- 500: Server error
Example:
GET /api/MyAPIFunction?param1=value
Response:
{
"data": "result",
"status": "success"
}
"""Documentation is built using Jupyter Book:
cd docs
jb build .Write unit tests for all core functionality:
import pytest
from mymodule import MyClass
def test_my_function():
"""Test that MyClass.my_method works correctly."""
instance = MyClass()
result = instance.my_method("input")
assert result == "expected_output"Test API endpoints and workflows end-to-end.
- Fork the repository and create a feature branch
- Write comprehensive docstrings for all new functions
- Add unit tests for new functionality
- Run pre-commit hooks to ensure code quality
- Update documentation if needed
- Submit a pull request with a clear description
Use descriptive branch names:
feature/add-new-endpointbugfix/fix-upload-issuedocs/improve-api-documentation
Write clear, descriptive commit messages:
Add comprehensive docstrings to API functions
- Added detailed docstrings to all main API endpoints
- Included parameter descriptions and response codes
- Added usage examples for complex endpoints