diff --git a/.gitignore b/.gitignore index fc714fabd671..866dd076f76a 100644 --- a/.gitignore +++ b/.gitignore @@ -196,6 +196,7 @@ publish/ # NuGet Packages *.nupkg +!LocalPackages/* # The packages folder can be ignored because of Package Restore **/packages/* # except build/, which is used as an MSBuild target. @@ -204,6 +205,7 @@ publish/ #!**/packages/repositories.config # ignore sln level nuget .nuget/ +!.nuget/NuGet.config # Windows Azure Build Output csx/ diff --git a/.nuget/NuGet.config b/.nuget/NuGet.config new file mode 100644 index 000000000000..e58339a17816 --- /dev/null +++ b/.nuget/NuGet.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index c6f6e57dda03..8969eaec0fa8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ mono: solution: QuantConnect.Lean.sln before_install: - export PATH="$HOME/miniconda3/bin:$PATH" + - export PYTHONNET_PYDLL="$HOME/miniconda3/lib/libpython3.6m.so" - wget -q https://cdn.quantconnect.com/miniconda/Miniconda3-4.5.12-Linux-x86_64.sh - bash Miniconda3-4.5.12-Linux-x86_64.sh -b - rm -rf Miniconda3-4.5.12-Linux-x86_64.sh @@ -20,6 +21,7 @@ before_install: install: - nuget install NUnit.Runners -Version 3.11.1 -OutputDirectory testrunner script: + - dotnet nuget add source $TRAVIS_BUILD_DIR/LocalPackages - dotnet build /p:Configuration=Release /p:VbcToolExe=vbnc.exe /v:quiet /p:WarningLevel=1 QuantConnect.Lean.sln - mono ./testrunner/NUnit.ConsoleRunner.3.11.1/tools/nunit3-console.exe ./Tests/bin/Release/QuantConnect.Tests.dll --where "cat != TravisExclude" --labels=Off --params:log-handler=ConsoleErrorLogHandler - chmod +x ci_build_stubs.sh diff --git a/Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj b/Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj index 5aefe603d1be..f01bbc065d01 100644 --- a/Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj +++ b/Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj @@ -1,4 +1,4 @@ - + Debug AnyCPU @@ -45,30 +45,8 @@ - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\win\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\linux\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\osx\Python.Runtime.dll - - - - + @@ -82,7 +60,6 @@ - diff --git a/Algorithm.Framework/QuantConnect.Algorithm.Framework.csproj b/Algorithm.Framework/QuantConnect.Algorithm.Framework.csproj index b2f64e8c85e6..6eca8c244dc0 100644 --- a/Algorithm.Framework/QuantConnect.Algorithm.Framework.csproj +++ b/Algorithm.Framework/QuantConnect.Algorithm.Framework.csproj @@ -43,6 +43,7 @@ + @@ -52,31 +53,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\win\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\linux\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\osx\Python.Runtime.dll - - - - diff --git a/Algorithm.Python/QuantConnect.Algorithm.Python.csproj b/Algorithm.Python/QuantConnect.Algorithm.Python.csproj index 68a6b2fbbad2..84ca17c60d0b 100644 --- a/Algorithm.Python/QuantConnect.Algorithm.Python.csproj +++ b/Algorithm.Python/QuantConnect.Algorithm.Python.csproj @@ -51,11 +51,11 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive - @@ -294,29 +294,6 @@ - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\win\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\linux\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\osx\Python.Runtime.dll - - - - build diff --git a/Algorithm.Python/readme.md b/Algorithm.Python/readme.md index 8be8dfd6e96d..0fc54aa55ec1 100644 --- a/Algorithm.Python/readme.md +++ b/Algorithm.Python/readme.md @@ -1,7 +1,12 @@ -QuantConnect Python Algorithm Project: -============= +# QuantConnect Python Algorithm Project -## Local Python Autocomplete +This document contains information regarding how to use Python with the Lean engine, this includes how to use Python Autocomplete, setting up Lean for Python algorithms, PythonNet compilation for devs, and what imports to use to replicate the web IDE experience in your local development. + +
+ + +------ +# Local Python Autocomplete To enable autocomplete for your local Python IDE, install the `quantconnect-stubs` package from PyPI using the following command: ``` pip install quantconnect-stubs @@ -16,77 +21,84 @@ Copy and paste the imports found [here](#python-autocomplete-imports) to the top In addition, you can use [Skylight](https://www.quantconnect.com/skylight) to automatically sync local changes to the cloud. +
+ ------ -## Running LEAN Locally with Python -Before we enable python support, follow the [installation instructions](https://github.com/QuantConnect/Lean#installation-instructions) to get LEAN running C# algorithms in your machine. +# Setup Lean Locally with Python +Before setting up python support, follow the [installation instructions](https://github.com/QuantConnect/Lean#installation-instructions) to get LEAN running C# algorithms on your machine. + + +## Installing Python 3.6: + +Next we must prepare a Python installation for Lean to use. Follow the instructions for your OS. + +
+ +### [Windows](https://github.com/QuantConnect/Lean#windows) -### Install Python 3.6: -#### [Windows](https://github.com/QuantConnect/Lean#windows) 1. Use the Windows x86-64 MSI **Python 3.6.8** installer from [python.org](https://www.python.org/downloads/release/python-368/) or [Anaconda](https://repo.anaconda.com/archive/Anaconda3-5.2.0-Windows-x86_64.exe) for Windows installer. "Anaconda 5.2" installs 3.5.2 by default, after installation of Anaconda you will need to upgrade python to make it work as expected: `conda install -y python=3.6.8` 2. When asked to select the features to be installed, make sure you select "Add python.exe to Path" -3. `[Optional]` Create `PYTHONHOME` system variables which value must be the location of your python installation (e.g. `C:\Python36amd64` or `C:\Anaconda3`): - 1. Right mouse button on My Computer. Click Properties. - 2. Click Advanced System Settings -> Environment Variables -> System Variables - 3. Click **New**. - - Name of the variable: `PYTHONHOME`. - - Value of the variable: python installation path. +3. Create `PYTHONNET_PYDLL` environment variable to the location of your python dll in your installation (e.g. `C:\Dev\Python368\python36.dll` or `C:\Anaconda3\python36.dll`): + - Right mouse button on My Computer. Click Properties. + - Click Advanced System Settings -> Environment Variables -> System Variables + - Click **New**. + - Name: `PYTHONNET_PYDLL` + - Value: `{python dll location}` 4. Install [pandas=0.25.3](https://pandas.pydata.org/) and its [dependencies](https://pandas.pydata.org/pandas-docs/stable/install.html#dependencies). 5. Install [wrapt=1.11.2](https://pypi.org/project/wrapt/) module. 6. Reboot computer to ensure changes are propogated. -#### [macOS](https://github.com/QuantConnect/Lean#macos) +
+ +### [macOS](https://github.com/QuantConnect/Lean#macos) 1. Use the macOS x86-64 package installer from [Anaconda](https://repo.anaconda.com/archive/Anaconda3-5.2.0-MacOSX-x86_64.pkg) and follow "[Installing on macOS](https://docs.anaconda.com/anaconda/install/mac-os)" instructions from Anaconda documentation page. +2. Set `PYTHONNET_PYDLL` environment variable to the location of your python dll in your installation directory (e.g. `/Users/{your_user_name}/anaconda3/lib/libpython3.6m.dylib`): + - Open `~/.bash-profile` with a text editor of your choice. + - Add a new line to the file containing + ``` + export PYTHONNET_PYDLL="/{your}/{path}/{here}/libpython3.6m.dylib" + ``` + - Save your changes, and either restart your terminal *or* execute + ``` + source ~/.bash-profile + ``` 2. Install [pandas=0.25.3](https://pandas.pydata.org/) and its [dependencies](https://pandas.pydata.org/pandas-docs/stable/install.html#dependencies). 3. Install [wrapt=1.11.2](https://pypi.org/project/wrapt/) module. -*Note:* If you encounter the "System.DllNotFoundException: python3.6m" runtime error when running Python algorithms, or generating reports, on macOS: -1. Find `libpython3.6m.dylib` in your Python installation folder. If you installed Python with Anaconda, it may be found at - ``` - /Users/{your_user_name}/anaconda3/lib/libpython3.6m.dylib - ``` -2. Open `Lean/Common/Python/Python.Runtime.dll.config`, add the following text under ` ... ` and save: - ``` - - ``` -Note: Specify the install of v3.6.8 _exactly_, i.e. if with conda `conda install python=3.6.8` as this is a known compatible version and other versions may have issues as of this writing. +
+ +### [Linux](https://github.com/QuantConnect/Lean#linux-debian-ubuntu) -#### [Linux](https://github.com/QuantConnect/Lean#linux-debian-ubuntu) -By default, **miniconda** is installed in the users home directory (`$HOME`): +1. Install Python using miniconda by following these commands; by default, **miniconda** is installed in the users home directory (`$HOME`): ``` export PATH="$HOME/miniconda3/bin:$PATH" wget https://cdn.quantconnect.com/miniconda/Miniconda3-4.5.12-Linux-x86_64.sh bash Miniconda3-4.5.12-Linux-x86_64.sh -b rm -rf Miniconda3-4.5.12-Linux-x86_64.sh -sudo ln -s $HOME/miniconda3/lib/libpython3.6m.so /usr/lib/libpython3.6m.so conda update -y python conda pip -conda install -y cython=0.29.11 -conda install -y pandas=0.25.3 -conda install -y wrapt=1.11.2 ``` - -*Note 1:* There is a [known issue](https://github.com/pythonnet/pythonnet/issues/609) with python 3.6.5 that prevents pythonnet installation, please upgrade python to version 3.6.8: - ``` - conda install -y python=3.6.8 - ``` - -*Note 2:* If you encounter the "System.DllNotFoundException: python3.6m" runtime error when running Python algorithms on Linux: -1. Find `libpython3.6m.so` in your Python installation folder. If you installed Python with Miniconda, it may be found at - ``` - /home/{your_user_name}/miniconda3/envs/{qc_environment}/lib/libpython3.6m.so - ``` - Note that you can create a new virtual environment with all required dependencies by executing: +2. Create a new Python environment with the needed dependencies +``` +conda create -n qc_lean python=3.6.8 cython=0.29.11 pandas=0.25.3 wrapt=1.11.2 +``` +3. Set `PYTHONNET_PYDLL` environment variable to location of your python dll in your installation directory (e.g. `/home/{your_user_name}/miniconda3/envs/qc_lean/lib/libpython3.6m.so`): + - Open `/etc/environment` with a text editor of your choice. + - Add a new line to the file containing ``` - conda create -n qc_environment python=3.6.8 cython=0.29.11 pandas=0.25.3 wrapt=1.11.2 - + PYTHONNET_PYDLL="/home/{your_user_name}/miniconda3/envs/qc_lean/lib/libpython3.6m.so" ``` -2. Open `Lean/Common/Python/Python.Runtime.dll.config`, add the following text under ` ... ` and save: - ``` - - ``` -### Run python algorithm -1. Update the [config](https://github.com/QuantConnect/Lean/blob/master/Launcher/config.json) to run the python algorithm: + - Save your changes, and logout or reboot to reflect these changes + + + +
+ + +## Run Python Algorithms + +1. Update the [config](https://github.com/QuantConnect/Lean/blob/master/Launcher/config.json) to run a python algorithm: ```json "algorithm-type-name": "BasicTemplateAlgorithm", "algorithm-language": "Python", @@ -95,30 +107,28 @@ conda install -y wrapt=1.11.2 2. Rebuild LEAN. 3. Run LEAN. You should see the same result of the C# algorithm you tested earlier. -___ +------ -### Python.NET development - Python.Runtime.dll compilation -LEAN users do **not** need to compile `Python.Runtime.dll`. The information below is targeted to developers who wish to improve it. +# Python.NET development - Python.Runtime.dll compilation -Download [QuantConnect/pythonnet](https://github.com/QuantConnect/pythonnet/) github clone or downloading the zip. If downloading the zip - unzip to a local pathway. +LEAN users do **not** need to compile `Python.Runtime.dll`. The information below is targeted to developers who wish to improve it. Download [QuantConnect/pythonnet](https://github.com/QuantConnect/pythonnet/) github clone or downloading the zip. If downloading the zip - unzip to a local pathway. **Note:** QuantConnect's version of pythonnet is an enhanced version of [pythonnet](https://github.com/pythonnet/pythonnet) with added support for `System.Decimal` and `System.DateTime`. -Below we can find the compilation flags that create a suitable `Python.Runtime.dll` for each operating system. +Below are some examples of build commands that create a suitable `Python.Runtime.dll`. -**Windows** -``` -msbuild pythonnet.sln /nologo /v:quiet /t:Clean;Rebuild /p:Platform=x64 /p:PythonInteropFile="interop36.cs" /p:Configuration=ReleaseWin /p:DefineConstants="PYTHON36,PYTHON3,UCS2" ``` -**macOS** +msbuild pythonnet.sln /nologo /v:quiet /t:Clean;Rebuild ``` -msbuild pythonnet.sln /nologo /v:quiet /t:Clean;Rebuild /p:Platform=x64 /p:PythonInteropFile="interop36m.cs" /p:Configuration=ReleaseMono /p:DefineConstants="PYTHON36,PYTHON3,UCS4,MONO_OSX,PYTHON_WITH_PYMALLOC" -``` -**Linux** + +OR + ``` -msbuild pythonnet.sln /nologo /v:quiet /t:Clean;Rebuild /p:Platform=x64 /p:PythonInteropFile="interop36m.cs" /p:Configuration=ReleaseMono /p:DefineConstants="PYTHON36,PYTHON3,UCS4,MONO_LINUX,PYTHON_WITH_PYMALLOC" +dotnet build pythonnet.sln ``` +------ + # Python Autocomplete Imports Copy and paste these imports to the top of your Python file to enable a development experience equal to the cloud (these imports are exactly the same as the ones used in the QuantConnect Terminal). diff --git a/Algorithm/QuantConnect.Algorithm.csproj b/Algorithm/QuantConnect.Algorithm.csproj index b4783003c1c0..63952c24a986 100644 --- a/Algorithm/QuantConnect.Algorithm.csproj +++ b/Algorithm/QuantConnect.Algorithm.csproj @@ -55,30 +55,8 @@ - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\win\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\linux\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\osx\Python.Runtime.dll - - - - + all @@ -86,7 +64,7 @@ - + diff --git a/AlgorithmFactory/QuantConnect.AlgorithmFactory.csproj b/AlgorithmFactory/QuantConnect.AlgorithmFactory.csproj index 7ec33dde43eb..d3cdd2963fc8 100644 --- a/AlgorithmFactory/QuantConnect.AlgorithmFactory.csproj +++ b/AlgorithmFactory/QuantConnect.AlgorithmFactory.csproj @@ -41,36 +41,13 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\win\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\linux\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\osx\Python.Runtime.dll - - - - diff --git a/Common/QuantConnect.csproj b/Common/QuantConnect.csproj index 2fa6a3ff2189..7523837f7d9e 100644 --- a/Common/QuantConnect.csproj +++ b/Common/QuantConnect.csproj @@ -75,6 +75,7 @@ + @@ -89,7 +90,6 @@ - @@ -118,29 +118,6 @@ - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\win\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\linux\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\osx\Python.Runtime.dll - - - - @@ -150,9 +127,6 @@ True - - PreserveNewest - diff --git a/DockerfileJupyter b/DockerfileJupyter index 89d90be34c52..22821ff2aafb 100644 --- a/DockerfileJupyter +++ b/DockerfileJupyter @@ -43,12 +43,9 @@ RUN echo "if [ ! -d \"${WORK}Notebooks\" ]; then mkdir ${WORK}Notebooks; fi && \ jupyter lab --ip='0.0.0.0' --port=8888 --no-browser --allow-root --notebook-dir=\"Notebooks\" --LabApp.token='' " \ > start.sh -# We keep this pythonnet used for C# -> Py (C# kernels) -# We copy the pythonnet used for the Py kernels -RUN mkdir ${WORK}pythonnet && \ - mv -f ${WORK}Python.Runtime.dll ${WORK}pythonnet/Python.Runtime.dll && \ - mv -f ${WORK}jupyter/* ${WORK} && \ - chmod -R 777 ${WORK} +RUN chmod -R 777 ${WORK} + +RUN pip install clr-loader EXPOSE 8888 WORKDIR $WORK diff --git a/DockerfileLeanFoundation b/DockerfileLeanFoundation index 1d7304264643..b4e0b664ef1b 100644 --- a/DockerfileLeanFoundation +++ b/DockerfileLeanFoundation @@ -265,5 +265,8 @@ RUN conda clean -y --all # Clean up any unused packages installed by apt-get RUN apt-get autoremove --purge -y +# Set PythonDLL variable for PythonNet +ENV PYTHONNET_PYDLL="/opt/miniconda3/lib/libpython3.6m.so" + # List all packages RUN conda list diff --git a/Engine/QuantConnect.Lean.Engine.csproj b/Engine/QuantConnect.Lean.Engine.csproj index 39be8b1bc857..edd22371ba09 100644 --- a/Engine/QuantConnect.Lean.Engine.csproj +++ b/Engine/QuantConnect.Lean.Engine.csproj @@ -87,30 +87,8 @@ - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\win\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\linux\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\osx\Python.Runtime.dll - - - - + @@ -121,7 +99,6 @@ - diff --git a/Indicators/QuantConnect.Indicators.csproj b/Indicators/QuantConnect.Indicators.csproj index 53b9e398a03f..4868b5fadc48 100644 --- a/Indicators/QuantConnect.Indicators.csproj +++ b/Indicators/QuantConnect.Indicators.csproj @@ -42,36 +42,13 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\win\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\linux\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\osx\Python.Runtime.dll - - - - diff --git a/LocalPackages/readme.md b/LocalPackages/readme.md new file mode 100644 index 000000000000..88069848dc20 --- /dev/null +++ b/LocalPackages/readme.md @@ -0,0 +1,15 @@ +# LocalPackages Directory + +This directory of the repo is used for testing new package deployment in production without needing to publish the package before it is ready. + +Placing any `.nupkg` files in this directory and using `nuget restore .\QuantConnect.Lean.sln` will allow any packages in this directory to be picked up and used by Lean as a dependency. + + +#### Note: + +- `dotnet build` will **not** use this `LocalPackages` source, unless you add it to its sources like so: + +``` +dotnet nuget add source *PathToLeanHere*/LocalPackages +``` +- Using `nuget restore` works without adding the source because it will pick up on the file `.nuget/NuGet.Config` which defines this source. \ No newline at end of file diff --git a/Report/QuantConnect.Report.csproj b/Report/QuantConnect.Report.csproj index 34c5de015308..3ad2074a0495 100644 --- a/Report/QuantConnect.Report.csproj +++ b/Report/QuantConnect.Report.csproj @@ -52,30 +52,8 @@ flow-analysis LICENSE
- - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\win\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\linux\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\osx\Python.Runtime.dll - - - - + @@ -85,7 +63,6 @@ - diff --git a/Research/QuantConnect.Research.csproj b/Research/QuantConnect.Research.csproj index 3fdf5649d2be..1fd045674ad4 100644 --- a/Research/QuantConnect.Research.csproj +++ b/Research/QuantConnect.Research.csproj @@ -40,59 +40,16 @@ - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\win\Python.Runtime.dll - - - clr.pyd - PreserveNewest - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\linux\Python.Runtime.dll - - - jupyter\clr.cpython-36m-x86_64-linux-gnu.so - PreserveNewest - - - jupyter\Python.Runtime.dll - PreserveNewest - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\osx\Python.Runtime.dll - - - jupyter\clr.cpython-36m-darwin.so - PreserveNewest - - - jupyter\Python.Runtime.dll - PreserveNewest - - - - + all runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/Research/readme.md b/Research/readme.md index af764f3bc6a3..17a43c2bdea1 100644 --- a/Research/readme.md +++ b/Research/readme.md @@ -90,10 +90,6 @@ and [Python installation](https://github.com/QuantConnect/Lean/tree/master/Algor ``` pip install quantconnect ``` - 3. **Linux and macOS:** Copy pythonnet binaries for jupyter - ``` - cp Lean/Launcher/bin/Debug/jupyter/* Lean/Launcher/bin/Debug - ``` **2. Run Jupyter:** 1. Update the `config.json` file in `Lean/Launcher/bin/Debug/` folder ``` diff --git a/Tests/Common/Exceptions/KeyErrorPythonExceptionInterpreterTests.cs b/Tests/Common/Exceptions/KeyErrorPythonExceptionInterpreterTests.cs index 28f457c58db4..a08da22cd8af 100644 --- a/Tests/Common/Exceptions/KeyErrorPythonExceptionInterpreterTests.cs +++ b/Tests/Common/Exceptions/KeyErrorPythonExceptionInterpreterTests.cs @@ -80,7 +80,7 @@ public void VerifyMessageContainsStackTraceInformation() var assembly = typeof(PythonExceptionInterpreter).Assembly; var interpreter = StackExceptionInterpreter.CreateFromAssemblies(new[] { assembly }); exception = interpreter.Interpret(exception, NullExceptionInterpreter.Instance); - Assert.True(exception.Message.Contains("dict()[\\'SPY\\']")); + Assert.True(exception.Message.Contains("dict()['SPY']")); } private Exception CreateExceptionFromType(Type type) => type == typeof(PythonException) ? _pythonException : (Exception)Activator.CreateInstance(type); diff --git a/Tests/Common/Exceptions/NoMethodMatchPythonExceptionInterpreterTests.cs b/Tests/Common/Exceptions/NoMethodMatchPythonExceptionInterpreterTests.cs index 199d91c48229..71d4b19ea675 100644 --- a/Tests/Common/Exceptions/NoMethodMatchPythonExceptionInterpreterTests.cs +++ b/Tests/Common/Exceptions/NoMethodMatchPythonExceptionInterpreterTests.cs @@ -80,7 +80,7 @@ public void VerifyMessageContainsStackTraceInformation() var assembly = typeof(PythonExceptionInterpreter).Assembly; var interpreter = StackExceptionInterpreter.CreateFromAssemblies(new[] { assembly }); exception = interpreter.Interpret(exception, NullExceptionInterpreter.Instance); - Assert.True(exception.Message.Contains("self.SetCash(\\'SPY\\')")); + Assert.True(exception.Message.Contains("self.SetCash('SPY')")); } private Exception CreateExceptionFromType(Type type) => type == typeof(PythonException) ? _pythonException : (Exception)Activator.CreateInstance(type); diff --git a/Tests/Python/PortfolioCustomModelTests.cs b/Tests/Python/PortfolioCustomModelTests.cs index 311dd871f646..bd8bcf3f4230 100644 --- a/Tests/Python/PortfolioCustomModelTests.cs +++ b/Tests/Python/PortfolioCustomModelTests.cs @@ -137,7 +137,6 @@ class CustomMarginCallModel(DefaultMarginCallModel): def __init__(self, portfolio, defaultOrderProperties): self.porfolio = portfolio self.defaultOrderProperties = defaultOrderProperties - super().__init__(portfolio, defaultOrderProperties) def GenerateMarginCallOrder(self, security, netLiquidationValue, totalMargin, maintenanceMarginRequirement): time = Extensions.ConvertToUtc(security.LocalTime, security.Exchange.TimeZone) diff --git a/Tests/QuantConnect.Tests.csproj b/Tests/QuantConnect.Tests.csproj index 4b843e30d60e..1fd7b97ce647 100644 --- a/Tests/QuantConnect.Tests.csproj +++ b/Tests/QuantConnect.Tests.csproj @@ -44,6 +44,7 @@ + @@ -71,7 +72,6 @@ - @@ -115,29 +115,6 @@ - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\win\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\linux\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\osx\Python.Runtime.dll - - - - diff --git a/ToolBox/QuantConnect.ToolBox.csproj b/ToolBox/QuantConnect.ToolBox.csproj index d163ca06bc70..f4dcf7fc006a 100644 --- a/ToolBox/QuantConnect.ToolBox.csproj +++ b/ToolBox/QuantConnect.ToolBox.csproj @@ -48,33 +48,11 @@ - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\win\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\linux\Python.Runtime.dll - - - - - - - $(NuGetPackageRoot)\quantconnect.pythonnet\1.0.5.30\lib\osx\Python.Runtime.dll - - - - + @@ -87,10 +65,9 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + -