iceberg-python icon indicating copy to clipboard operation
iceberg-python copied to clipboard

Library public api isolation and import decoupling

Open ndrluis opened this issue 1 year ago • 7 comments

Feature Request / Improvement

Hello, when I was trying to solve the #497 issue, I noticed that we are exposing the private API and we have some imports through modules.

For example, in glue.py, we import Identifier and Properties from catalog instead of importing from typedef. Another case is in test_writes.py, where we import Table from catalog instead of from table.

ndrluis avatar Mar 05 '24 21:03 ndrluis

@ndrluis Thanks for reporting this! I think we should fix these to import from the right module. Do you want to work on this?

HonahX avatar Mar 06 '24 06:03 HonahX

@HonahX Yes!

ndrluis avatar Mar 06 '24 11:03 ndrluis

The #505 decouple imports from

  • pyiceberg.catalog
  • pyiceberg.table
  • pyiceberg.expressions

ndrluis avatar Mar 07 '24 20:03 ndrluis

Thanks for the PR! Do you know if there are ways to do this systemically, with linters / rules? I foresee this to be an issue again as we continue to do more development.

kevinjqliu avatar Mar 07 '24 22:03 kevinjqliu

@kevinjqliu Agreed, I haven't found anything that addresses this issue or provides a warning when it occurs. It seems like something the community has accepted, but I believe it's a problem. I will open an issue on Ruff to ask about this and understand how we can write a rule.

ndrluis avatar Mar 08 '24 13:03 ndrluis

Issue to follow up https://github.com/astral-sh/ruff/issues/10300

ndrluis avatar Mar 08 '24 15:03 ndrluis

We have some news about the issue: mypy has implemented a rule that could protect us. You can find more details here: https://mypy.readthedocs.io/en/stable/config_file.html#confval-implicit_reexport. Furthermore, there is an ongoing discussion about implementing this rule in ruff.

ndrluis avatar Mar 12 '24 14:03 ndrluis

This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.

github-actions[bot] avatar Sep 09 '24 00:09 github-actions[bot]

I'll close this issue because we added the mypy linter, which solves our problem with coupling, and we have #1099 to solve the public API definition.

ndrluis avatar Sep 09 '24 12:09 ndrluis