Skip to content
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

Feature: automatically install repo as pip package #195

Open
markbarna opened this issue Mar 21, 2024 · 2 comments
Open

Feature: automatically install repo as pip package #195

markbarna opened this issue Mar 21, 2024 · 2 comments

Comments

@markbarna
Copy link

In addition to manually listing python dependencies or using a requirements file, it would be good to have the option to install the repo as a package, if it's structured appropriately. This also would address any potential issues with inconsistent behavior of imports based on the cwd.

The specific request here is that if the repo contains a setup.cfg, setup.py, or pyproject.toml, after cloning the repo and applying any uncommitted changes, the agent will cd into the repo and run pip install ..

I was able to replicate this behavior by having the following in my code:

task = Task.init(....)
task.set_packages(["my-cool-project @ file:///root/.clearml/venvs-builds/task_repository/my-cool-project.git"])

But this seems a bit hacky, especially since I have to hard code the path to where the agent clones my repo.

@jkhenning
Copy link
Member

Hi @markbarna,

Notice the root of the repo is always added to the PAYTHONPATH so it almost the equivalent of adding the repo.
You can also add the repo using Task.add_requirements("-e .")

@markbarna
Copy link
Author

markbarna commented Mar 25, 2024

Hi @jkhenning ,
I could have sworn I had already tried task.set_packages(["-e ."]), however I just tried again and that worked so I guess this does address the need. Can you explain the difference between task.add_requirements(), task.set_packages() and Task. force_requirements_env_freeze()? They all have overlapping functionality so it's not clear when I should use which one. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants