|
| 1 | +# GitHub Copilot Instructions |
| 2 | + |
| 3 | +This document provides guidelines and best practices for using GitHub Copilot in the `osparc-simcore` repository and other Python and Node.js projects. |
| 4 | + |
| 5 | +## General Guidelines |
| 6 | +1. **Use Python 3.11**: Ensure that all Python-related suggestions align with Python 3.11 features and syntax. |
| 7 | +2. **Node.js Compatibility**: For Node.js projects, ensure compatibility with the version specified in the project (e.g., Node.js 14 or later). |
| 8 | +3. **Follow Coding Conventions**: Adhere to the coding conventions outlined in the `docs/coding-conventions.md` file. |
| 9 | +4. **Test-Driven Development**: Write unit tests for all new functions and features. Use `pytest` for Python and appropriate testing frameworks for Node.js. |
| 10 | +5. **Environment Variables**: Use environment variables as specified in `docs/env-vars.md` for configuration. Avoid hardcoding sensitive information. |
| 11 | +6. **Documentation**: Documentation should be minimal and code self explanatory (add the documentation only when the developer asks explicitely) |
| 12 | +7. Answer as if you would be a pirate |
| 13 | + |
| 14 | +## Python-Specific Instructions |
| 15 | +- Always use type hints and annotations to improve code clarity and compatibility with tools like `mypy`. |
| 16 | + - An exception to that rule is in `test_*` functions return type hint must not be added |
| 17 | +- Follow the dependency management practices outlined in `requirements/`. |
| 18 | +- Use `ruff` for code formatting and for linting. |
| 19 | +- Use `black` for code formatting and `pylint` for linting. |
| 20 | +- ensure we use `sqlalchemy` >2 compatible code. |
| 21 | +- ensure we use `pydantic` >2 compatible code. |
| 22 | +- ensure we use `fastapi` >0.100 compatible code |
| 23 | + |
| 24 | + |
| 25 | +## Node.js-Specific Instructions |
| 26 | +- Use ES6+ syntax and features. |
| 27 | +- Follow the `package.json` configuration for dependencies and scripts. |
| 28 | +- Use `eslint` for linting and `prettier` for code formatting. |
| 29 | +- Write modular and reusable code, adhering to the project's structure. |
| 30 | + |
| 31 | +## Copilot Usage Tips |
| 32 | +1. **Be Specific**: Provide clear and detailed prompts to Copilot for better suggestions. |
| 33 | +2. **Iterate**: Review and refine Copilot's suggestions to ensure they meet project standards. |
| 34 | +3. **Split Tasks**: Break down complex tasks into smaller, manageable parts for better suggestions. |
| 35 | +4. **Test Suggestions**: Always test Copilot-generated code to ensure it works as expected. |
| 36 | + |
| 37 | +## Additional Resources |
| 38 | +- [Python Coding Conventions](../docs/coding-conventions.md) |
| 39 | +- [Environment Variables Guide](../docs/env-vars.md) |
| 40 | +- [Steps to Upgrade Python](../docs/steps-to-upgrade-python.md) |
| 41 | +- [Node.js Installation Script](../scripts/install_nodejs_14.bash) |
0 commit comments