Welcome to the Student Utility Library! This guide will help you set up the project and make your first contribution.
-
Install Python 3.8+ (if not already installed)
-
Install project dependencies:
pip install -r requirements.txt
-
Verify setup by running tests:
python -m pytest tests/ -v
Note: Tests will fail initially - this is expected! Functions need to be implemented.
-
Try the examples:
python examples/basic_usage.py
Start with reverse_string() in src/string_utils/init.py:
def reverse_string(text: str) -> str:
"""
Reverse the given string.
TODO: Implement this function
Hint: You can use string slicing with [::-1] or a loop
"""
# TODO: Implement this function
passReplace the pass statement:
def reverse_string(text: str) -> str:
"""Reverse the given string."""
return text[::-1]python -m pytest tests/test_string_utils.py::TestStringUtils::test_reverse_string -vYou've made your first contribution!
StudentUtilityLibrary/
├── src/ # Main source code
│ ├── string_utils/ # String manipulation functions
│ ├── math_utils/ # Mathematical calculations
│ ├── data_structures/ # Stack, Queue, LinkedList, etc.
│ ├── algorithms/ # Sorting, searching algorithms
│ └── file_utils/ # File operations
├── tests/ # Unit tests for all modules
├── examples/ # Usage examples and demos
├── README.md # Project overview
├── CONTRIBUTING.md # Detailed contribution guide
└── requirements.txt # Project dependencies
- String utilities:
reverse_string,count_words,capitalize_words - Math utilities:
factorial,is_prime,mean - File utilities:
read_file,write_file
- String utilities:
is_palindrome,is_anagram - Math utilities:
gcd,lcm,fibonacci - Simple algorithms:
linear_search,bubble_sort
- Data structures:
Stack,Queue,LinkedList,BinaryTree - Advanced algorithms:
merge_sort,quick_sort,binary_search - Complex file operations: CSV/JSON handling
# Run all tests
python -m pytest tests/ -v
# Run tests for specific module
python -m pytest tests/test_string_utils.py -v
# Run specific test
python -m pytest tests/test_string_utils.py::TestStringUtils::test_reverse_string -v
# Run tests with coverage
python -m pytest tests/ --cov=src --cov-report=html# Format code with black
python -m black src/ tests/ examples/
# Type checking with mypy
python -m mypy src/
# Linting with flake8
python -m flake8 src/ tests/ examples/# Run main usage examples
python examples/basic_usage.py
# Import and test individual functions
python -c "from src.string_utils import reverse_string; print(reverse_string('hello'))"- Read the docstring carefully - it explains exactly what the function should do
- Check the examples - they show expected input/output
- Look at the test cases - they define the exact behavior expected
- Pay attention to type hints - they specify parameter and return types
- Use print statements to see what your code is doing
- Test with simple inputs first before trying complex cases
- Run the specific test for your function to see detailed error messages
- Check edge cases like empty strings, zero values, etc.
- Not handling edge cases (empty inputs, negative numbers)
- Not following the exact function signature
- Implementing different behavior than described in docstring
- Not testing code before considering it complete
Your contributions are recognized through:
- Git commit history - permanent record of your work
- Test passes - green checkmarks showing working code
- Code reviews - feedback to help you improve
- Portfolio material - real open-source contributions for your resume
- Re-read the function's docstring and examples
- Look at the test cases for that function
- Search online for similar problems and solutions
- Ask questions in project discussions
- Start with an even simpler function and build up
- Python.org Tutorial
- Real Python - excellent Python tutorials
- Stack Overflow - programming Q&A
- LeetCode - algorithm practice problems
- Pick a function from the beginner list
- Open the file and find the function
- Read the docstring and understand what it should do
- Replace
passwith your implementation - Test it and fix any issues
- Move on to the next function!
Remember: Every expert was once a beginner. The goal is learning, not perfection!
Happy coding! 🚀