We're excited that you're interested in contributing to Python React ML! This document outlines the process for contributing to this project.
- Code of Conduct
- Getting Started
- Development Setup
- Project Structure
- Development Workflow
- Testing
- Pull Request Process
- Release Process
This project adheres to a Code of Conduct. By participating, you are expected to uphold this code. Please be respectful and constructive in all interactions.
- Node.js (16.0.0 or higher)
- npm (7.0.0 or higher)
- Git
- Python 3.11+ (for testing Python models)
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/your-username/python-react-ml.git
cd python-react-ml# Install all workspace dependencies
npm install
# Build all packages
npm run build# Run type checking
npm run type-check
# Run linting
npm run lint
# Run tests
npm testpython-react-ml/
├── packages/
│ ├── core/ # Core Python execution engine
│ ├── react/ # React hooks and components
│ ├── react-native/ # React Native bridge
│ └── cli/ # CLI tools
├── examples/ # Example applications
├── docs/ # Documentation
└── tools/ # Build and development tools
graph TD
A[core] --> B[react]
A --> C[react-native]
D[cli] -.-> A
feature/your-feature-name- New featuresfix/issue-description- Bug fixesdocs/documentation-update- Documentation updateschore/maintenance-task- Maintenance tasks
- Create a feature branch:
git checkout -b feature/your-feature-name-
Make your changes in the appropriate package(s)
-
Test your changes:
npm run build
npm test- Commit your changes:
git add .
git commit -m "feat: add your feature description"We follow the Conventional Commits specification:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changesstyle:- Code style changes (formatting, etc.)refactor:- Code refactoringtest:- Adding or updating testschore:- Maintenance tasks
Examples:
feat(react): add useModel hook
fix(core): resolve memory leak in Python engine
docs: update installation instructions
test(cli): add bundle command tests
# Run all tests
npm test
# Run tests for specific package
npm test --workspace=packages/core
# Run tests in watch mode
npm run test:watchMaintain test coverage above 80%. Run coverage report:
npm run test:coverage- Place test files next to source files with
.test.tsextension - Use descriptive test names
- Test both happy path and error cases
- Mock external dependencies appropriately
Example:
// useModel.test.ts
import { renderHook } from '@testing-library/react-hooks';
import { useModel } from './useModel';
describe('useModel', () => {
it('should load model successfully', async () => {
const { result, waitForNextUpdate } = renderHook(() =>
useModel('/test-model.bundle.zip')
);
expect(result.current.status).toBe('loading');
await waitForNextUpdate();
expect(result.current.status).toBe('ready');
expect(result.current.model).toBeTruthy();
});
});- Ensure all tests pass
- Update documentation if needed
- Add changeset if your changes affect the public API:
npx changeset- Ensure your code follows the project's style guidelines
## Description
Brief description of what this PR does.
## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
## Testing
- [ ] Tests pass locally
- [ ] Added/updated tests for changes
- [ ] Manual testing completed
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] No merge conflicts- Automated checks must pass (CI/CD)
- At least one maintainer approval required
- Address all review feedback
- Keep PR focused and reasonably sized
- Rebase if requested to maintain clean history
Releases are handled by maintainers using Changesets:
- Changes accumulate as changesets
- Version bump PR is created automatically
- Maintainer merges version bump PR
- Packages are automatically published to npm
When making changes that affect the public API:
npx changesetFollow the prompts to:
- Select affected packages
- Choose version bump type (patch/minor/major)
- Describe the changes
For active development:
# Watch mode for TypeScript compilation
npm run dev --workspace=packages/core
# Run example with hot reload
npm run dev:react-example- Use
console.logfor simple debugging - Use browser devtools for React components
- Use Node.js debugger for CLI tools
- Add debug logs to Python worker for Pyodide issues
When working on the core Python engine:
- Test with small Python snippets first
- Check Pyodide compatibility for new packages
- Monitor memory usage in web workers
- Handle async operations carefully
TypeScript errors in packages:
# Clean build cache
npm run clean
npm run buildModule resolution errors:
# Reinstall dependencies
rm -rf node_modules package-lock.json
npm installTests failing after changes:
# Update snapshots if needed
npm test -- --updateSnapshot
# Clear test cache
npm test -- --clearCache- GitHub Discussions: Ask questions and share ideas
- GitHub Issues: Report bugs or request features
- Discord: Join our community chat (link in README)
- Email: maintainers@python-react-ml.dev
Look for issues labeled good-first-issue or help-wanted:
- Documentation improvements
- Example applications
- Test coverage improvements
- CLI usability enhancements
- Error message improvements
Thank you for contributing to Python React ML! 🎉