-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Adapt Tools CLI to uv #1455
Adapt Tools CLI to uv #1455
Conversation
@@ -25,7 +25,9 @@ def __init__(self, api_key: str) -> None: | |||
|
|||
def _make_request(self, method: str, endpoint: str, **kwargs) -> requests.Response: | |||
url = urljoin(self.base_url, endpoint) | |||
return requests.request(method, url, headers=self.headers, **kwargs) | |||
session = requests.Session() | |||
session.trust_env = False |
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.
trust_env = False
tells requests
to bypass the system's authentication or proxy settings, relying only on the authentication defined in the request itself.
The reason for this change is that when a .netrc
file is present, requests
automatically replaces the Authorization
header with the credentials from .netrc
, overwriting Auth0 credentials.
While trust_env = False
fixes the issue, alongside I'm proposing moving our custom PyPI index endpoints from app.crewai.com
to tools.crewai.com
. This ensures .netrc
is only applied to that specific subdomain system-wide.
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.
Your suggestion makes total sense.
# Create .netrc or _netrc file | ||
netrc_filename = "_netrc" if platform.system() == "Windows" else ".netrc" | ||
netrc_path = Path.home() / netrc_filename | ||
def _set_netrc_credentials(self, credentials, netrc_path=None): |
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.
I refactored it to use Python's builtin netrc
package.
password {credentials['password']} | ||
""" | ||
netrc_instance = netrc(file=netrc_path) | ||
netrc_instance.hosts["app.crewai.com"] = (credentials["username"], "", credentials["password"]) |
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.
This is the line we need to change after we migrate to tools.crewai.com
.
This pull request adapts commands from the Tool CLI from Poetry to uv.
Extra comments inline 👇