-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TST/TYP: make pandas/tests private #46651
Comments
well in theory i agree it should be private but it has been public so long it's de-facto public so would need to deprecate it first (we did this a long time ago for many of the modules themselves ) but for example pandas.core itself should be private but not sure we could change this (sure we could deprecate and eventually change it) so while a good idea we couldn't actually change these till the next major version |
Is there a best way to start this deprecation process? The following works but it will also spam the CI:
from warnings import warn
warn(
"pandas.tests is considered to be private and will be renamed to pandas._tests in the future.",
FutureWarning, # or DeprecationWarning (but DeprecationWarnings will not be printed by default)
) |
i think the foo/tests/ pattern is really common, not wild about changing it |
#30741 somewhat related, if they are private and we deprecate however agree with @jbrockmendel as I think we sometimes get issues raised when we have a new release that |
It wasn't my intention to deprecate |
not ideal. could be confusing. does changing pandas/tests/__init__.py not fix the typing issue? from pandas.tests import extension
__all__ = ["extension"] |
I found a workaround: trigger the warning and catch it before calling pytest in Defining |
yeah. I'm not sure we want to change the directory name. pandas.tests.extension.base is effectively public and we should probably keep it that way. Also, if we did change the directory name, https://pandas.pydata.org/docs/dev/development/contributing_codebase.html#running-the-test-suite would need updating. Do other projects have this issue? |
It is only an "issue" for py.typed libraries that want to have the entire API (which would also include pandas/tests) to be fully typed. Alternatives could be to 1) slowly type pandas/tests, 2) mark other modules inside of pandas.tests as private (except pandas.tests.extension.base), 3) forget about it for now (far away from py.typed). |
we can do this (for typing) by doing the change suggested in #46651 (comment) and also adding similar for pandas/tests/extension/__init__.py? from https://github.com/microsoft/pyright/blob/main/docs/typed-libraries.md#library-interface
|
That doesn't seem to work, pyright doesn't report an error when doing this change. # pyright: strict
from pandas.tests import test_aggregation
import pandas.tests.test_aggregation I think A quite invasive change would be to add |
Having a |
I think the best is to keep edit: I don't think pyright will have an option to ignore tests (unless there is a PEP for it/agreement amount type checkers) microsoft/pyright#3770 |
another alternative, if we package the tests separately #30741, then they would not need to be installed to run the static type checks? |
One long-term goal of pandas is to be a py.typed library #28142 and then also to test whether the entire public API is typed #39813.
When running
pyright --ignoreexternal --verifytypes pandas
pandas 1.4.1 achieves a type completeness score of around 10%. If pandas/tests were marked as private, it would jump to around 40%! I assume the tests shouldn't be part of the public API.It seems that the only way to make
pandas/tests
private is to rename it topandas/_tests
. This is a simple change, but I want to open this issue first, as it might be a slightly controversial change.The text was updated successfully, but these errors were encountered: