You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+41-20Lines changed: 41 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,19 +10,12 @@ Copilot MUST:
10
10
- Avoid stylistic or formatting changes
11
11
12
12
## Context
13
-
This project extends Python's codecs with many encoding/decoding schemes and CLI tools.
13
+
This project extends Python's codecs with many encoding/decoding schemes and a CLI tool.
14
14
It already includes a wide variety of bases, ciphers, compression, and niche encodings.
15
15
16
16
## Enhancement Guidelines
17
+
When adding a new encoding, follow the guideline in the documentation at `docs/pages/howto.md`.
17
18
18
-
When adding a new encoding:
19
-
1. Check if it already exists in the project
20
-
2. Follow the existing codec structure and naming conventions
21
-
3. Provide:
22
-
-`encode()` implementation
23
-
-`decode()` implementation
24
-
- Registration into the codec registry
25
-
4. Ensure CLI compatibility (if applicable)
26
19
27
20
## Implementation Constraints
28
21
@@ -33,28 +26,56 @@ When adding a new encoding:
33
26
34
27
## Testing
35
28
36
-
Every new codec MUST include:
37
-
-Unit tests (encode/decode roundtrip)
38
-
- Edge cases (empty input, binary data if applicable)
29
+
Every new codec:
30
+
-SHOULD include a list of `__examples__` that tells the automated tests what encoding/decoding transformations need to be verified ; it this cannot be made, unit tests (encode/decode roundtrip) SHALL be provided in `tests/test_manual.py`
31
+
- Edge cases (empty input, binary data if applicable), either in the `__examples__` list or in the explicit tests in `tests/test_manual.py`
39
32
40
33
## Documentation
41
34
42
-
Each codec must include:
43
-
- Short description
44
-
- Reference (standard, RFC, or algorithm source)
45
-
- Example usage
35
+
Each codec SHALL comply with the following structure:
__examples__ = {<<dictionary of examples with, as keys, a special format detailed hereafter and, as values, a dictionary mapping source to destination values (see sectino _Self-generated tests_)>>}
55
+
<<optional list of valid codec names to be used with the guessing mode (see _Codec names for the guessing mode_), in format "__guess__ = [...]">>]
56
+
57
+
58
+
<<constants here, including ENCMAP if the codec is a simple mapping (see section _Case 2: Encoding map_)>>
59
+
<<functions here, if the codec requires some additional logic, i.e. when it is not a mapping (see section _Case 1: Generic encoding definition_)>>
60
+
61
+
62
+
<<put the right add function (see section _Which `add` function ?_) here with its relevant parameters (see section _Generic arguments_)>>
63
+
```
64
+
65
+
In this template, `{{ ... }}` enclosures indicate codec's properties and `<< ... >>``enclosures indicate placeholder actions referring to steps from the documentation about how to make a codec at `docs/pages/howto.md`.
46
66
47
67
## Output Format (IMPORTANT)
48
68
49
69
When asked to add a codec, Copilot should:
50
70
1. Briefly justify the encoding (1–2 lines)
51
-
2. Provide full implementation
52
-
3. Provide tests
53
-
4. Provide documentation snippet
71
+
2. Provide full implementation (according to section _Adding a new codec to `codext`_ of the documentation at `docs/pages/howto.md`)
72
+
3. Provide tests (according to section _Self-generated tests_)
73
+
4. Add it to the `README.md` of the repository
74
+
5. Propose the update of the documentation (under the relevant page for the category of codec)
0 commit comments