dschep / install-poetry-action

A Github action to install poetry
MIT License
31 stars 7 forks source link

Configure Poetry to not use virtualenvs #2

Closed ecurtin2 closed 4 years ago

ecurtin2 commented 5 years ago

Since the action is creating isolated environments for commands, I think it makes sense to have poetry configured to not use virtualenvs. This removes the need to have an extra activate step or to have the users manually do this step.

This can be done with:

poetry config settings.virtualenvs.create false

Maybe it makes sense to have this as a toggle in the action:

  with:
    create_virtualenvs: true/false
danyeaw commented 4 years ago

One point to be aware of, in version 1.0.0 prereleases, the setting name changed:

poetry config virtualenvs.create false

I agree this would be a great addition to this action!

danyeaw commented 4 years ago

@dschep If we submit a PR with this, would this be something you would be interested in merging?

dschep commented 4 years ago

@danyeaw yup!

danyeaw commented 4 years ago

@dschep Would you mind releasing a new version soon with this update? :heart:

dschep commented 4 years ago

Yup, sorry about that @danyeaw. it's been a while since i made a release, plz test it to make sure i did it right :grimacing:

danyeaw commented 4 years ago

@dschep Thanks, the new release is working great!

chrishas35 commented 4 years ago

Older discussion here, but curious to know what, if anything, you all are caching now with virtualenvs turned off. It took me a while to figure out that 1.2 vs. 1.3 was the reason my builds were taking significantly longer because the virtualenv was no longer being used and that's what I had cached to speed things up. I understand the rationale to skip the virtualenv, but am tempted to turn it back on for speed alone...

danyeaw commented 4 years ago

@chrishas35 I am caching ~/.cache/pip, which I think is cached with and without a virtualenv.

chrishas35 commented 4 years ago

@chrishas35 I am caching ~/.cache/pip, which I think is cached with and without a virtualenv.

Intresesting... are you telling poetry to use that somewhere then? Because I don't have a .cache at all. My first attempt was to cache ~/.cache/poetry and that's how I found ~/.cache doesn't exist for me... I'm now working on manual directory creation.

total 48K
drwxrwxrwx  9 runner docker 4.0K Mar 28 18:11 .
drwxr-xr-x+ 4 root   root   4.0K Mar 27 13:24 ..
-rwxrwxrwx  1 runner docker  220 Mar 27 13:24 .bash_logout
-rwxrwxrwx  1 runner docker 3.9K Mar 27 13:24 .bashrc
lrwxrwxrwx  1 runner docker   22 Mar 27 13:24 .cargo -> /usr/share/rust/.cargo
drwxrwxrwx  5 runner docker 4.0K Mar 28 18:11 .config
drwxr-xr-x  4 runner docker 4.0K Mar 28 18:11 .poetry
-rwxrwxrwx  1 runner docker  846 Mar 28 18:11 .profile
lrwxrwxrwx  1 runner docker   23 Mar 27 13:24 .rustup -> /usr/share/rust/.rustup
drwxr-xr-x  2 runner root   4.0K Mar 27 13:26 factory
drwxr-xr-x  2 runner docker 4.0K Mar 28 18:11 perflog
drwxr-xr-x  3 runner root   4.0K Mar 27 13:26 runners
drwxr-xr-x  2 runner root   4.0K Mar 27 13:26 warmup
drwxr-xr-x  6 runner root   4.0K Mar 28 18:11 work
ls: cannot access '/home/runner/.cache': No such file or directory
danyeaw commented 4 years ago

I don't think so. You can checkout my setup: https://github.com/gaphor/gaphor/blob/master/.github/workflows/build.yml

The last run it restored a 119MB cache for pip, so it seems to be working.

chrishas35 commented 4 years ago

Thanks. Okay, got that working. Thing is, it doesn't save me any time on the poetry install step, presumably because Github is doing heavy caching already so the download step isn't the latency? By caching the virtualenv we could skip the poetry install step if the lock file didn't change. There may not be a great solution that gets speed and the lack of a virtualenv...

danyeaw commented 4 years ago

@chrishas35 I haven't tried to cache a whole virtualenv before, but I agree that seems like you could speed stuff up quite a bit if you avoid running poetry at all.