[PR #105] [MERGED] [python] expose new encoder parameters as kwargs of brotli.compress #709

Open
opened 2026-01-29 20:50:28 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/google/brotli/pull/105
Author: @anthrotype
Created: 5/8/2015
Status: Merged
Merged: 5/11/2015
Merged by: @szabadka

Base: masterHead: newparams


📝 Commits (10+)

  • 89c74d6 [brotlimodule] use keyword arguments for mode and enable_transforms;
  • b2eba12 [brotlimodule] add enable_dictionary parameter (defautls to True)
  • 6264bea [brotlimodule] add greedy_block_split parameter (defaults to False);
  • 4c1d069 [brotlimodule] add new keyword params docstring of brotli.compress
  • dbcb326 [brotlimodule] add enable_context_modeling parameter (defaults to True)
  • 6d935db [brotlimodule] add quality, lgwin and lgblock parameters
  • 3351bb0 [brotlimodule] apply uniform docstring style
  • 32c44ec [bro.py] use argparse instead of getopt
  • 4106a40 [bro.py] use new optional encoder parameters when compressing;
  • b7e8291 [bro.py] remove debug print

📊 Changes

2 files changed (+182 additions, -85 deletions)

View changed files

📝 python/bro.py (+53 -68)
📝 python/brotlimodule.cc (+129 -17)

📄 Description

I added support for the new BrotliParams to the Python extension, as requested in https://github.com/google/brotli/issues/72.
I also modified the bro.py script so that we can control these parameters from the command line.

I have a question. In the encode.h, it's written that the parameter "quality" has to be in the range from 0 to 11. I presume this range is inclusive. Now, if I set the quality between 1 and 11, the output changes accordingly. However, if I set it to 0, the output is always truncated to the same 10 bytes. Does this mean that 0 is an invalid value for the 'quality' parameter?

Thanks.

C.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/google/brotli/pull/105 **Author:** [@anthrotype](https://github.com/anthrotype) **Created:** 5/8/2015 **Status:** ✅ Merged **Merged:** 5/11/2015 **Merged by:** [@szabadka](https://github.com/szabadka) **Base:** `master` ← **Head:** `newparams` --- ### 📝 Commits (10+) - [`89c74d6`](https://github.com/google/brotli/commit/89c74d68591e0938dce6ad9f7532cdd6490ed21c) [brotlimodule] use keyword arguments for mode and enable_transforms; - [`b2eba12`](https://github.com/google/brotli/commit/b2eba122c8b965129ae002791d868898affdccdc) [brotlimodule] add enable_dictionary parameter (defautls to True) - [`6264bea`](https://github.com/google/brotli/commit/6264bea2e49db2991cc4d5e3eef89c27c19289d5) [brotlimodule] add greedy_block_split parameter (defaults to False); - [`4c1d069`](https://github.com/google/brotli/commit/4c1d06931ecf3ec063fa4ab820bb2d102413a01c) [brotlimodule] add new keyword params docstring of brotli.compress - [`dbcb326`](https://github.com/google/brotli/commit/dbcb32614af80b5cdfd773cef4017892a3a5de1d) [brotlimodule] add enable_context_modeling parameter (defaults to True) - [`6d935db`](https://github.com/google/brotli/commit/6d935db75c7d333aec5d491a1ae8516144953f97) [brotlimodule] add quality, lgwin and lgblock parameters - [`3351bb0`](https://github.com/google/brotli/commit/3351bb08e3458a21c30be39ef1448c5f9bdc976e) [brotlimodule] apply uniform docstring style - [`32c44ec`](https://github.com/google/brotli/commit/32c44ec87d80cedb5b7c76d18e5cb8b6e4bd230a) [bro.py] use argparse instead of getopt - [`4106a40`](https://github.com/google/brotli/commit/4106a406d0109a7a91819402cf158610e7acbd6b) [bro.py] use new optional encoder parameters when compressing; - [`b7e8291`](https://github.com/google/brotli/commit/b7e8291788513ffb7fcb0c2eb7be2e238cbc1f93) [bro.py] remove debug print ### 📊 Changes **2 files changed** (+182 additions, -85 deletions) <details> <summary>View changed files</summary> 📝 `python/bro.py` (+53 -68) 📝 `python/brotlimodule.cc` (+129 -17) </details> ### 📄 Description I added support for the new BrotliParams to the Python extension, as requested in https://github.com/google/brotli/issues/72. I also modified the bro.py script so that we can control these parameters from the command line. I have a question. In the encode.h, it's written that the parameter "quality" has to be in the range from 0 to 11. I presume this range is inclusive. Now, if I set the quality between 1 and 11, the output changes accordingly. However, if I set it to 0, the output is always truncated to the same 10 bytes. Does this mean that 0 is an invalid value for the 'quality' parameter? Thanks. C. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 20:50:28 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#709