-
Notifications
You must be signed in to change notification settings - Fork 4
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
VirtualEnv can be created from setup.py files #306
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
|
||
from agentos import ArgumentSet, Component | ||
from agentos.registry import Registry | ||
from agentos.repo import Repo | ||
from agentos.run import Run | ||
from agentos.virtual_env import VirtualEnv | ||
|
||
|
@@ -265,7 +266,35 @@ def publish( | |
@agentos_cmd.command() | ||
@_option_assume_yes | ||
def clear_env_cache(assume_yes): | ||
""" | ||
This command clears all virtual environments that have been cached by | ||
AgentOS in your local file system. All the virtual environments can be | ||
automatically recreated when re-running a Component ``requirements_path`` | ||
specified. | ||
""" | ||
VirtualEnv.clear_env_cache(assume_yes=assume_yes) | ||
|
||
|
||
@agentos_cmd.command() | ||
@_option_assume_yes | ||
def clear_repo_cache(assume_yes): | ||
""" | ||
This command clears all git repos that have been cached by AgentOS on your | ||
local file system. These repos will be recreated if as you run Components | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: extra "if" in "These repos will be recreated if as you run..." |
||
that require them. | ||
""" | ||
Repo.clear_repo_cache(assume_yes=assume_yes) | ||
|
||
|
||
@agentos_cmd.command() | ||
@_option_assume_yes | ||
def clear_cache(assume_yes): | ||
""" | ||
This command clears all virtual environments AND git repos that have been | ||
cached by AgentOS on your local file system. | ||
""" | ||
VirtualEnv.clear_env_cache(assume_yes=assume_yes) | ||
Repo.clear_repo_cache(assume_yes=assume_yes) | ||
|
||
|
||
# Copied from https://github.com/mlflow/mlflow/blob/3958cdf9664ade34ebcf5960bee215c80efae992/mlflow/cli.py#L188 # noqa: E501 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -440,10 +440,11 @@ def _build_virtual_env(self) -> VirtualEnv: | |
for c in self.dependency_list(include_parents=True): | ||
if c.requirements_path is None: | ||
continue | ||
full_req_path = self.repo.get_local_file_path( | ||
c.identifier.version, c.requirements_path | ||
).absolute() | ||
req_paths.add(full_req_path) | ||
for req_path in c.requirements_path.split(";"): | ||
full_req_path = self.repo.get_local_file_path( | ||
c.identifier.version, req_path | ||
).absolute() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense to assert that the requirements_file exists here? |
||
req_paths.add(full_req_path) | ||
return VirtualEnv.from_requirements_paths(req_paths) | ||
|
||
def _handle_repo_spec(self, repos): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
# When updating here, also update conda_env.yaml | ||
requests==2.21.0 # Needed till https://github.com/ray-project/ray/issues/8373 fixed. | ||
|
||
# See https://pytorch.org/get-started/locally/ for the command to install | ||
# the CPU-only torch for each platform. | ||
# Pass the following option to pip on linux to get the CPU only torch | ||
# -f https://download.pytorch.org/whl/torch_stable.html | ||
torch==1.9.1+cpu; sys_platform == 'linux' | ||
torch==1.9.1; sys_platform == 'windows' | ||
torch==1.9.1; sys_platform == 'darwin' | ||
ray[rllib]==1.7.0 | ||
# -f https://download.pytorch.org/whl/cpu/torch_stable.html | ||
torch==1.10.2+cpu; sys_platform == 'linux' | ||
torch==1.10.2; sys_platform == 'windows' | ||
torch==1.10.2; sys_platform == 'darwin' | ||
ray[rllib]==1.10.0 | ||
gym==0.21.0 | ||
|
||
# agentos_pip_cmdline: | ||
# linux: | ||
# "-f": "https://download.pytorch.org/whl/cpu/torch_stable.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import arrow # noqa: F401 | ||
|
||
|
||
# A basic agent. | ||
class BasicAgent: | ||
DEFAULT_ENTRY_POINT = "evaluate" | ||
|
||
def evaluate(self): | ||
import bottle # noqa: F401 | ||
|
||
print("Successful venv test") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from setuptools import setup | ||
|
||
setup( | ||
name="setup_py_agent", | ||
description=( | ||
"An agent with requirements in setup.py for AOS testing purposes" | ||
), | ||
version="1.0.0", | ||
install_requires=[ | ||
"arrow", | ||
"bottle", | ||
], | ||
license="Apache License 2.0", | ||
python_requires=">=3.5", | ||
url="https://agentos.org", | ||
project_urls={ | ||
"Source Code": "https://github.com/agentos-project/agentos", | ||
}, | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Nit: missing "with" in "re-running a Component with `requirements_path` specified."