Lean
Lean copied to clipboard
Feature Python Virtual Environment Support
Description
-
Add support for python virtual environments in Lean, allowing overriding of base libraries with py venv directory config value ("python-venv") for local use or job packet var ("sPythonVirtualEnvironment") for cloud.
- Refactor AddPythonPaths to prepend to path to use for this solution
- Add static ActivatePythonVirtualEnvironment to prepend the virtual environment libraries to PythonPath, so that they are used.
-
Add "venv" virtual environment to foundation image, acts a shell install that gets mounted on later.
-
Add Jupyter Kernel for this venv to allow switching to this set of libraries
Related Issue
Closes #3189 Closes #4857 Closes #3950 Closes https://github.com/QuantConnect/Lean/issues/6291
Motivation and Context
Requires Documentation Change
How Has This Been Tested?
Regressions and unit tests ✅ Image testing successful using new foundation image with venv config value. ✅ Cloud testing ✅
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] Refactor (non-breaking change which improves implementation)
- [ ] Performance (non-breaking change which improves performance. Please add associated performance test and results)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Non-functional change (xml comments/documentation/etc)
Checklist:
- [x] My code follows the code style of this project.
- [x] I have read the CONTRIBUTING document.
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.
- [x] My branch follows the naming convention
bug-<issue#>-<description>
orfeature-<issue#>-<description>
We can review pending libraries that were blocked because of backwards compatibility/breaking changes, can see a few at https://github.com/QuantConnect/Lean/pull/5536
Rebased and ready 👍🏽
Partially replaced by https://github.com/QuantConnect/Lean/pull/6556