Thank you for your interest in contributing to the Movie Booking Chatbot project! This document provides guidelines and workflows for contributing effectively.
- Code of Conduct
- Getting Started
- Development Workflow
- Pull Request Process
- Coding Standards
- Testing Guidelines
- Documentation Requirements
- Community and Communication
Our project is committed to fostering an open and welcoming environment. By participating, you agree to:
- Be respectful and inclusive in your communication
- Accept constructive feedback gracefully
- Focus on what's best for the community and users
- Show empathy towards other community members
-
Fork the repository on GitHub
-
Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/tanzu-genai-showcase.git cd tanzu-genai-showcase/py-django-crewai -
Set up the upstream remote:
git remote add upstream https://github.com/cf-toolsuite/tanzu-genai-showcase.git
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Create a
.envfile with necessary API keys (see README.md for details) -
Run migrations:
python manage.py makemigrations chatbot python manage.py migrate
Review the ARCHITECTURE.md and DEVELOPMENT.md documents to understand the project's structure, components, and workflows.
main: Production-ready codedev: Integration branch for featuresfeature/feature-name: For new feature developmentbugfix/issue-number: For bug fixesdocs/topic: For documentation improvements
-
Create a Feature Branch:
git checkout dev git pull upstream dev git checkout -b feature/your-feature-name
-
Make Changes:
- Implement your feature or fix
- Add appropriate tests
- Update documentation as needed
-
Commit Your Changes:
- Use conventional commit messages (see below)
- Keep commits focused and atomic
-
Test Locally:
- Run tests to ensure your changes work
- Check for code style compliance
-
Push to Your Fork:
git push origin feature/your-feature-name
-
Submit a Pull Request:
- Create a PR from your feature branch to the
devbranch - Complete the PR template with all required information
- Create a PR from your feature branch to the
Follow the Conventional Commits format:
type(scope): short description
longer description if needed
Where type is one of:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, no logic change)refactor: Code refactoringtest: Adding or updating testschore: Build process or auxiliary tool changes
Example:
feat(theater-finder): add timezone support for showtimes
- Adds automatic timezone detection using browser API
- Converts all showtimes to user's local timezone
- Updates UI to display timezone information
-
Before Submitting a PR:
- Ensure all tests pass
- Update documentation to reflect changes
- Add yourself to CONTRIBUTORS.md if it's your first contribution
-
PR Template:
- Fill out the entire PR template
- Link to any related issues
- Provide clear description of changes
- Include screenshots for UI changes
-
Code Review Process:
- At least one maintainer must review and approve
- Address all comments and suggestions
- Make requested changes in new commits
- Once approved, squash commits if requested
-
After Merging:
-
Delete your feature branch
-
Update your local repository:
git checkout dev git pull upstream dev
-
- Follow PEP 8 style guide
- Use 4 spaces for indentation (no tabs)
- Maximum line length of 100 characters
- Use Google-style docstrings for documentation
def function_name(param1, param2):
"""
Brief description of function.
More detailed explanation if needed.
Args:
param1: Description of param1
param2: Description of param2
Returns:
Description of return value
Raises:
ExceptionType: When and why this exception is raised
"""
# Function implementation- Use ES6+ features when possible
- Follow Airbnb JavaScript Style Guide
- Use 2 spaces for indentation in JavaScript files
- Add JSDoc comments for functions
- Use 2 spaces for indentation in HTML files
- Follow semantic HTML principles
- Maintain accessibility standards (WCAG 2.1)
- Keep templates DRY using template inheritance
- All new features must include tests
- Bug fixes should include a test that verifies the fix
- Maintain or improve test coverage percentage
-
Unit Tests:
-
Test individual components in isolation
-
Mock external dependencies
-
Example:
from django.test import TestCase from chatbot.services.movie_crew.utils import JsonParser class JsonParserTest(TestCase): def test_parse_json_output(self): input_str = '[{"title": "Test Movie"}]' result = JsonParser.parse_json_output(input_str) self.assertEqual(result[0]['title'], 'Test Movie')
-
-
Integration Tests:
-
Test interactions between components
-
Example:
from django.test import TestCase, Client from unittest.mock import patch class ChatViewTests(TestCase): def test_send_message(self): with patch('chatbot.services.movie_crew.MovieCrewManager.process_query') as mock_process: mock_process.return_value = {"response": "Test response", "movies": []} client = Client() response = client.post('/send-message/', {'message': 'Test message'}, content_type='application/json') self.assertEqual(response.status_code, 200)
-
-
Frontend Tests:
- Test UI components and interactions
- Check JavaScript functionality
# Run all tests
python manage.py test
# Run specific test file
python manage.py test chatbot.tests.test_views
# Run with coverage
coverage run --source='.' manage.py test
coverage report- All modules should have a module-level docstring
- All classes and functions should be documented
- Complex code sections should include explanatory comments
- Update README.md with new features or changed behavior
- Keep the Architecture document up to date
- Add usage examples for new features
Documentation should be updated:
- When adding new features
- When changing existing behavior
- When deprecating functionality
- When fixing bugs that affect user experience
- Use the GitHub Discussions section for questions
- Check existing issues before creating new ones
- Be specific about your problem or question
When reporting issues, please include:
- A clear, descriptive title
- Detailed steps to reproduce the problem
- Expected vs. actual behavior
- Environment details (OS, browser, etc.)
- Screenshots or logs if applicable
When suggesting features:
- Describe the problem your feature would solve
- Explain how your solution would work
- Provide examples of similar features in other projects
- Consider the impact on existing functionality
Thank you for contributing to the Movie Chatbot project! Your efforts help make this application better for everyone.