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

uv sync --activate #8715

Closed
dbrtly opened this issue Oct 31, 2024 · 5 comments
Closed

uv sync --activate #8715

dbrtly opened this issue Oct 31, 2024 · 5 comments
Labels
duplicate This issue or pull request already exists question Asking for clarification or support

Comments

@dbrtly
Copy link

dbrtly commented Oct 31, 2024

Sometimes it would be convenient to sync and activate a virtual environment in one command. This has probably been discussed before but I didn't find it. Apologies if so.

@samypr100
Copy link
Collaborator

Can you provide an example of the commands you used that didn't behave as expected? Did you try uv sync and it didn't work on your virtual environment?

@samypr100 samypr100 added the question Asking for clarification or support label Oct 31, 2024
@dbrtly
Copy link
Author

dbrtly commented Oct 31, 2024

uv sync

Is a thing of beauty. I love it.

I'd like the option to do

uv sync --activate

As an alternative to

uv sync
source .venv/bin/activate || source .venv/Scripts/activate

@samypr100
Copy link
Collaborator

Ah, I see. Thanks for the examples. I'd consider this a dupe of #8106

@dbrtly
Copy link
Author

dbrtly commented Oct 31, 2024

Ah. I see.

Do you think a bash alias would work?

Like

alias uv-sync='uv sync && source .venv/bin/activate'

@zanieb
Copy link
Member

zanieb commented Oct 31, 2024

I guess so?

❯ alias test-example="echo 'hi' && source .venv/bin/activate"
❯ test-example
hi
❯ which python
/Users/zb/workspace/uv/.venv/bin/python
❯ deactivate
❯ test-example
hi
❯ which python
/Users/zb/workspace/uv/.venv/bin/python

Surprised me though tbh.

Anyway, we can't add support for this in uv directly as mentioned in the linked issue.

@zanieb zanieb closed this as not planned Won't fix, can't repro, duplicate, stale Oct 31, 2024
@zanieb zanieb added the duplicate This issue or pull request already exists label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

3 participants