Contributing Guide¶
Thank you for your interest in contributing to nestedutils! This guide will help you get started with development and understand how to contribute effectively.
Table of Contents¶
- Code of Conduct
- Getting Started
- Development Setup
- Making Changes
- Testing
- Submitting Changes
- Code Style
- Building the Package
- Documentation
- Additional Resources
Code of Conduct¶
This project adheres to a code of conduct that all contributors are expected to follow. Please be respectful, inclusive, and constructive in all interactions.
Getting Started¶
Before you begin, make sure you have:
- Python 3.8 or higher
- uv - A fast Python package installer and resolver
- Git installed and configured
Development Setup¶
Installing uv¶
If you don't have uv installed, you can install it using UV Getting Started
Setting Up the Development Environment¶
-
Fork the repository on GitHub
-
Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/nestedutils.git
cd nestedutils
- Add the upstream repository:
git remote add upstream https://github.com/ysskrishna/nestedutils.git
- Install the project and development dependencies using
uv:
uv sync --dev
This will:
- Create a virtual environment (if it doesn't exist)
- Install the project in editable mode
- Install all development dependencies (including pytest and documentation tools)
Making Changes¶
- Create a new branch for your changes:
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fix-name
-
Make your changes following the Code Style guidelines
-
Write or update tests for your changes (see Testing)
-
Ensure all tests pass and the code is properly formatted
Testing¶
Running Tests¶
Run all tests using pytest:
uv run pytest
Running Specific Test Files¶
uv run pytest tests/test_get.py
Running Specific Test Functions¶
uv run pytest tests/test_get.py::test_get_at_basic
Test Coverage¶
Make sure your changes include appropriate test coverage. All new features should have corresponding tests.
Writing Tests¶
- Place tests in the
tests/directory - Follow the existing test file naming convention (
test_*.py) - Test both success cases and error cases
- Include edge cases when relevant
Submitting Changes¶
- Update Documentation: If you've added new features or changed behavior, update the relevant documentation:
- Update
README.mdif the API or usage has changed - Update
CHANGELOG.mdwith a description of your changes -
Update docstrings if you've modified functions
-
Commit Your Changes: Write clear, descriptive commit messages:
git add .
git commit -m "Add feature: description of what you added"
Good commit messages: - Start with a verb in imperative mood (e.g., "Add", "Fix", "Update") - Be concise but descriptive - Reference issue numbers if applicable (e.g., "Fix #123: description")
- Push to Your Fork:
git push origin feature/your-feature-name
- Create a Pull Request:
- Go to the original repository on GitHub
- Click "New Pull Request"
- Select your fork and branch
-
Fill out the PR template with:
- Description of changes
- Related issues (if any)
- Testing performed
- Any breaking changes
-
Respond to Feedback: Be open to feedback and ready to make changes if requested
Code Style¶
General Guidelines¶
- Follow PEP 8 style guidelines
- Use meaningful variable and function names
- Keep functions focused and single-purpose
- Add docstrings to all public functions and classes
- Keep lines under 100 characters when possible
Type Hints¶
- Use type hints for function parameters and return values
- The project includes a
py.typedmarker file, so type hints are important
Documentation¶
- Use clear, concise docstrings
- Follow the existing docstring format in the codebase
- Include parameter descriptions and return value descriptions
- Add examples for complex functions
Import Organization¶
- Group imports: standard library, third-party, local
- Use absolute imports
- Keep imports at the top of the file
Building the Package¶
To build the package locally:
uv build
This will create distribution files in the dist/ directory:
- nestedutils-<version>-py3-none-any.whl (wheel)
- nestedutils-<version>.tar.gz (source distribution)
Installing the Local Package¶
To test the package installation locally:
# Install from the built wheel
uv pip install dist/nestedutils-*.whl
# Or install in editable mode for development
uv pip install -e .
Documentation¶
This project uses MkDocs with the Material theme for documentation.
Serving Documentation Locally¶
To preview the documentation locally with live reload:
uv run mkdocs serve
This will start a local development server (usually at http://127.0.0.1:8000) that automatically reloads when you make changes to the documentation files.
Building Documentation¶
To build the documentation as static HTML files:
uv run mkdocs build
This will create a site/ directory containing the static HTML files ready for deployment.
Additional Resources¶
- uv Documentation
- pytest Documentation
- Python Packaging Guide
- PEP 8 Style Guide
- Type Hints Documentation
- MkDocs Documentation
- Material for MkDocs
Questions?¶
If you have questions or need help, feel free to: - Open an issue on GitHub - Check existing issues and discussions - Review the codebase and documentation
Thank you for contributing to nestedutils! 🎉