8 Commits

Author SHA1 Message Date
R. Singh
60c665871a
Feature: Add ability to use a separate python environment in local executor (#2615)
* Add ability to use virtual environments in local executor

* Copy environment variables from parent environment

* Fix mypy errors and formatting

* Account for venv on Windows

* Use a virtual environment context object instead of path

* Add utility method to create a virtual environment

* Remove assertion using `_venv_path`

* Add tests for `create_virtual_env`

* Modify test code and add output assertion

* Modify test code and assertion

* Execute activation script before actual command on windows

* Add docs for using a virtual env
2024-05-11 06:25:20 +00:00
Wael Karkoub
a9171211c7
Streamline Testing with pytest-cov and pytest Defaults (#2490)
* done

* update docs

* try fix

* update workflows

* undo minor fix

* resolve comments

* adds back pytest-asyncio

* minor fix

* add branch coverage

* restore pip install e.

* test with coverage

* fix mypy

* fix coverage + docker + windows combo

* fix bash command

* formatter

* formatter

* one last fix

* I lied, last fix

* fix

* fix retrieve chat test

* fix windows paths

* change cache seed

* down grade openai version

* fix openai mypy

* better error type

* fix image gen cache test

* fix

* experimenting

* fix lmm

* skip cosmos test

* remove cosmos db

* unused imports

* handle more cosmosdb skips

* fix flaky test
2024-04-29 00:27:34 +00:00
Li Jiang
42b27b9a9d
Add isort (#2265)
* Add isort

* Apply isort on py files

* Fix circular import

* Fix format for notebooks

* Fix format

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-04-05 02:26:06 +00:00
Abhay Mathur
3a3d4cc2ee
code_utils.py powershell command bugfix in MacOS (#1963)
* macos bugfix

* logs permissionerror warning only if lang is powershell command

* condensed the if statements down

* Update code_utils.py

* fixed formatting

* handled powershell_command = None case

* bugfix

* raising exceptions instead of logging warnings

* code formatting fixed

* removed return sh statement

* fixed code formatting

* update get_powershell_command

* Update code_utils.py

fixed code format

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2024-03-18 13:05:19 +00:00
Gunnar Kudrjavets
b8ceb866e6
Add shebang functionality to tests (#1784)
Tests that contain `if __name__ == "__main__":` now have a shebang line
and execute permission.
2024-02-29 01:11:08 +00:00
Abhay Mathur
a646df2d02
Updating code_utils.py to solve issue #1747 (#1758)
* Update code_utils.py

Updated the powershell command to pwsh

* Update code_utils.py

added a split to handle powershell in the first condition as well

* Update local_commandline_code_executor.py

added "pwsh" as a command option in lang variable

* Update autogen/coding/local_commandline_code_executor.py

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>

* Update code_utils.py

* Update code_utils.py

fixed formatting

* Update code_utils.py

defined a function to detect whether 'powershell' or 'pwsh' works and accordingly use the one that works

* Update code_utils.py

fixed formatting

* Update and rename test_code.py to test_code_utils.py

added a unit test for get_powershell_command function in code_utils.py

* Update test_code_utils.py

fixed formatting

* Update test_code_utils.py

fixed formatting

* Update autogen/code_utils.py

Co-authored-by: Chi Wang <wang.chi@microsoft.com>

* solved issue #1747

* updated unit test

* fixed formatting

* fixed formatting

* fixed formatting

* fixed a bug

* removed extra return None and removed redundant comments

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-02-23 03:41:33 +00:00
Abhay Mathur
2750391f84
Updated code_utils.py & local_commandline_code_executor.py (powershell to pwsh) (#1710)
* Update code_utils.py

Updated the powershell command to pwsh

* Update code_utils.py

added a split to handle powershell in the first condition as well

* Update local_commandline_code_executor.py

added "pwsh" as a command option in lang variable

* Update autogen/coding/local_commandline_code_executor.py

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>

* Update code_utils.py

* Update code_utils.py

fixed formatting

* Update code_utils.py

defined a function to detect whether 'powershell' or 'pwsh' works and accordingly use the one that works

* Update code_utils.py

fixed formatting

* Update and rename test_code.py to test_code_utils.py

added a unit test for get_powershell_command function in code_utils.py

* Update test_code_utils.py

fixed formatting

* Update test_code_utils.py

fixed formatting

* Update autogen/code_utils.py

Co-authored-by: Chi Wang <wang.chi@microsoft.com>

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-02-19 17:32:13 +00:00
Aaron
e50d5a1747
Command line code sanitation (#1627)
* UPDATE - add commandline sanitation class, update local_commandline_code_executor.py and renamed test for code_utils.py

* FIX - precommit run

* UPDATE - moved sanitation function to LocalCommandlineCodeExecutor, moved testo to test_commandline_code_executor.py

* UPDATE - added docstring notice to sanitize_code

* Update autogen/coding/local_commandline_code_executor.py

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>

* FIX - regular expression

* FIX - function invocation in tests

* UPDATE - pre-commit run

* FIX - pre-commit run -_-

---------

Co-authored-by: Ward <award40@LAMU0CLP74YXVX6.uhc.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2024-02-18 16:41:36 +00:00