codext 1.15.11__tar.gz → 1.16.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. codext-1.16.0/.github/ISSUE_TEMPLATE/add-encoding.yml +21 -0
  2. codext-1.16.0/.github/copilot-instructions.md +81 -0
  3. codext-1.16.0/.github/prompts/add_codec.prompt.md +17 -0
  4. codext-1.16.0/.github/pull_request_template.md +8 -0
  5. {codext-1.15.11 → codext-1.16.0}/.github/workflows/python-package.yml +43 -28
  6. {codext-1.15.11 → codext-1.16.0}/LICENSE +674 -674
  7. {codext-1.15.11 → codext-1.16.0}/PKG-INFO +28 -18
  8. {codext-1.15.11 → codext-1.16.0}/README.md +27 -17
  9. {codext-1.15.11 → codext-1.16.0}/docs/mkdocs.yml +3 -2
  10. {codext-1.15.11 → codext-1.16.0}/docs/pages/enc/crypto.md +91 -0
  11. {codext-1.15.11 → codext-1.16.0}/docs/pages/enc/others.md +79 -79
  12. {codext-1.15.11 → codext-1.16.0}/docs/pages/howto.md +40 -22
  13. codext-1.16.0/docs/requirements.txt +5 -0
  14. codext-1.16.0/src/codext/VERSION.txt +1 -0
  15. {codext-1.15.11 → codext-1.16.0}/src/codext/__common__.py +7 -19
  16. {codext-1.15.11 → codext-1.16.0}/src/codext/__info__.py +16 -16
  17. {codext-1.15.11 → codext-1.16.0}/src/codext/base/__init__.py +64 -64
  18. {codext-1.15.11 → codext-1.16.0}/src/codext/base/_base.py +0 -0
  19. {codext-1.15.11 → codext-1.16.0}/src/codext/base/_base2n.py +112 -112
  20. {codext-1.15.11 → codext-1.16.0}/src/codext/base/base100.py +0 -0
  21. {codext-1.15.11 → codext-1.16.0}/src/codext/base/base122.py +0 -0
  22. {codext-1.15.11 → codext-1.16.0}/src/codext/base/base45.py +84 -84
  23. {codext-1.15.11 → codext-1.16.0}/src/codext/base/base85.py +0 -0
  24. {codext-1.15.11 → codext-1.16.0}/src/codext/base/base91.py +113 -113
  25. {codext-1.15.11 → codext-1.16.0}/src/codext/base/baseN.py +132 -132
  26. {codext-1.15.11 → codext-1.16.0}/src/codext/binary/__init__.py +8 -8
  27. {codext-1.15.11 → codext-1.16.0}/src/codext/binary/baudot.py +0 -0
  28. {codext-1.15.11 → codext-1.16.0}/src/codext/binary/bcd.py +80 -80
  29. {codext-1.15.11 → codext-1.16.0}/src/codext/binary/excess3.py +65 -65
  30. {codext-1.15.11 → codext-1.16.0}/src/codext/binary/gray.py +25 -25
  31. {codext-1.15.11 → codext-1.16.0}/src/codext/binary/manchester.py +50 -50
  32. {codext-1.15.11 → codext-1.16.0}/src/codext/binary/rotate.py +0 -0
  33. codext-1.16.0/src/codext/checksums/__init__.py +5 -0
  34. codext-1.16.0/src/codext/checksums/adler.py +17 -0
  35. codext-1.15.11/src/codext/hashing/checksums.py → codext-1.16.0/src/codext/checksums/crc.py +8 -11
  36. codext-1.16.0/src/codext/checksums/luhn.py +33 -0
  37. {codext-1.15.11 → codext-1.16.0}/src/codext/common/__init__.py +7 -7
  38. {codext-1.15.11 → codext-1.16.0}/src/codext/common/a1z26.py +60 -60
  39. {codext-1.15.11 → codext-1.16.0}/src/codext/common/dummy.py +57 -57
  40. {codext-1.15.11 → codext-1.16.0}/src/codext/common/octal.py +31 -31
  41. {codext-1.15.11 → codext-1.16.0}/src/codext/common/ordinal.py +28 -28
  42. {codext-1.15.11 → codext-1.16.0}/src/codext/compressions/__init__.py +12 -12
  43. {codext-1.15.11 → codext-1.16.0}/src/codext/compressions/gzipp.py +44 -44
  44. {codext-1.15.11 → codext-1.16.0}/src/codext/compressions/pkzip.py +0 -0
  45. {codext-1.15.11 → codext-1.16.0}/src/codext/crypto/__init__.py +14 -12
  46. {codext-1.15.11 → codext-1.16.0}/src/codext/crypto/affine.py +32 -32
  47. {codext-1.15.11 → codext-1.16.0}/src/codext/crypto/atbash.py +34 -34
  48. {codext-1.15.11 → codext-1.16.0}/src/codext/crypto/bacon.py +36 -36
  49. {codext-1.15.11 → codext-1.16.0}/src/codext/crypto/barbie.py +54 -54
  50. {codext-1.15.11 → codext-1.16.0}/src/codext/crypto/citrix.py +52 -52
  51. codext-1.16.0/src/codext/crypto/polybius.py +77 -0
  52. {codext-1.15.11 → codext-1.16.0}/src/codext/crypto/rot.py +102 -102
  53. {codext-1.15.11 → codext-1.16.0}/src/codext/crypto/scytale.py +54 -54
  54. {codext-1.15.11 → codext-1.16.0}/src/codext/crypto/shift.py +34 -34
  55. codext-1.16.0/src/codext/crypto/vigenere.py +87 -0
  56. {codext-1.15.11 → codext-1.16.0}/src/codext/crypto/xor.py +35 -35
  57. {codext-1.15.11 → codext-1.16.0}/src/codext/hashing/__init__.py +0 -1
  58. {codext-1.15.11 → codext-1.16.0}/src/codext/languages/__init__.py +12 -12
  59. {codext-1.15.11 → codext-1.16.0}/src/codext/languages/braille.py +0 -0
  60. {codext-1.15.11 → codext-1.16.0}/src/codext/languages/ipsum.py +97 -97
  61. {codext-1.15.11 → codext-1.16.0}/src/codext/languages/leetspeak.py +23 -23
  62. {codext-1.15.11 → codext-1.16.0}/src/codext/languages/morse.py +40 -40
  63. {codext-1.15.11 → codext-1.16.0}/src/codext/languages/navajo.py +35 -35
  64. {codext-1.15.11 → codext-1.16.0}/src/codext/languages/radio.py +29 -29
  65. {codext-1.15.11 → codext-1.16.0}/src/codext/languages/southpark.py +44 -44
  66. {codext-1.15.11 → codext-1.16.0}/src/codext/languages/tomtom.py +35 -35
  67. {codext-1.15.11 → codext-1.16.0}/src/codext/others/__init__.py +7 -7
  68. {codext-1.15.11 → codext-1.16.0}/src/codext/others/dna.py +42 -42
  69. {codext-1.15.11 → codext-1.16.0}/src/codext/others/kbshift.py +66 -66
  70. {codext-1.15.11 → codext-1.16.0}/src/codext/others/letters.py +91 -91
  71. {codext-1.15.11 → codext-1.16.0}/src/codext/others/markdown.py +22 -22
  72. {codext-1.15.11 → codext-1.16.0}/src/codext/stegano/__init__.py +8 -8
  73. {codext-1.15.11 → codext-1.16.0}/src/codext/stegano/hexagram.py +0 -0
  74. {codext-1.15.11 → codext-1.16.0}/src/codext/stegano/klopf.py +25 -25
  75. {codext-1.15.11 → codext-1.16.0}/src/codext/stegano/resistor.py +28 -28
  76. {codext-1.15.11 → codext-1.16.0}/src/codext/stegano/rick.py +31 -31
  77. {codext-1.15.11 → codext-1.16.0}/src/codext/stegano/sms.py +27 -27
  78. {codext-1.15.11 → codext-1.16.0}/src/codext/stegano/whitespace.py +71 -71
  79. {codext-1.15.11 → codext-1.16.0}/src/codext/web/__init__.py +4 -4
  80. {codext-1.15.11 → codext-1.16.0}/src/codext/web/html.py +0 -0
  81. {codext-1.15.11 → codext-1.16.0}/src/codext/web/url.py +29 -29
  82. {codext-1.15.11 → codext-1.16.0}/src/codext.egg-info/PKG-INFO +28 -18
  83. {codext-1.15.11 → codext-1.16.0}/src/codext.egg-info/SOURCES.txt +10 -1
  84. {codext-1.15.11 → codext-1.16.0}/tests/test_manual.py +19 -9
  85. codext-1.15.11/docs/requirements.txt +0 -6
  86. codext-1.15.11/src/codext/VERSION.txt +0 -1
  87. {codext-1.15.11 → codext-1.16.0}/.coveragerc +0 -0
  88. {codext-1.15.11 → codext-1.16.0}/.gitignore +0 -0
  89. {codext-1.15.11 → codext-1.16.0}/.readthedocs.yml +0 -0
  90. {codext-1.15.11 → codext-1.16.0}/docs/coverage.svg +0 -0
  91. {codext-1.15.11 → codext-1.16.0}/docs/pages/cli.md +0 -0
  92. {codext-1.15.11 → codext-1.16.0}/docs/pages/css/extra.css +0 -0
  93. {codext-1.15.11 → codext-1.16.0}/docs/pages/demos/using-bases.gif +0 -0
  94. {codext-1.15.11 → codext-1.16.0}/docs/pages/demos/using-codext.gif +0 -0
  95. {codext-1.15.11 → codext-1.16.0}/docs/pages/demos/using-debase.gif +0 -0
  96. {codext-1.15.11 → codext-1.16.0}/docs/pages/enc/base.md +0 -0
  97. {codext-1.15.11 → codext-1.16.0}/docs/pages/enc/binary.md +0 -0
  98. {codext-1.15.11 → codext-1.16.0}/docs/pages/enc/common.md +0 -0
  99. {codext-1.15.11 → codext-1.16.0}/docs/pages/enc/compressions.md +0 -0
  100. {codext-1.15.11 → codext-1.16.0}/docs/pages/enc/hashing.md +0 -0
  101. {codext-1.15.11 → codext-1.16.0}/docs/pages/enc/languages.md +0 -0
  102. {codext-1.15.11 → codext-1.16.0}/docs/pages/enc/stegano.md +0 -0
  103. {codext-1.15.11 → codext-1.16.0}/docs/pages/enc/web.md +0 -0
  104. {codext-1.15.11 → codext-1.16.0}/docs/pages/features.md +0 -0
  105. {codext-1.15.11 → codext-1.16.0}/docs/pages/guessing.md +0 -0
  106. {codext-1.15.11 → codext-1.16.0}/docs/pages/img/banner.png +0 -0
  107. {codext-1.15.11 → codext-1.16.0}/docs/pages/img/icon.png +0 -0
  108. {codext-1.15.11 → codext-1.16.0}/docs/pages/img/logo.png +0 -0
  109. {codext-1.15.11 → codext-1.16.0}/docs/pages/index.md +0 -0
  110. {codext-1.15.11 → codext-1.16.0}/docs/pages/manipulations.md +0 -0
  111. {codext-1.15.11 → codext-1.16.0}/pyproject.toml +0 -0
  112. {codext-1.15.11 → codext-1.16.0}/pytest.ini +0 -0
  113. {codext-1.15.11 → codext-1.16.0}/requirements.txt +0 -0
  114. {codext-1.15.11 → codext-1.16.0}/setup.cfg +0 -0
  115. {codext-1.15.11 → codext-1.16.0}/src/codext/__init__.py +0 -0
  116. {codext-1.15.11 → codext-1.16.0}/src/codext/common/cases.py +0 -0
  117. {codext-1.15.11 → codext-1.16.0}/src/codext/compressions/lz77.py +0 -0
  118. {codext-1.15.11 → codext-1.16.0}/src/codext/compressions/lz78.py +0 -0
  119. {codext-1.15.11 → codext-1.16.0}/src/codext/crypto/railfence.py +0 -0
  120. {codext-1.15.11 → codext-1.16.0}/src/codext/hashing/blake.py +0 -0
  121. {codext-1.15.11 → codext-1.16.0}/src/codext/hashing/crypt.py +0 -0
  122. {codext-1.15.11 → codext-1.16.0}/src/codext/hashing/md.py +0 -0
  123. {codext-1.15.11 → codext-1.16.0}/src/codext/hashing/mmh3.py +0 -0
  124. {codext-1.15.11 → codext-1.16.0}/src/codext/hashing/sha.py +0 -0
  125. {codext-1.15.11 → codext-1.16.0}/src/codext/hashing/shake.py +0 -0
  126. {codext-1.15.11 → codext-1.16.0}/src/codext/languages/galactic.py +0 -0
  127. {codext-1.15.11 → codext-1.16.0}/src/codext/languages/tap.py +0 -0
  128. {codext-1.15.11 → codext-1.16.0}/src/codext/macros.json +0 -0
  129. {codext-1.15.11 → codext-1.16.0}/src/codext/others/uuencode.py +0 -0
  130. {codext-1.15.11 → codext-1.16.0}/src/codext.egg-info/dependency_links.txt +0 -0
  131. {codext-1.15.11 → codext-1.16.0}/src/codext.egg-info/entry_points.txt +0 -0
  132. {codext-1.15.11 → codext-1.16.0}/src/codext.egg-info/requires.txt +0 -0
  133. {codext-1.15.11 → codext-1.16.0}/src/codext.egg-info/top_level.txt +0 -0
  134. {codext-1.15.11 → codext-1.16.0}/tests/__init__.py +0 -0
  135. {codext-1.15.11 → codext-1.16.0}/tests/test_base.py +0 -0
  136. {codext-1.15.11 → codext-1.16.0}/tests/test_common.py +0 -0
  137. {codext-1.15.11 → codext-1.16.0}/tests/test_generated.py +0 -0
@@ -0,0 +1,21 @@
1
+ name: Add new encoding
2
+ description: Propose a new encoding to be added
3
+ title: "Add new encoding: [codec]"
4
+ labels: ["enhancement"]
5
+ body:
6
+ - type: textarea
7
+ id: description
8
+ attributes:
9
+ label: Description
10
+ description: Describe the encoding, its purpose, and how it works
11
+ placeholder: Provide a clear and concise description
12
+ validations:
13
+ required: true
14
+ - type: input
15
+ id: reference
16
+ attributes:
17
+ label: Reference
18
+ description: Provide a reference URL for the encoding
19
+ placeholder: https://
20
+ validations:
21
+ required: false
@@ -0,0 +1,81 @@
1
+ # Copilot Instructions — Enhancements Only
2
+
3
+ ## Scope
4
+ This repository focuses on **adding new encoding/decoding schemes only**.
5
+
6
+ Copilot MUST:
7
+ - Propose **new codecs only**
8
+ - Avoid refactoring unrelated code
9
+ - Avoid dependency changes unless strictly required for the codec
10
+ - Avoid stylistic or formatting changes
11
+
12
+ ## Context
13
+ This project extends Python's codecs with many encoding/decoding schemes and a CLI tool.
14
+ It already includes a wide variety of bases, ciphers, compression, and niche encodings.
15
+
16
+ ## Enhancement Guidelines
17
+ When adding a new encoding, follow the guideline in the documentation at `docs/pages/howto.md`.
18
+
19
+
20
+ ## Implementation Constraints
21
+
22
+ - Pure Python preferred
23
+ - No heavy dependencies
24
+ - Deterministic transformations only
25
+ - Reversible encoding required unless explicitly documented
26
+
27
+ ## Testing
28
+
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`
32
+
33
+ ## Documentation
34
+
35
+ Each codec SHALL comply with the following structure:
36
+
37
+ ```python
38
+ # -*- coding: UTF-8 -*-
39
+ """{{codec_long_name}} Codec - {{codec_short_name}} content encoding.
40
+
41
+ {{codec_description}}
42
+
43
+ This codec:
44
+ - en/decodes strings from str to str
45
+ - en/decodes strings from bytes to bytes
46
+ - decodes file content to str (read)
47
+ - encodes file content from str to bytes (write)
48
+
49
+ Reference: {{codec_source_hyperlink}}
50
+ """
51
+ from ..__common__ import *
52
+
53
+
54
+ __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`.
66
+
67
+ ## Output Format (IMPORTANT)
68
+
69
+ When asked to add a codec, Copilot should:
70
+ 1. Briefly justify the encoding (1–2 lines)
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)
75
+
76
+ ## Explicit Non-Goals
77
+
78
+ - No refactoring
79
+ - No performance optimization passes
80
+ - No linting-only changes
81
+ - No CI/CD changes
@@ -0,0 +1,17 @@
1
+ Add a new encoding scheme to this repository.
2
+
3
+ Constraints:
4
+ - Follow copilot-instructions.md strictly
5
+ - Do not modify unrelated code
6
+ - Use existing codec patterns
7
+
8
+ Task:
9
+ Add encoding: {{ENCODING_NAME}}
10
+
11
+ Requirements:
12
+ - Implement according to ADDING_CODECS.md guideline
13
+ - Add tests if needed (if `__examples__` cannot be consistently defined)
14
+ - Add minimal documentation (in the relevant category page under `docs/pages`)
15
+
16
+ Reference:
17
+ {{LINK_OR_DESCRIPTION}}
@@ -0,0 +1,8 @@
1
+ ## Checklist
2
+ - [ ] No unrelated changes
3
+ - [ ] Codec is new (not already implemented)
4
+ - [ ] Tests included (if cannot be automated with `tests/test_generated`)
5
+ - [ ] Documentation (included in the right page in `docs/pages/enc`)
6
+
7
+ ## Description
8
+ Explain the encoding and its source.
@@ -3,27 +3,41 @@
3
3
 
4
4
  name: build
5
5
 
6
- env:
7
- package: codext
8
-
9
6
  on:
10
7
  push:
11
8
  branches: [ "main" ]
12
9
  pull_request:
13
10
  branches: [ "main" ]
14
11
 
12
+ permissions:
13
+ id-token: write
14
+ contents: read
15
+
15
16
  jobs:
17
+ prepare:
18
+ runs-on: ubuntu-latest
19
+ outputs:
20
+ package: ${{ steps.pkg.outputs.package }}
21
+ steps:
22
+ - name: Compute package name from the repository's
23
+ id: pkg
24
+ run: |
25
+ name="${GITHUB_REPOSITORY##*/}"
26
+ echo "package=${name#python-}" >> $GITHUB_OUTPUT
16
27
  build:
28
+ needs: prepare
17
29
  runs-on: ${{ matrix.os }}
18
30
  strategy:
19
31
  fail-fast: false
20
32
  matrix:
21
33
  os: [ubuntu-latest]
22
34
  python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
35
+ env:
36
+ package: ${{ needs.prepare.outputs.package }}
23
37
  steps:
24
- - uses: actions/checkout@v3
38
+ - uses: actions/checkout@v5
25
39
  - name: Set up Python ${{ matrix.python-version }}
26
- uses: actions/setup-python@v4
40
+ uses: actions/setup-python@v6
27
41
  with:
28
42
  python-version: ${{ matrix.python-version }}
29
43
  - name: Install ${{ env.package }}
@@ -37,16 +51,23 @@ jobs:
37
51
  run: |
38
52
  pytest --cov=$package
39
53
  coverage:
40
- needs: build
54
+ needs: [prepare, build]
55
+ permissions:
56
+ contents: write
41
57
  runs-on: ubuntu-latest
42
58
  env:
43
59
  cov_badge_path: docs/coverage.svg
60
+ package: ${{ needs.prepare.outputs.package }}
61
+ python_version: "3.13"
44
62
  steps:
45
- - uses: actions/checkout@v3
46
- - name: Set up Python ${{ matrix.python-version }}
47
- uses: actions/setup-python@v4
63
+ - uses: actions/checkout@v5
48
64
  with:
49
- python-version: "3.13"
65
+ fetch-depth: 0
66
+ ref: ${{ github.head_ref || github.ref_name }}
67
+ - name: Set up Python ${{ env.python_version }}
68
+ uses: actions/setup-python@v6
69
+ with:
70
+ python-version: ${{ env.python_version }}
50
71
  - name: Install ${{ env.package }}
51
72
  run: |
52
73
  python -m pip install --upgrade pip
@@ -59,32 +80,30 @@ jobs:
59
80
  pytest --cov=$package --cov-report=xml
60
81
  genbadge coverage -i coverage.xml -o $cov_badge_path
61
82
  - name: Verify Changed files
62
- uses: tj-actions/verify-changed-files@v17
83
+ uses: tj-actions/verify-changed-files@v20
63
84
  id: changed_files
64
85
  with:
65
86
  files: ${{ env.cov_badge_path }}
66
- - name: Commit files
87
+ - name: Push coverage badge
67
88
  if: steps.changed_files.outputs.files_changed == 'true'
68
89
  run: |
69
90
  git config --local user.email "github-actions[bot]@users.noreply.github.com"
70
91
  git config --local user.name "github-actions[bot]"
92
+ git fetch origin
93
+ git checkout coverage-badge || git checkout -b coverage-badge
71
94
  git add $cov_badge_path
72
- git commit -m "Updated coverage.svg"
73
- - name: Push changes
74
- if: steps.changed_files.outputs.files_changed == 'true'
75
- uses: ad-m/github-push-action@master
76
- with:
77
- github_token: ${{ secrets.github_token }}
78
- branch: ${{ github.ref }}
95
+ git diff --cached --quiet && exit 0
96
+ git commit -m "Update coverage badge"
97
+ git push origin coverage-badge --force
79
98
  deploy:
80
99
  runs-on: ubuntu-latest
81
- needs: coverage
100
+ needs: [prepare, coverage]
82
101
  steps:
83
- - uses: actions/checkout@v3
102
+ - uses: actions/checkout@v5
84
103
  with:
85
104
  fetch-depth: 0
86
105
  - name: Check for version change
87
- uses: dorny/paths-filter@v2
106
+ uses: dorny/paths-filter@v4
88
107
  id: filter
89
108
  with:
90
109
  filters: |
@@ -97,12 +116,8 @@ jobs:
97
116
  awk '{if (match($0,"## Supporters")) exit; print}' README.md > README
98
117
  mv -f README README.md
99
118
  - if: steps.filter.outputs.version == 'true'
100
- name: Build ${{ env.package }} package
119
+ name: Build ${{ needs.prepare.outputs.package }} package
101
120
  run: python3 -m pip install --upgrade build && python3 -m build
102
121
  - if: steps.filter.outputs.version == 'true'
103
- name: Upload ${{ env.package }} to PyPi
122
+ name: Publish to PyPI
104
123
  uses: pypa/gh-action-pypi-publish@release/v1
105
- with:
106
- password: ${{ secrets.PYPI_API_TOKEN }}
107
- verbose: true
108
- verify_metadata: false