Skip to content

ENH: Vendor cache_readonly and deprecate_kwarg from pandas private API - #9831

Merged
bashtage merged 9 commits into
statsmodels:mainfrom
Aniketsy:fix-9748-cache
Jun 14, 2026
Merged

bashtage merged 9 commits into
statsmodels:mainfrom
Aniketsy:fix-9748-cache

Conversation

@Aniketsy

@Aniketsy Aniketsy commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor
Details

Notes:

  • It is essential that you add a test when making code changes. Tests are not
    needed for doc changes.
  • When adding a new function, test values should usually be verified in another package (e.g., R/SAS/Stata).
  • When fixing a bug, you must add a test that would produce the bug in main and
    then show that it is fixed with the new code.
  • New code additions must be well formatted. Changes should pass flake8. If on Linux or OSX, you can
    verify you changes are well formatted by running
    git diff upstream/main -u -- "*.py" | flake8 --diff --isolated
    
    assuming flake8 is installed. This command is also available on Windows
    using the Windows System for Linux once flake8 is installed in the
    local Linux environment. While passing this test is not required, it is good practice and it help
    improve code quality in statsmodels.
  • Docstring additions must render correctly, including escapes and LaTeX.

Comment thread statsmodels/tools/decorators.py Fixed
Comment thread statsmodels/tools/decorators.py Fixed
@Aniketsy
Aniketsy marked this pull request as draft June 9, 2026 12:01
@bashtage

bashtage commented Jun 9, 2026

Copy link
Copy Markdown
Member

Should you vendor the pandas tests for these as well?

@Aniketsy

Aniketsy commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Should you vendor the pandas tests for these as well?

yes, i think it will be good to add tests as well, currently getting some failure, needs to fix those and then i'll update with tests as well.

@Aniketsy
Aniketsy marked this pull request as ready for review June 10, 2026 09:47
@bashtage

Copy link
Copy Markdown
Member

Could you rename decorators to _decorators so that these are marked as private? Ideally, you would also add a clear multi-line comment that states that these are private vendor versions from pandas, these are not public, and they may change at any time.

@bashtage

Copy link
Copy Markdown
Member

Some lint failures. Could you black/isort the files?

@Aniketsy

Copy link
Copy Markdown
Contributor Author

Could you rename decorators to _decorators so that these are marked as private? Ideally, you would also add a clear multi-line comment that states that these are private vendor versions from pandas, these are not public, and they may change at any time.

thanks i'll update.

@Aniketsy

Copy link
Copy Markdown
Contributor Author

Some lint failures. Could you black/isort the files?

I have a suggestion, would it make sense to add a pre-commit run. to workflow, i think this will be more easier to avoid these lint errors.

@Aniketsy

Aniketsy commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor Author

hi @bashtage previously , i forgot to update import after renaming, then i applied isort and black on all the files , i modified, and changes diff got quite large, should i push these or you have any thoughts, all those changes are formatting only,

(.venv) C:\Users\Aniket.DESKTOP-074O80J\statsmodel\statsmodels>git commit -m "update imports and apply isort/black in files"
[fix-9748-cache 14853b94e] update imports and apply isort/black in files
 50 files changed, 3212 insertions(+), 2379 deletions(-)

(.venv) C:\Users\Aniket.DESKTOP-074O80J\statsmodel\statsmodels>

@bashtage

Copy link
Copy Markdown
Member

I think you need to update statsmodels.tools.decorators to statsmodels.tools._decorators

I'm ok with the diff, but let's just find replace the others without any more reformatting with black. Should run isort though.

@Aniketsy

Copy link
Copy Markdown
Contributor Author

I think you need to update statsmodels.tools.decorators to statsmodels.tools._decorators

yes, i've updated

I'm ok with the diff, but let's just find replace the others without any more reformatting with black. Should run isort though.

sure, i've reverted the changes from black, to keep this clean

@Aniketsy

Copy link
Copy Markdown
Contributor Author

FAILED ../venv-test/lib/python3.12/site-packages/statsmodels/tsa/statespace/tests/test_save.py::test_existing_pickle - ModuleNotFoundError: No module named 'statsmodels.tools.decorators'

ahh missed this file 😿

@Aniketsy

Copy link
Copy Markdown
Contributor Author

@bashtage there were some conflicts, i've resolved those please have a look when you get chance.

@bashtage

Copy link
Copy Markdown
Member

Thanka

@bashtage
bashtage merged commit 83aed4f into statsmodels:main Jun 14, 2026
9 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.

ENH/DOC: Vendor or migrate away from pandas' Appender/Substitution docstring helpers

3 participants