Julian / venvs

venvs creates virtualenvs
https://pypi.org/project/venvs/
MIT License
17 stars 12 forks source link

venvs is unable to host itself #96

Open altendky opened 4 years ago

altendky commented 4 years ago

My intended workflow is to have my virtualenvs.toml in my home directory git repo. When I get a new computer I should be able to setup that repo then grab the shiv artifact and run converge. From there on I should be able to run the ~/.local/share/virtualenvs/venvs/bin/venvs executable to converge etc.

For now I'll just comment out the venvs env once it gets installed the first time.

 ~/repos   master ●  ll ~/.local/bin ~/.local/share/virtualenvs/
/home/altendky/.local/bin:
total 0

/home/altendky/.local/share/virtualenvs/:
total 4.0K
-rw-rw-r-- 1 altendky altendky 1.3K Dec 29 16:46 virtualenvs.toml
 ~/repos   master ●  cat ~/.local/share/virtualenvs/virtualenvs.toml 
[virtualenv.venvs]
install = [
    "venvs",
]
link = ["venvs"]

# [virtualenv.virtualenv]
# install = [
#     "virtualenv",
# ]
# link = ["virtualenv"]

[virtualenv.tox]
install = [
    "tox",
]
link = ["tox"]

# [virtualenv.pipenv]
# install = [
#     "git+https://github.com/pypa/pipenv",
# ]
# link = ["pipenv", "pew"]

[virtualenv.twine]
install = [
    "twine",
]
link = ["twine"]

# [virtualenv.blurb]
# install = [
#     "blurb",
# ]
# link = ["blurb"]

# [virtualenv.flake8]
# install = [
#     "flake8",
# ]
# link = ["flake8"]

# [virtualenv.git-cola]
# install = [
#     "git-cola",
# ]
# link = ["git-cola", "git-dag"]

# [virtualenv.versioneer]
# install = [
#     "versioneer",
# ]
# link = ["versioneer"]

# [virtualenv.cython]
# install = [
#     "cython",
# ]
# link = ["cython"]

# [virtualenv.ccstudiodss]
# install = [
#     "ccstudiodss",
# ]
# link = ["dss"]

# [virtualenv.offlineimap]
# python = "python2"
# install = [
#     "offlineimap",
# ]
# link = ["offlineimap"]

# [virtualenv.poetry]
# python = "python3"
# install = [
#     "poetry",
# ]
# link = ["poetry"]

# [virtualenv.pipx]
# python = "python3"
# install = [
#     "pipx",
# ]
# link = ["pipx"]

# [virtualenv.py2]
# python = "python2"

# [virtualenv.py3]
# python = "python3"
 ~/repos   master ●  venvs/venv/bin/venvs converge
twine: 100%|█████████████████████████████████████████████████████████████████████████████| 3/3 [00:14<00:00,  4.98s/venv]
 ~/repos   master ●  type venvs
venvs is /home/altendky/.local/bin/venvs
 ~/repos   master ●  venvs --help
Usage: venvs [OPTIONS] COMMAND [ARGS]...

  Centralized virtual environments.

Options:
  --version   Show the version and exit.
  -h, --help  Show this message and exit.

Commands:
  converge   Converge the configured set of tracked virtualenvs.
  create     Create a new ad hoc virtualenv.
  find       Find a virtualenv in the store.
  remove     Remove an ad hoc virtualenv.
  temporary  Create or reuse the global temporary virtualenv.
 ~/repos   master ●  venvs converge
venvs:   0%|                                                                                     | 0/3 [00:00<?, ?venv/s]Traceback (most recent call last):
  File "/home/altendky/.local/bin/venvs", line 8, in <module>
  File "/home/altendky/.local/share/virtualenvs/venvs/lib/python3.8/site-packages/click/core.py", line 764, in __call__
  File "/home/altendky/.local/share/virtualenvs/venvs/lib/python3.8/site-packages/click/core.py", line 717, in main
  File "/home/altendky/.local/share/virtualenvs/venvs/lib/python3.8/site-packages/click/core.py", line 1137, in invoke
  File "/home/altendky/.local/share/virtualenvs/venvs/lib/python3.8/site-packages/click/core.py", line 956, in invoke
  File "/home/altendky/.local/share/virtualenvs/venvs/lib/python3.8/site-packages/click/core.py", line 555, in invoke
  File "/home/altendky/.local/share/virtualenvs/venvs/lib/python3.8/site-packages/venvs/converge.py", line 87, in main
  File "/home/altendky/.local/share/virtualenvs/venvs/lib/python3.8/site-packages/venvs/common.py", line 83, in recreate_on
  File "/home/altendky/.local/share/virtualenvs/venvs/lib/python3.8/site-packages/venvs/common.py", line 67, in create
  File "/home/altendky/.local/share/virtualenvs/venvs/lib/python3.8/site-packages/venvs/common.py", line 15, in _create_virtualenv
  File "/home/altendky/.pyenv/versions/3.8.0/lib/python3.8/subprocess.py", line 359, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/home/altendky/.pyenv/versions/3.8.0/lib/python3.8/subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/home/altendky/.pyenv/versions/3.8.0/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/home/altendky/.pyenv/versions/3.8.0/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/altendky/.local/share/virtualenvs/venvs/bin/python'
venvs:   0%|                                                                                     | 0/3 [00:00<?, ?venv/s]
 ✘  ~/repos   master ●  ll ~/.local/share/virtualenvs/  
total 12K
drwxrwxr-x 5 altendky altendky 4.0K Dec 29 16:47 tox/
drwxrwxr-x 5 altendky altendky 4.0K Dec 29 16:47 twine/
-rw-rw-r-- 1 altendky altendky 1.3K Dec 29 16:46 virtualenvs.toml
Julian commented 4 years ago

Cool -- that workflow definitely sounds like one I want to work for people (FWIW I do this "manually", which is why I didn't notice it didn't work -- by which I mean I have a bootstrap script for new machines that just runs the single untracked venv of mine -- i.e. virtualenv ~/.local/share/virtualenvs/venvs && ~/.local/share/virtualenvs/venvs/bin/pip install venvs but that's because I was lazy and didn't set this up yet, so yeah +1 for filing, we should fix this.

Julian commented 4 years ago

Possibly though we should make venvs's virtualenv "special" though -- like give it its own config syntax or something, because otherwise yeah the reason this blows up is that it wants to now recreate the venv but then blows itself up when it went and deleted all its own files, so we need some other atomic upgrade to happen there.