title | description | mode |
---|---|---|
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. |
wide |
Fork the SmartGraph repository to your GitHub account. This creates a copy of the repository that you can freely experiment with.
Clone your forked repository to your local machine using the following command, replacing <your-username>
with your GitHub username:
git clone https://github.com/<your-username>/smartgraph.git
Navigate to the cloned repository directory and create a virtual environment to isolate your project dependencies. We recommend using poetry
:
cd smartgraph
poetry install
This will install all dependencies, including development dependencies.
Activate the virtual environment:
poetry shell
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:
pytest
- 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.
Create a new branch for your feature or bug fix:
git checkout -b my-feature-branch
Make the necessary code changes, ensuring to follow the coding conventions outlined above.
Write unit tests to cover your code changes. SmartGraph uses pytest for testing. Place your tests in the appropriate directory within the tests
folder.
Run the tests to ensure that your changes haven't introduced any regressions:
pytest
Commit your changes with a descriptive commit message:
git commit -m "feat: add my new feature"
Push your branch to your forked repository:
git push origin my-feature-branch
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 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.
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.
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.