-
Notifications
You must be signed in to change notification settings - Fork 488
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
Improve build process for PJRT plugins #6314
Conversation
e4c3d85
to
ef4016c
Compare
baf70be adds the CUDA plugin to the CI build, but the default behavior will remain the same. If it unnecessarily extends the build time, I'll revert it. |
This reverts commit baf70be.
The build failed, so I reverted the change. I'll debug this in a future PR. |
IS_DARWIN = (platform.system() == 'Darwin') | ||
IS_WINDOWS = sys.platform.startswith('win') | ||
IS_LINUX = (platform.system() == 'Linux') | ||
GCLOUD_KEY_FILE = os.getenv('GCLOUD_SERVICE_KEY_FILE', default='') | ||
CACHE_SILO_NAME = os.getenv('SILO_NAME', default='dev') | ||
BAZEL_JOBS = os.getenv('BAZEL_JOBS', default='') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these no longer needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OS flags are irrelevant since we only support linux. The others were moved into local variables
Note: directly running
setup.py
is now deprecated. Both plugins are now installable by runningpip install plugin/...
, which runssetuptools
/setup.py
in the background. We'll have to deal with this problem in our mainsetup.py
build soon too.setup.py
BazelExtension
andBuildBazelExtension
are not necessary for the plugins because they don't expose any functions to Python like_XLAC
does. Instead, I opted to run bazel in a subprocess before runningsetup
. According tosetuptools
's docs, the "right" way to extendsetuptools
is to add commands, but customsetup.py
commands are being deprecated (since you have to invoke it through pip). The documentation doesn't make it clear what the right thing to do here is, so I opted for the most straightforward solution. (Not to mention, the documentation about how to actually write custom commands is also sparse.)build_util
and symlink it to plugin directoriessetup.py
withpip
's build isolation, so I disabled isolation with--no-build-isolation
. The only way I see how to do this is to install our build-time library as a package, but it seems silly to create a package that will only be used to build our real packages in the same repository.The current state of Python packaging is kind of a mess. See these three blog posts for a pretty good summary of grievances with the current situation. I'm very open to feedback on this PR, since I'm not at all convinced I'm using the new tools the "right" way (if there even is one).
The bright side is,
pyproject.toml
will make it much easier to get away fromsetuptools
if we want to do that. Especially when we have to deal with our mainsetup.py
, we should look to see if any of the alternatives better support our use case with less hackery. (I did some research this week, but most alternatives, including PyPA'shatch
do not support C++ extensions).