Skip to content
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

Add arrow3 package with just empty __init__.py #290

Open
ghuls opened this issue Feb 27, 2025 · 2 comments
Open

Add arrow3 package with just empty __init__.py #290

ghuls opened this issue Feb 27, 2025 · 2 comments

Comments

@ghuls
Copy link

ghuls commented Feb 27, 2025

Currently when installing the 3 arrow3 packages, the structure looks like this:

$ ls /lib/python3.11/site-packages/arro3/
compute core  io     

When importing the modules in ipython, tab completion is not working (to find the functions in each module

In [4]: import arro3.io

In [5]: import arro3.core

In [6]: import arro3.compute

In [7]: arro3.io.<TAB> ==> no list of functions.

When importing them with an alias, tab completion works:

In [1]: import arro3.io as arro3_io

In [2]: import arro3.compute as arro3_compute

In [3]: import arro3.core as arro3_core

In [4]: arro3_io.<TAB>
 infer_csv_schema()   read_csv()           read_ipc_stream()    read_parquet()       store                write_ipc()          write_json()         write_parquet()     
 infer_json_schema()  read_ipc()           read_json()          read_parquet_async() write_csv()          write_ipc_stream()   write_ndjson()                           

When adding just an empty _init__.py at /lib/python3.11/site-packages/arro3/__init__.py, tab completion works:

In [1]: import arro3.io as arro3_io

In [2]: import arro3.compute as arro3_compute

In [3]: import arro3.core as arro3_core

In [4]: arro3.io.<TAB>
 infer_csv_schema()   read_csv()           read_ipc_stream()    read_parquet()       store                write_ipc()          write_json()         write_parquet()     
 infer_json_schema()  read_ipc()           read_json()          read_parquet_async() write_csv()          write_ipc_stream()   write_ndjson()           
# Create empty file.
$ touch /lib/python3.11/site-packages/arro3/__init__.py

It would be great if this file would exist by default, as without tab completion, it is very hard to discover the functions without looking at the documentation.

@kylebarron
Copy link
Owner

When adding just an empty _init__.py at /lib/python3.11/site-packages/arro3/__init__.py, tab completion works:

In theory, that is supposed to break namespace packaging: https://packaging.python.org/en/latest/guides/packaging-namespace-packages/#native-namespace-packages

All that is required to create a native namespace package is that you just omit __init__.py from the namespace package directory

@kylebarron
Copy link
Owner

It seems that this is a bug with how IPython handles namespace packages? If there's no __init__.py it should still look inside each directory, to see if the inner directory contains an __init__.py file.

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

No branches or pull requests

2 participants