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

ARROW-17106: [Python] Move init code to core and expose only API #13802

Merged
merged 5 commits into from
Aug 8, 2022
Merged

ARROW-17106: [Python] Move init code to core and expose only API #13802

merged 5 commits into from
Aug 8, 2022

Conversation

milesgranger
Copy link
Contributor

Will close ARROW-17106

Moves all current code in pyarrow/parquet/__init__.py to pyarrow/parquet/core.py and re-exports the public API from core.py inside of the init file.

@github-actions
Copy link

github-actions bot commented Aug 5, 2022

@milesgranger
Copy link
Contributor Author

Opened ARROW-17320 to refine which symbols should be designated as private/public from pyarrow.parquet. For now, to keep same functionality, re-export all from core.py

@pitrou
Copy link
Member

pitrou commented Aug 8, 2022

@github-actions crossbow submit -g python

@github-actions
Copy link

github-actions bot commented Aug 8, 2022

Revision: 5c81e45

Submitted crossbow builds: ursacomputing/crossbow @ actions-474d060045

Task Status
test-conda-python-3.10 Github Actions
test-conda-python-3.7 Github Actions
test-conda-python-3.7-hdfs-2.9.2 Github Actions
test-conda-python-3.7-hdfs-3.2.1 Github Actions
test-conda-python-3.7-kartothek-latest Github Actions
test-conda-python-3.7-kartothek-master Github Actions
test-conda-python-3.7-pandas-0.24 Github Actions
test-conda-python-3.7-pandas-latest Github Actions
test-conda-python-3.7-spark-v3.1.2 Github Actions
test-conda-python-3.8 Github Actions
test-conda-python-3.8-hypothesis Github Actions
test-conda-python-3.8-pandas-latest Github Actions
test-conda-python-3.8-pandas-nightly Github Actions
test-conda-python-3.8-spark-v3.2.0 Github Actions
test-conda-python-3.9 Github Actions
test-conda-python-3.9-dask-latest Github Actions
test-conda-python-3.9-dask-master Github Actions
test-conda-python-3.9-pandas-master Github Actions
test-conda-python-3.9-spark-master Github Actions
test-debian-11-python-3 Azure
test-fedora-35-python-3 Azure
test-ubuntu-20.04-python-3 Azure

Default is to not re-export symbols with leading _
@pitrou
Copy link
Member

pitrou commented Aug 8, 2022

@github-actions crossbow submit -g python

@github-actions
Copy link

github-actions bot commented Aug 8, 2022

Revision: 8578c01

Submitted crossbow builds: ursacomputing/crossbow @ actions-db593693db

Task Status
test-conda-python-3.10 Github Actions
test-conda-python-3.7 Github Actions
test-conda-python-3.7-hdfs-2.9.2 Github Actions
test-conda-python-3.7-hdfs-3.2.1 Github Actions
test-conda-python-3.7-kartothek-latest Github Actions
test-conda-python-3.7-kartothek-master Github Actions
test-conda-python-3.7-pandas-0.24 Github Actions
test-conda-python-3.7-pandas-latest Github Actions
test-conda-python-3.7-spark-v3.1.2 Github Actions
test-conda-python-3.8 Github Actions
test-conda-python-3.8-hypothesis Github Actions
test-conda-python-3.8-pandas-latest Github Actions
test-conda-python-3.8-pandas-nightly Github Actions
test-conda-python-3.8-spark-v3.2.0 Github Actions
test-conda-python-3.9 Github Actions
test-conda-python-3.9-dask-latest Github Actions
test-conda-python-3.9-dask-master Github Actions
test-conda-python-3.9-pandas-master Github Actions
test-conda-python-3.9-spark-master Github Actions
test-debian-11-python-3 Azure
test-fedora-35-python-3 Azure
test-ubuntu-20.04-python-3 Azure

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

Thanks for doing this. Hopefully we can soon define a curated set of exported APIs.

Comment on lines 3465 to 3467
__all__ = [
m for m, _ in inspect.getmembers(sys.modules[__name__])
]
Copy link
Member

Choose a reason for hiding this comment

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

It seems this is the same as the following, but much slower?

Suggested change
__all__ = [
m for m, _ in inspect.getmembers(sys.modules[__name__])
]
__all__ = list(__dict__)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I'm missing somehting, but I get

-> 3463 __all__ = list(__dict__)

NameError: name '__dict__' is not defined

Changing it to list(sys.modules[__name__].__dict__) and a smidgen faster. Thanks!

In [10]: N = 1_000

In [11]: # __dict__

In [12]: timeit.timeit('_ = importlib.reload(core)', number=N, globals=globals()) / N
Out[12]: 0.0005946487420005723

In [13]: # inspect.getmembers

In [14]: timeit.timeit('_ = importlib.reload(core)', number=N, globals=globals()) / N
Out[14]: 0.000692891882998083

In [15]: 

Copy link
Member

Choose a reason for hiding this comment

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

By the way, since you're using IPython, you probably know it but the %timeit macro is useful :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Recently switched to it actually, thanks for the tip! 👍

@pitrou
Copy link
Member

pitrou commented Aug 8, 2022

Hmm, the crash on the Sphinx & Numpydoc CI job is unfortunate but certainly not related I think.

@pitrou pitrou merged commit a2f3666 into apache:master Aug 8, 2022
@milesgranger milesgranger deleted the ARROW-17106 branch August 9, 2022 01:09
@ursabot
Copy link

ursabot commented Aug 9, 2022

Benchmark runs are scheduled for baseline = 210cf06 and contender = a2f3666. a2f3666 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Failed ⬇️0.03% ⬆️0.0%] test-mac-arm
[Finished ⬇️0.0% ⬆️0.0%] ursa-i9-9960x
[Finished ⬇️0.6% ⬆️0.0%] ursa-thinkcentre-m75q
Buildkite builds:
[Finished] a2f3666d ec2-t3-xlarge-us-east-2
[Finished] a2f3666d test-mac-arm
[Finished] a2f3666d ursa-i9-9960x
[Finished] a2f3666d ursa-thinkcentre-m75q
[Finished] 210cf061 ec2-t3-xlarge-us-east-2
[Failed] 210cf061 test-mac-arm
[Finished] 210cf061 ursa-i9-9960x
[Finished] 210cf061 ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants