Skip to content

Commit fdf16d6

Browse files
committed
šŸŽØ [Documentation] Update Copilot instructions and add GitHub configuration tips
1 parent adfff53 commit fdf16d6

File tree

2 files changed

+53
-37
lines changed

2 files changed

+53
-37
lines changed

ā€Ž.github/tips.mdā€Ž renamed to ā€Ž.github/README.mdā€Ž

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,13 @@ WARNING: do not name this file as README.md since it will be rendered in the mai
77
- ``PULL_REQUEST_TEMPLATE.md``
88
- ``ISSUE_TEMPLATE`` folder:
99
- Add [top-level syntax](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax) to ISSUE_TEMPLATE/*.md files to configure them and view them as [template in the github web](https://github.com/ITISFoundation/osparc-simcore/issues/new/choose)
10+
11+
12+
---
13+
14+
## Copilot Usage Tips
15+
16+
1. **Be Specific**: Provide clear and detailed prompts to Copilot for better suggestions.
17+
2. **Iterate**: Review and refine Copilot's suggestions to ensure they meet project standards.
18+
3. **Split Tasks**: Break down complex tasks into smaller, manageable parts for better suggestions.
19+
4. **Test Suggestions**: Always test Copilot-generated code to ensure it works as expected.

ā€Ž.github/copilot-instructions.mdā€Ž

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,58 @@ This document provides guidelines and best practices for using GitHub Copilot in
44

55
## General Guidelines
66

7-
1. **Use Python 3.11**: Ensure that all Python-related suggestions align with Python 3.11 features and syntax.
8-
2. **Node.js Compatibility**: For Node.js projects, ensure compatibility with the version specified in the project (e.g., Node.js 14 or later).
9-
3. **Follow Coding Conventions**: Adhere to the coding conventions outlined in the `docs/coding-conventions.md` file.
10-
4. **Test-Driven Development**: Write unit tests for all new functions and features. Use `pytest` for Python and appropriate testing frameworks for Node.js.
11-
5. **Environment Variables**: Use environment variables as specified in `docs/env-vars.md` for configuration. Avoid hardcoding sensitive information.
12-
6. **Documentation**: Prefer self-explanatory code; add documentation only if explicitly requested by the developer.
7+
1. **Test-Driven Development**: Write unit tests for all new functions and features. Use `pytest` for Python and appropriate testing frameworks for Node.js.
8+
2. **Environment Variables**: Use [Environment Variables Guide](../docs/env-vars.md) for configuration. Avoid hardcoding sensitive information.
9+
3. **Documentation**: Prefer self-explanatory code; add documentation only if explicitly requested by the developer.
1310

14-
## Python-Specific Instructions
11+
---
1512

16-
- Always use type hints and annotations to improve code clarity and compatibility with tools like `mypy`.
17-
- An exception to that rule is in `test_*` functions return type hint must not be added
18-
- Follow the dependency management practices outlined in `requirements/`.
19-
- Use `ruff` for code formatting and for linting.
20-
- Use `black` for code formatting and `pylint` for linting.
21-
- ensure we use `sqlalchemy` >2 compatible code.
22-
- ensure we use `pydantic` >2 compatible code.
23-
- ensure we use `fastapi` >0.100 compatible code
24-
- use f-string formatting
25-
- Only add comments in function if strictly necessary
26-
- use relative imports
27-
- imports should be at top of the file
13+
## šŸ› ļøCoding Instructions for Python in This Repository
2814

15+
Follow these rules strictly when generating Python code:
2916

30-
### Json serialization
17+
### 1. Python Version
3118

32-
- Generally use `json_dumps`/`json_loads` from `common_library.json_serialization` to built-in `json.dumps` / `json.loads`.
33-
- Prefer Pydantic model methods (e.g., `model.model_dump_json()`) for serialization.
19+
* Use Python 3.11: Ensure all code uses features and syntax compatible with Python 3.11.
3420

21+
### 2. **Type Annotations**
3522

36-
## Node.js-Specific Instructions
23+
* Always use full type annotations for all functions and class attributes.
24+
* ā— **Exception**: Do **not** add return type annotations in `test_*` functions.
3725

38-
- Use ES6+ syntax and features.
39-
- Follow the `package.json` configuration for dependencies and scripts.
40-
- Use `eslint` for linting and `prettier` for code formatting.
41-
- Write modular and reusable code, adhering to the project's structure.
26+
### 3. **Code Style & Formatting**
4227

43-
## Copilot Usage Tips
28+
* Follow [Python Coding Conventions](../docs/coding-conventions.md) **strictly**.
29+
* Format code with `black`.
30+
* Lint code with `ruff` and `pylint`.
4431

45-
1. **Be Specific**: Provide clear and detailed prompts to Copilot for better suggestions.
46-
2. **Iterate**: Review and refine Copilot's suggestions to ensure they meet project standards.
47-
3. **Split Tasks**: Break down complex tasks into smaller, manageable parts for better suggestions.
48-
4. **Test Suggestions**: Always test Copilot-generated code to ensure it works as expected.
32+
### 4. **Library Compatibility**
4933

50-
## Additional Resources
34+
Ensure compatibility with the following library versions:
5135

52-
- [Python Coding Conventions](../docs/coding-conventions.md)
53-
- [Environment Variables Guide](../docs/env-vars.md)
54-
- [Pydantic Annotated fields](../docs/llm-prompts/pydantic-annotated-fields.md)
55-
- [Steps to Upgrade Python](../docs/steps-to-upgrade-python.md)
36+
* `sqlalchemy` ≄ 2.x
37+
* `pydantic` ≄ 2.x
38+
* `fastapi` ≄ 0.100
39+
40+
41+
### 5. **Code Practices**
42+
43+
* Use `f-string` formatting for all string interpolation except for logging message strings.
44+
* Use **relative imports** within the same package/module.
45+
* Place **all imports at the top** of the file.
46+
* Add comments **only when the code is not self-explanatory**.
47+
48+
49+
### 6. **JSON Serialization**
50+
51+
* Prefer `json_dumps` / `json_loads` from `common_library.json_serialization` instead of the built-in `json.dumps` / `json.loads`.
52+
* When using Pydantic models, prefer methods like `model.model_dump_json()` for serialization.
53+
54+
---
55+
56+
## šŸ› ļøCoding Instructions for Node.js in This Repository
57+
58+
* Use ES6+ syntax and features.
59+
* Follow the `package.json` configuration for dependencies and scripts.
60+
* Use `eslint` for linting and `prettier` for code formatting.
61+
* Write modular and reusable code, adhering to the project's structure.

0 commit comments

Comments
Ā (0)