tamp 2.2.0__tar.gz → 2.2.2__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 (29) hide show
  1. {tamp-2.2.0 → tamp-2.2.2}/PKG-INFO +2 -2
  2. {tamp-2.2.0 → tamp-2.2.2}/pyproject.toml +4 -4
  3. {tamp-2.2.0 → tamp-2.2.2}/tamp/__init__.py +1 -1
  4. {tamp-2.2.0 → tamp-2.2.2}/tamp/_c_src/tamp/common.c +6 -6
  5. {tamp-2.2.0 → tamp-2.2.2}/tamp/_c_src/tamp/common.h +10 -0
  6. {tamp-2.2.0 → tamp-2.2.2}/tamp/_c_src/tamp/compressor.c +13 -8
  7. {tamp-2.2.0 → tamp-2.2.2}/tamp/_c_src/tamp/decompressor.c +1 -1
  8. {tamp-2.2.0 → tamp-2.2.2}/LICENSE +0 -0
  9. {tamp-2.2.0 → tamp-2.2.2}/README.md +0 -0
  10. {tamp-2.2.0 → tamp-2.2.2}/build.py +0 -0
  11. {tamp-2.2.0 → tamp-2.2.2}/tamp/__init__.pyi +0 -0
  12. {tamp-2.2.0 → tamp-2.2.2}/tamp/__main__.py +0 -0
  13. {tamp-2.2.0 → tamp-2.2.2}/tamp/_c_build_dictionary.pyx +0 -0
  14. {tamp-2.2.0 → tamp-2.2.2}/tamp/_c_common.pxd +0 -0
  15. {tamp-2.2.0 → tamp-2.2.2}/tamp/_c_common.pyx +0 -0
  16. {tamp-2.2.0 → tamp-2.2.2}/tamp/_c_compressor.pyx +0 -0
  17. {tamp-2.2.0 → tamp-2.2.2}/tamp/_c_decompressor.pyx +0 -0
  18. {tamp-2.2.0 → tamp-2.2.2}/tamp/_c_src/tamp/compressor.h +0 -0
  19. {tamp-2.2.0 → tamp-2.2.2}/tamp/_c_src/tamp/compressor_find_match_desktop.c +0 -0
  20. {tamp-2.2.0 → tamp-2.2.2}/tamp/_c_src/tamp/decompressor.h +0 -0
  21. {tamp-2.2.0 → tamp-2.2.2}/tamp/cli/__init__.py +0 -0
  22. {tamp-2.2.0 → tamp-2.2.2}/tamp/cli/build_dictionary.py +0 -0
  23. {tamp-2.2.0 → tamp-2.2.2}/tamp/cli/main.py +0 -0
  24. {tamp-2.2.0 → tamp-2.2.2}/tamp/compressor.py +0 -0
  25. {tamp-2.2.0 → tamp-2.2.2}/tamp/compressor_viper.py +0 -0
  26. {tamp-2.2.0 → tamp-2.2.2}/tamp/ctamp.pxd +0 -0
  27. {tamp-2.2.0 → tamp-2.2.2}/tamp/decompressor.py +0 -0
  28. {tamp-2.2.0 → tamp-2.2.2}/tamp/decompressor_viper.py +0 -0
  29. {tamp-2.2.0 → tamp-2.2.2}/tamp/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tamp
3
- Version: 2.2.0
3
+ Version: 2.2.2
4
4
  Summary:
5
5
  Home-page: https://github.com/BrianPugh/tamp
6
6
  License: Apache-2.0
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Programming Language :: Python :: 3.13
16
16
  Provides-Extra: cli
17
17
  Requires-Dist: cyclopts (>=1.0.0) ; extra == "cli"
18
- Requires-Dist: rich (>=13.0.0) ; extra == "cli"
18
+ Requires-Dist: rich (>=15.0.0) ; extra == "cli"
19
19
  Project-URL: Repository, https://github.com/BrianPugh/tamp
20
20
  Description-Content-Type: text/markdown
21
21
 
@@ -9,7 +9,7 @@ style = "semver"
9
9
 
10
10
  [tool.poetry]
11
11
  name = "tamp"
12
- version = "2.2.0" # Do not change, let poetry-dynamic-versioning handle it.
12
+ version = "2.2.2" # Do not change, let poetry-dynamic-versioning handle it.
13
13
  homepage = "https://github.com/BrianPugh/tamp"
14
14
  repository = "https://github.com/BrianPugh/tamp"
15
15
  license = "Apache-2.0"
@@ -36,7 +36,7 @@ tamp = "tamp.cli.main:run_app"
36
36
  # Be as loose as possible if writing a library.
37
37
  python = "^3.9"
38
38
  cyclopts = {version = ">=1.0.0", optional = true}
39
- rich = {version = ">=13.0.0", optional = true}
39
+ rich = {version = ">=15.0.0", optional = true}
40
40
 
41
41
  [tool.poetry.extras]
42
42
  cli = ["cyclopts", "rich"]
@@ -44,7 +44,7 @@ cli = ["cyclopts", "rich"]
44
44
  [tool.poetry.group.docs.dependencies]
45
45
  sphinx = ">=4.5.0"
46
46
  sphinx_rtd_theme = ">=3.0.0"
47
- gitpython = ">=3.1.31"
47
+ gitpython = ">=3.1.49"
48
48
  sphinx-copybutton = ">=0.5.2"
49
49
  myst-parser = {extras = ["linkify"], version = "^3.0.1"}
50
50
 
@@ -59,7 +59,7 @@ belay = ">=0.21.3"
59
59
  tqdm = ">=4.65.0"
60
60
  matplotlib = ">=3.7.4"
61
61
  ipdb = ">=0.13.13"
62
- packaging = ">=20.0"
62
+ packaging = ">=26.1"
63
63
  mpremote = ">=1.20.0"
64
64
  cython = ">=0.29.34"
65
65
  pytest-subtests = ">=0.10.0"
@@ -1,4 +1,4 @@
1
- __version__ = "2.2.0"
1
+ __version__ = "2.2.2"
2
2
 
3
3
 
4
4
  class ExcessBitsError(Exception):
@@ -15,14 +15,14 @@
15
15
  /* Per-literal-size seed tables. All 16 entries must be unique and fit within
16
16
  * (1 << literal) - 1. literal=7,8 share the original table (all < 0x80). */
17
17
  // clang-format off
18
- static const unsigned char common_characters_8[] = {' ', 0, '0', 'e', 'i', '>', 't', 'o',
19
- '<', 'a', 'n', 's', '\n', 'r', '/', '.'};
18
+ TAMP_STATIC_CONST unsigned char common_characters_8[] = {' ', 0, '0', 'e', 'i', '>', 't', 'o',
19
+ '<', 'a', 'n', 's', '\n', 'r', '/', '.'};
20
20
  /* Common English characters, downshifted to 6 bits */
21
- static const unsigned char common_characters_6[] = {' ' & 0x3F, 'e' & 0x3F, 't' & 0x3F, 'a' & 0x3F, 'o' & 0x3F, 'i' & 0x3F, 'n' & 0x3F, 's' & 0x3F,
22
- 'h' & 0x3F, 'r' & 0x3F, 'd' & 0x3F, 'l' & 0x3F, 'c' & 0x3F, 'u' & 0x3F, 'm' & 0x3F, 'w' & 0x3F};
21
+ TAMP_STATIC_CONST unsigned char common_characters_6[] = {' ' & 0x3F, 'e' & 0x3F, 't' & 0x3F, 'a' & 0x3F, 'o' & 0x3F, 'i' & 0x3F, 'n' & 0x3F, 's' & 0x3F,
22
+ 'h' & 0x3F, 'r' & 0x3F, 'd' & 0x3F, 'l' & 0x3F, 'c' & 0x3F, 'u' & 0x3F, 'm' & 0x3F, 'w' & 0x3F};
23
23
  /* Common English characters, downshifted to 5 bits */
24
- static const unsigned char common_characters_5[] = {' ' & 0x1F, 'e' & 0x1F, 't' & 0x1F, 'a' & 0x1F, 'o' & 0x1F, 'i' & 0x1F, 'n' & 0x1F, 's' & 0x1F,
25
- 'h' & 0x1F, 'r' & 0x1F, 'd' & 0x1F, 'l' & 0x1F, 'c' & 0x1F, 'u' & 0x1F, 'm' & 0x1F, 'w' & 0x1F};
24
+ TAMP_STATIC_CONST unsigned char common_characters_5[] = {' ' & 0x1F, 'e' & 0x1F, 't' & 0x1F, 'a' & 0x1F, 'o' & 0x1F, 'i' & 0x1F, 'n' & 0x1F, 's' & 0x1F,
25
+ 'h' & 0x1F, 'r' & 0x1F, 'd' & 0x1F, 'l' & 0x1F, 'c' & 0x1F, 'u' & 0x1F, 'm' & 0x1F, 'w' & 0x1F};
26
26
  // clang-format on
27
27
 
28
28
  static inline uint32_t xorshift32(uint32_t *state) {
@@ -88,6 +88,16 @@ extern "C" {
88
88
  } while (0)
89
89
  #endif
90
90
 
91
+ /* TAMP_STATIC_CONST: declaration prefix for file-local read-only tables.
92
+ * Normally `static const`, but drops `static` on Xtensa MicroPython native
93
+ * modules, where `static const` rodata returns incorrect values.
94
+ * See micropython/micropython#14429. */
95
+ #if defined(__XTENSA__) && defined(MICROPY_ENABLE_DYNRUNTIME)
96
+ #define TAMP_STATIC_CONST const
97
+ #else
98
+ #define TAMP_STATIC_CONST static const
99
+ #endif
100
+
91
101
  /* Include stream API (tamp_compress_stream, tamp_decompress_stream).
92
102
  * Enabled by default. Disable with -DTAMP_STREAM=0 to save ~2.8KB.
93
103
  */
@@ -30,10 +30,10 @@
30
30
  #define TAMP_POLL_CONTINUE ((tamp_res)127)
31
31
 
32
32
  // encodes [min_pattern_bytes, min_pattern_bytes + 14] pattern lengths (14 = FLUSH pattern, used in secondary reads)
33
- static const uint8_t huffman_codes[] = {0x0, 0x3, 0x8, 0xb, 0x14, 0x24, 0x26, 0x2b,
34
- 0x4b, 0x54, 0x94, 0x95, 0xaa, 0x27, 0xab};
33
+ TAMP_STATIC_CONST uint8_t huffman_codes[] = {0x0, 0x3, 0x8, 0xb, 0x14, 0x24, 0x26, 0x2b,
34
+ 0x4b, 0x54, 0x94, 0x95, 0xaa, 0x27, 0xab};
35
35
  // These bit lengths pre-add the 1 bit for the 0-value is_literal flag.
36
- static const uint8_t huffman_bits[] = {0x2, 0x3, 0x5, 0x5, 0x6, 0x7, 0x7, 0x7, 0x8, 0x8, 0x9, 0x9, 0x9, 0x7, 0x09};
36
+ TAMP_STATIC_CONST uint8_t huffman_bits[] = {0x2, 0x3, 0x5, 0x5, 0x6, 0x7, 0x7, 0x7, 0x8, 0x8, 0x9, 0x9, 0x9, 0x7, 0x09};
37
37
 
38
38
  #if TAMP_EXTENDED_COMPRESS
39
39
  #define RLE_MAX_COUNT ((14 << 4) + 15 + 2) // 241
@@ -181,8 +181,10 @@ TAMP_OPTIMIZE_SIZE tamp_res tamp_compressor_init(TampCompressor* compressor, con
181
181
  #endif
182
182
  };
183
183
  if (!conf) conf = &conf_default;
184
- if (conf->window < 8 || conf->window > 15) return TAMP_INVALID_CONF;
185
- if (conf->literal < 5 || conf->literal > 8) return TAMP_INVALID_CONF;
184
+ uint8_t window_bits = conf->window;
185
+ uint8_t literal_bits = conf->literal;
186
+ if (window_bits < 8 || window_bits > 15) return TAMP_INVALID_CONF;
187
+ if (literal_bits < 5 || literal_bits > 8) return TAMP_INVALID_CONF;
186
188
  if (conf->append && (!conf->dictionary_reset || conf->use_custom_dictionary)) return TAMP_INVALID_CONF;
187
189
  #if !TAMP_EXTENDED_COMPRESS
188
190
  if (conf->extended) return TAMP_INVALID_CONF; // Extended requested but not compiled in
@@ -368,10 +370,13 @@ static TAMP_NOINLINE tamp_res write_extended_match_token(TampCompressor* compres
368
370
  res = partial_flush(compressor, output, output_size, output_written_size);
369
371
  if (TAMP_UNLIKELY(res != TAMP_OK)) return res;
370
372
 
371
- // Write to window (up to end of buffer, no wrap)
372
- uint16_t remaining = WINDOW_SIZE - compressor->window_pos;
373
+ // Write to window (up to end of buffer, no wrap).
374
+ // Local uint16_t matches tamp_window_copy signature; struct field may be uint32_t (TAMP_ESP32).
375
+ uint16_t wp = compressor->window_pos;
376
+ uint16_t remaining = WINDOW_SIZE - wp;
373
377
  uint8_t window_write = MIN(count, remaining);
374
- tamp_window_copy(compressor->window, &compressor->window_pos, position, window_write, window_mask);
378
+ tamp_window_copy(compressor->window, &wp, position, window_write, window_mask);
379
+ compressor->window_pos = wp;
375
380
 
376
381
  compressor->extended_match_count = 0; // Position reset not needed - only read when count > 0
377
382
 
@@ -26,7 +26,7 @@
26
26
  * Note: A 64-byte table with special-cased symbol 1 was tried but was ~10% slower
27
27
  * and only saved 8 bytes in final firmware due to added branch logic.
28
28
  */
29
- static const uint8_t HUFFMAN_TABLE[128] = {
29
+ TAMP_STATIC_CONST uint8_t HUFFMAN_TABLE[128] = {
30
30
  50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 85, 85, 85, 85, 122, 123, 104, 104, 86, 86,
31
31
  86, 86, 93, 93, 93, 93, 68, 68, 68, 68, 68, 68, 68, 68, 105, 105, 124, 126, 87, 87, 87, 87, 51, 51, 51, 51,
32
32
  51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes