[Refactor] Use setup.py from root dir. #2540
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a copy of #2531 to merge into master.
A few things included in this PR:
setup.py
up to root dir so that we can runpython setup.py install/develop
.taichi_core
in build process. We used to callti.core.get_runtime_dir()/get_version_string()/libdevice_path()
fromC++, but these information are already available in build process.
python/build.py
to callsetup.py
in the root. Testedbuild/test
commands still work as expected.python setup.py install
in linux/mac instead ofsetting env
TAICHI_REPO_DIR
.into cmake. Under this new mechanism they can put everything inside
TAICHI_CMAKE_ARGS
and runsetup.py
using:TAICHI_CMAKE_ARGS="-DXXXX -DXXXX" python setup.py ..
tests/conftest.py
intotests/python
folder. I think it was abug that we skipped it when we copied
tests
folder when building wheels.To explain how build works after this PR:
In short, c++ build is no longer a separate step. It's built as an
extension when you build
taichi
python package.Developers can use
python setup.py develop
(orpip install -e .
) in root dir toinstall taichi into their current python environment. Note in
develop
mode any local changes to python files take effectimmediately. You only need to rerun this command when you change C++
code.
python setup.py install
(orpip install .
) to install taichi intoyour their current python environment. Note in
install
mode filesare copied over to python's
site-packages
so your local changes won'ttake effect until you rerun the command.
TAICHI_REPO_DIR
andPYTHONPATH
.A few known followups:
TAICHI_REPO_DIR
since I don'thave a windows machine. But it should be straightfoward to update if
someone else can help.
TAICHI_REPO_DIR
in the codebase after this PR since ourdevelopment mode has changed.
setup.py
might haveminor problems about relative paths but will leave it to debug in CI.
It should be a simple fix.
and a few other .py files under
python/taichi
in the release.ghstack-source-id: b82db21c4293c3281dbf3869cc91a927d234a4fa
Pull Request resolved: #2531
Related issue = #