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

Clean up python import statements #2223

Open
3 of 12 tasks
k-ye opened this issue Mar 20, 2021 · 0 comments
Open
3 of 12 tasks

Clean up python import statements #2223

k-ye opened this issue Mar 20, 2021 · 0 comments
Assignees
Labels
python Python engineering related refactor Refactor of API or codebases

Comments

@k-ye
Copy link
Member

k-ye commented Mar 20, 2021

Explicit is better than implicit. -- PEP20

  • Try to avoid import taichi as ti
    • Using public APIs may be an exception?
  • No more from xx import *
    • Right now almost all the symbols (public API + implementation) are exposed to the top level package . This needs to be cleaned up to a point where only the public APIs are in taichi.
  • Remove all the aliases of taichi.core.util.ti_core
  • Move most of the imports to the top of the file
  • Avoid cyclic import as much as possible. While this is allowed, it potentially introduces lots of initialization ordering problems. (e.g. https://stackoverflow.com/a/746067/12003165)
  • Use isort or other similar tools to re-format the import statements. Additionally, add this to ti format
  • Do not match the taichi functions based on string literals in transformer.py.
  • ...
@k-ye k-ye added the python Python engineering related label Mar 24, 2021
@k-ye k-ye mentioned this issue Jun 3, 2021
43 tasks
@ljcc0930 ljcc0930 self-assigned this Jul 12, 2021
@k-ye k-ye added the refactor Refactor of API or codebases label Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Python engineering related refactor Refactor of API or codebases
Projects
None yet
Development

No branches or pull requests

3 participants