Description
This issue is to add Python type hints to the ai_bom/sbom_generator.py module. Adding type hints improves code readability, maintainability, and helps catch potential errors during development. This is a great first issue for someone new to the project and type hinting in Python.
Acceptance Criteria
- The
ai_bom/sbom_generator.py file should have complete type hints for all functions, methods, and variables where applicable.
- The code should pass type checking using
mypy with no errors or warnings. We might need to adjust our mypy configuration in pyproject.toml if necessary to allow for certain patterns.
- The changes should not introduce any new runtime errors or break existing functionality.
- The code should still adhere to the project's coding style.
Suggested Approach
- Set up your development environment:
- Fork the
ai-bom repository.
- Clone your forked repository to your local machine.
- Set up a virtual environment (e.g., using
venv or conda).
- Install the project dependencies using
pip install -e ..
- Install
mypy using pip install mypy.
- Familiarize yourself with the
sbom_generator.py module:
- Read the code and understand its purpose and functionality. Pay close attention to the function signatures and data structures used.
- Add type hints:
- Starting from the top of the file, add type hints to function arguments, return values, and variables.
- Use appropriate types from the
typing module (e.g., List, Dict, Optional, Union) where necessary.
- Run
mypy ai_bom/sbom_generator.py to check for type errors. Address any errors or warnings reported by mypy.
- Run existing tests:
- Run the existing tests to ensure that your changes haven't broken any functionality. Use
pytest.
- If tests fail, debug and fix the issues.
- Commit and push your changes:
- Commit your changes with a descriptive commit message (e.g., "feat: Add type hints to sbom_generator.py").
- Push your changes to your forked repository.
- Create a pull request:
- Create a pull request from your forked repository to the main
ai-bom repository.
- In the pull request description, explain the changes you've made and reference this issue.
Additional Context
- Refer to the Python documentation on type hints: https://docs.python.org/3/library/typing.html
- Consider using a code editor or IDE with built-in type checking support (e.g., VS Code with the Python extension, PyCharm).
- Don't hesitate to ask questions on the issue if you're unsure about anything!
Description
This issue is to add Python type hints to the
ai_bom/sbom_generator.pymodule. Adding type hints improves code readability, maintainability, and helps catch potential errors during development. This is a great first issue for someone new to the project and type hinting in Python.Acceptance Criteria
ai_bom/sbom_generator.pyfile should have complete type hints for all functions, methods, and variables where applicable.mypywith no errors or warnings. We might need to adjust ourmypyconfiguration inpyproject.tomlif necessary to allow for certain patterns.Suggested Approach
ai-bomrepository.venvorconda).pip install -e ..mypyusingpip install mypy.sbom_generator.pymodule:typingmodule (e.g.,List,Dict,Optional,Union) where necessary.mypy ai_bom/sbom_generator.pyto check for type errors. Address any errors or warnings reported bymypy.pytest.ai-bomrepository.Additional Context