Development
This document provides a comprehensive guide for developers who want to contribute to the SmartGraph library. It covers setting up your development environment, coding conventions, testing procedures, and other relevant information.
Prerequisite You should have installed Python (version 3.11 or higher).
Getting Started
1. Fork the Repository
Fork the SmartGraph repository to your GitHub account. This creates a copy of the repository that you can freely experiment with.
2. Clone Your Fork
Clone your forked repository to your local machine using the following command, replacing <your-username>
with your GitHub username:
3. Create a Virtual Environment
Navigate to the cloned repository directory and create a virtual environment to isolate your project dependencies. We recommend using poetry
:
This will install all dependencies, including development dependencies.
4. Activate the Environment
Activate the virtual environment:
5. Run Tests
Before making any changes, ensure that the existing tests pass. SmartGraph uses pytest for testing. Run the following command from the root directory of the project:
Coding Conventions
- PEP 8 Compliance: Adhere to the PEP 8 style guide for Python code.
- Type Hints: Use type hints for function parameters and return values to improve code clarity and maintainability.
- Docstrings: Write comprehensive docstrings for all classes, methods, and functions, following the Google style guide.
- Meaningful Variable and Function Names: Use descriptive and self-explanatory names for variables, functions, and classes.
Making Changes
1. Create a New Branch
Create a new branch for your feature or bug fix:
2. Implement Your Changes
Make the necessary code changes, ensuring to follow the coding conventions outlined above.
3. Write Tests
Write unit tests to cover your code changes. SmartGraph uses pytest for testing. Place your tests in the appropriate directory within the tests
folder.
4. Run Tests
Run the tests to ensure that your changes haven’t introduced any regressions:
5. Commit Your Changes
Commit your changes with a descriptive commit message:
6. Push Your Branch
Push your branch to your forked repository:
7. Create a Pull Request
Create a pull request from your forked repository’s branch to the main
branch of the original SmartGraph repository. Provide a clear description of your changes and the problem they solve.
Documentation
Documentation is crucial for the success of any open-source project. SmartGraph uses Markdown for documentation. Ensure that your code changes are accompanied by appropriate documentation updates.
Review and Integration
Once you’ve submitted a pull request, the SmartGraph maintainers will review your code and provide feedback. Be prepared to address any comments or suggestions. Once the review process is complete and all tests pass, your changes will be merged into the main branch.
Contributing
We welcome contributions from the community! Please review our CONTRIBUTING.md
file for detailed information on how to contribute code, report bugs, and request new features. Remember to update the pyproject.toml
file when adding new dependencies, and use poetry
for managing your environment.
Was this page helpful?