[v2][br-utils] Upgrade to latest API - #65
Conversation
- Changed project description to clarify the purpose of the package. - Updated dependencies to their latest compatible versions. Co-authored-by: Cursor Agent <cursoragent@cursor.com>
…on and structure - Added comprehensive docstrings to `BrUtils`, `CnpjUtils`, and `CpfUtils` for better clarity on usage and options. - Introduced new utility functions for resolving CPF and CNPJ instances. - Re-exported relevant classes and exceptions in the CNPJ and CPF modules for easier access. - Updated the `__init__.py` files to include descriptions and default instances. Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
💤 Files with no reviewable changes (2)
📝 WalkthroughWalkthroughBrUtils now supports nested CPF/CNPJ configuration, property-based replacement of bundled utils, expanded public re-exports, updated package metadata and pytest discovery, new spec-style coverage, and rewritten English/Portuguese documentation for the v2 API. ChangesBrUtils v2 upgrade
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related issues
Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/br-utilities/pyproject.toml`:
- Around line 75-78: Pytest is configured to look for describe-style names, but
nested describe/it blocks in the new *.spec.py files will not be collected
without a describe-style plugin. Update the test setup for br-utilities so the
pytest configuration in pyproject.toml is paired with a plugin such as
pytest-describe, and make sure that plugin is added to the package’s test
dependencies so nested describe_* / it_* tests are actually discovered.
In `@packages/br-utilities/README.md`:
- Around line 182-183: The README documentation for BrUtils has incorrect
__slots__ names; update the __slots__ description to match the actual private
slot names used by the BrUtils class in br_utils.py. Refer to the BrUtils class
and its cpf/cnpj properties, and change the text from public slot names to the
private slot layout so the documented class structure is accurate.
In `@packages/br-utilities/README.pt.md`:
- Around line 182-183: The documented __slots__ values for BrUtils are
incorrect; update the README entry to match the private slots used by the
BrUtils class in br_utils.py. Keep the description aligned with the actual
implementation by referring to the _cpf and _cnpj slot names, and ensure the
surrounding cpf/cnpj getter-setter documentation still accurately describes the
public properties.
In `@packages/br-utilities/src/br_utils/br_utils.py`:
- Around line 28-46: The _resolve_cpf and _resolve_cnpj helpers in br_utils.py
duplicate the same instance-check/None-check/constructor pattern. Refactor them
into a single shared generic resolver that takes the target utils class as a
parameter, then have both _resolve_cpf and _resolve_cnpj delegate to it while
preserving the current behavior for CpfUtils, CnpjUtils, and Mapping inputs.
- Around line 166-170: The example in the br_utils documentation is using an
unsupported direct assignment on CnpjGenerator. Update the referenced setter
example to go through utils.cnpj.generator.options.type instead of
utils.cnpj.generator.type, since CnpjGenerator exposes options rather than a
top-level type property.
- Around line 209-213: The guidance in the CPF utilities docs uses the wrong API
for toggling the formatter hidden setting. Update the example in the
CpfFormatter-related text to reference the formatter’s options object, using
utils.cpf.formatter.options.hidden instead of utils.cpf.formatter.hidden, so the
instruction matches the actual exposed property on CpfFormatter.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: cd979b72-47b7-4acb-941e-25585d104c5f
📒 Files selected for processing (17)
packages/br-utilities/CHANGELOG.mdpackages/br-utilities/README.mdpackages/br-utilities/README.pt.mdpackages/br-utilities/pyproject.tomlpackages/br-utilities/src/br_utils/__init__.pypackages/br-utilities/src/br_utils/br_utils.pypackages/br-utilities/src/br_utils/cnpj/__init__.pypackages/br-utilities/src/br_utils/cpf/__init__.pypackages/br-utilities/tests/br_utils.spec.pypackages/br-utilities/tests/br_utils_cnpj_test.pypackages/br-utilities/tests/br_utils_cpf_test.pypackages/br-utilities/tests/br_utils_init_test.pypackages/br-utilities/tests/br_utils_reexports_test.pypackages/br-utilities/tests/cnpj.spec.pypackages/br-utilities/tests/conftest.pypackages/br-utilities/tests/cpf.spec.pypackages/br-utilities/tests/package.spec.py
💤 Files with no reviewable changes (5)
- packages/br-utilities/tests/conftest.py
- packages/br-utilities/tests/br_utils_cpf_test.py
- packages/br-utilities/tests/br_utils_reexports_test.py
- packages/br-utilities/tests/br_utils_init_test.py
- packages/br-utilities/tests/br_utils_cnpj_test.py
…and CNPJ Adjustment as per @coderabbitai review comment at #65 (comment). Co-authored-by: CodeRabbit AI <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Fix as per @coderabbitai review comment at #65 (comment). Co-authored-by: CodeRabbit AI <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Fix as per @coderabbitai review comment at #65 (comment). Co-authored-by: CodeRabbit AI <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
…and CNPJ Adjustment as per @coderabbitai review comment at #65 (comment). Co-authored-by: CodeRabbit AI <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Fix as per @coderabbitai review comment at #65 (comment). Co-authored-by: CodeRabbit AI <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Fix as per @coderabbitai review comment at #65 (comment). Co-authored-by: CodeRabbit AI <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Summary by CodeRabbit
br_utilssingleton and a unifiedBrUtilsfaçade for CPF/CNPJ utilities.cpf_fmt/cpf_gen/cpf_val,cnpj_fmt/cnpj_gen/cnpj_val) are no longer re-exported from the package root; import them frombr_utils.cpf/br_utils.cnpj.BrUtilssetup/option configuration behavior and validation defaults.