Skip to content

[REFACTOR]: Remove repetitive code. Remove dead Python 3.8 code. Add …#857

Merged
genedan merged 7 commits into
mainfrom
#856-init-cleanup
May 27, 2026
Merged

[REFACTOR]: Remove repetitive code. Remove dead Python 3.8 code. Add …#857
genedan merged 7 commits into
mainfrom
#856-init-cleanup

Conversation

@genedan
Copy link
Copy Markdown
Collaborator

@genedan genedan commented May 26, 2026

Summary of Changes

Remove repetitive code. Remove dead Python 3.8 code. Add missing unit tests.

Repetitive code would be variables like _DT64_DTYPE which then get assigned to something like DT64_DTYPE. Rewrite reset_option to remove copy-pasted code from initialization.

Related GitHub Issue(s)

Partially addresses #856
Closes #862

Additional Context for Reviewers

  • I passed tests locally for both code (uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)

Note

Medium Risk
DT64_DTYPE now stores .dtype.name instead of str(dtype), which could affect datetime casting in core triangle code if the string form differs from before; otherwise changes are mostly internal refactor and test infrastructure.

Overview
Refactors Options from class-level defaults into instance initialization, documents get_option / set_option / reset_option, and makes reset_option call __init__() instead of duplicating default assignments. DT64_DTYPE is now derived via .dtype.name (dropping module-level _DT64_DTYPE / _ULT_VAL), and __version__ always uses importlib.metadata (Python 3.8 importlib_metadata fallback removed).

conftest.py centralizes sample-triangle fixtures in _sample_fixture, yielding triangles with backend setup/teardown instead of repeating ARRAY_BACKEND logic per fixture.

test_utilities.py expands coverage for options defaults, get/set consistency, reset_option (with teardown), and deprecation warnings on array_backend / auto_sparse.

Reviewed by Cursor Bugbot for commit 70fe2a5. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.16%. Comparing base (9e833f6) to head (70fe2a5).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #857      +/-   ##
==========================================
+ Coverage   86.94%   87.16%   +0.21%     
==========================================
  Files          86       86              
  Lines        4994     5047      +53     
  Branches      644      648       +4     
==========================================
+ Hits         4342     4399      +57     
+ Misses        462      457       -5     
- Partials      190      191       +1     
Flag Coverage Δ
unittests 87.16% <100.00%> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@genedan
Copy link
Copy Markdown
Collaborator Author

genedan commented May 26, 2026

Updated to close #862 which was a bug I discovered while trying to write the tests.

Copy link
Copy Markdown
Collaborator

@henrydingliu henrydingliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly clean-up of current code. i assume more enhancements will come through #860

@henrydingliu
Copy link
Copy Markdown
Collaborator

does it also address #863?

@genedan
Copy link
Copy Markdown
Collaborator Author

genedan commented May 27, 2026

yeah

@genedan genedan merged commit 2334029 into main May 27, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Add teardown code to reset backend in sample fixtures

2 participants