Enhancement Proposal: Make Python Spack Installs Ignore User Configuration#950
Enhancement Proposal: Make Python Spack Installs Ignore User Configuration#950tgamblin merged 3 commits intospack:developfrom
Conversation
|
@xjrc: RE: solution 1, we could do what we do for The what do you think? |
|
@tgamblin: This sounds perfectly reasonable to me. The only concern that I have is that this will require updating all of the existing Python extension packages so that they use |
|
@xjrc: this would not be such a bad thing. We'd need to make sure the PR works for all the users, but we can announce this at the telcons and on the mailing list and let them try it out before we throw it in the mainline. I think that should be sufficient. |
|
@tgamblin: Okay, that sounds good to me; I'll get to work on writing this up. Thanks for your help! |
|
Please look at PR #543, which adds some functionality to CMake-based projects. A similar pattern might be useful for Python-based projects. in particular, PR #543 creates a subclass of Package called CMakePackage. Package authors using CMakePackage don't implement |
|
@tgamblin: I finished writing the code that adds the Just a few quick notes about some things that I noticed while making these changes:
@citibeth: I've looked over #543 and I think you have a good point about applying a similar subclassing approach for Python packages. My only hangup is that most Python packages just call |
|
@tgamblin: I've updated this pull request so that it no longer conflicts with the Please let me know if there are any issues with the merged code and I'll try to fix them as soon as possible! |
|
@xjrc: thanks! @lee218llnl @adamjstewart: does this work for you guys? |
|
There seem to be a lot of unnecessary changes to the Python package that don't affect how it installs nor do they solve flake8 issues. They also make it less future proof by reverting to the old Python 2 string formatting syntax. |
|
@adamjstewart: Sorry about all of the unnecessary changes; this pull request has been sitting around since before the |
|
I figured that was the cause. It would certainly make it easier to review. |
|
@adamjstewart: I've updated this pull request so that it includes changes that are less intrusive on the @tgamblin: This pull request makes the history for the |
|
@tgamblin: I just finished cleaning up the history, so this PR should be ready for merging after it has been reviewed. |
| spec['tk'].prefix.lib, spec['tcl'].prefix.lib | ||
| ]) | ||
|
|
||
| dep_pfxs = [dspec.prefix for dspec in spec.dependencies('link')] |
There was a problem hiding this comment.
Wow, this is such a nicer way of generating a list of dependencies. I'll have to keep this in mind when I'm writing other packages.
|
LGTM. Aside from running that script on all of the python extensions, I think the last thing that should be done is to edit |
|
@adamjstewart: good suggestion! @xjrc: can you change |
|
@xjrc: thanks for the implementation! |
|
@adamjstewart, @tgamlin: Thanks to both of you for your help/suggestions! I'll create a pull request for the change to |
|
Uhh, I don't think this was ready to be merged. Weren't we going to run the script that you wrote to regex replace python with setup_py for all python packages? |
|
It seems to me like the |
|
Sorry to join in late, but this all looks OK to me. I don't maintain a personal distutils config file, so this hasn't affected me in the past, but I can see this being useful for other users. |
|
@xjrc Either way, the script that you wrote doesn't need to be in the Spack repository. I thought it was just a way to show what you will run before things get merged. I'm glad it's backwards compatible regardless. |
|
@adamjstewart: My motivation for including the script was to demonstrate how I was changing each Python install (as you mentioned); I didn't really intend for it to remain in the Spack repository indefinitely. In retrospect, I think that it may have been better to just run the script and have all the changes bundled into a this PR. At any rate, I'll be sure to remove this script from Spack when I submit a new PR that finalizes the changes started here. |
…ort) (spack#950) - update llvm package recipe and patches from upstream version 12.0 - update deploy configs to enable GPU support (CUDA as well as OpenMP offload support) - Use NVIDIA GPU default arch 70 (for BB5 Volta GPUs) - Update binutils dependency in py-llvmlite with minimal changes to avoid concretiser issues - this is dependency of py-atlas-building-tools
Python's build system provides a lot of room for granular levels of customization through the use and application of user, system, and distribution configuration files. While these files are very useful for customizing Python builds, they tend to negatively impact Spack's installation processes for Python and Python extensions by adding unwanted configuration options (which can alter the destinations of Spack's installs). In order to allow Spack installations of Python libraries to coexist with these files, a solution must be implemented that allows Spack's install scripts to ignore these configuration files and all external install scripts that use Spack's Python to acknowledge them.
I've outlined a few potential solutions to this problem below:
--no-user-cfgto Each Python Extension's Install Command: This solution will require changing the most files, but will necessitate zero additional changes to Spack's infrastructure or the Python package. This solution is potentially undesirable because it requires authors for Python extension packages to acknowledge and properly account for the the fact that user configuration needs to be ignored.python_setupFunction to Python Extensions: This solution involves adding new function to Python extension modules that sets up extension files while ignoring user configurations (i.e. something that invokespython setup.py --no-user-cfg [setup-instruction] [arguments]). This solution avoids the majority of the acknowledgement problems of the previous solution (authors will still have to remember to callpython_setupinstead ofpython('setup.py', 'install')), but still requires that all the Python extension install scripts be updated.setup.cfginto Each Python Extension's Install Directory: This solution involves taking advantage of Python's hierarchy of configuration files to override user and system options. No Python extension packages need to be modified in this solution, but the Python package will need to install a file into each extension package's install directory (probably similar to thePackage.setup_dependent_packagefunction but occurring after the staging process for the dependent begins). Additionally, due to a bug in Python's configuration capture functionality, this method will require a nontrivial patch to be applied to the Pythondistutilssource code (which is probably not portable to versions of Python outside of 2.7).If anyone has any thoughts about the methods that I've outlined or has any alternative solutions (especially frequent users of the Python package like @alalazo, @citibeth, @glennpj, @tgamblin), please let me know! Given that each solution will require some fairly significant changes to Spack's Python packages, I'd like some input before I start writing anything major. Thanks!