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

virtualenv plugin doesn't work with current tox #427

Closed
masklinn opened this issue Sep 30, 2024 · 6 comments
Closed

virtualenv plugin doesn't work with current tox #427

masklinn opened this issue Sep 30, 2024 · 6 comments
Assignees

Comments

@masklinn
Copy link

Trying to add graal to an existing project I'm hitting an issue where it doesn't seem to cooperate with tox / virtualenv. The test project is just composed of 3 files:

pyproject.toml

 [build-system]
 requires = ["setuptools"]
 build-backend = "setuptools.build_meta"

test.py

def test_thing():
    assert 1 == 1

tox.ini

[tox]
env_list = graalpy

[testenv]
package = wheel
deps = pytest
commands = pytest test.py
  • using the global tox (4.20.0 installed via pipx on a 3.10) hits a TypeError:

      File "virtualenv/run/__init__.py", line 51, in session_via_cli
        creator, seeder, activators = tuple(e.create(options) for e in elements)  # create types
      File "virtualenv/run/__init__.py", line 51, in <genexpr>
        creator, seeder, activators = tuple(e.create(options) for e in elements)  # create types
      File "virtualenv/run/plugin/creators.py", line 84, in create
        options.describe = self.describe(options, self.interpreter)
    TypeError: 'NoneType' object is not callable
    
  • creating a local venv using graal, it installs an outdated tox (3.28.0), complains that it wants isolated_build = True, then fails with TypeError: 'NoneType' object is not callable anyway (it doesn't provide a complete traceback, but I assume the issue is similar to the one in 4.20)

@msimacek
Copy link
Contributor

msimacek commented Oct 2, 2024

Unfortunately, virtualenv doesn't know how to create graalpy virtualenvs (and upstream rejected our PR to add it). So as a part of graalpy, we ship a plugin that you can install into the python interpreter you use to run tox (i.e. the global one in you case) to be able to use tox with graalpy. You can install it with

pip install PATH_TO_GRAALPY_INSTALLATION/graalpy_virtualenv

@masklinn
Copy link
Author

masklinn commented Oct 5, 2024

Unfortunately, virtualenv doesn't know how to create graalpy virtualenvs (and upstream rejected our PR to add it). So as a part of graalpy, we ship a plugin that you can install into the python interpreter you use to run tox (i.e. the global one in you case) to be able to use tox with graalpy. You can install it with

pip install PATH_TO_GRAALPY_INSTALLATION/graalpy_virtualenv

It seems rather unhappy with that:

    self.add_selector_arg_parse(name, list(self.possible))
  File "lib/python3.10/site-packages/virtualenv/run/plugin/seeders.py", line 15, in add_selector_arg_parse
    default=self._get_default(),
  File "lib/python3.10/site-packages/graalpy_virtualenv/graalpy.py", line 98, in _seeder_selector_get_default_override
    return _get_default_orig(self)
TypeError: SeederSelector._get_default() takes 0 positional arguments but 1 was given

This is with:

  • graal 24.1.0 installed using pyenv
  • tox 4.20.1 in pipx
    • running on cpython 3.10.11 installed using pyenv

masklinn added a commit to ua-parser/uap-rust that referenced this issue Oct 5, 2024
Advantages
==========

- Can do the entire loading in one shot in pure rust from a python iterable.
- Work using rust semantics.
- Really just works.
- Only requires a pyi for type declarations (?).

Drawbacks
=========

- Likely slower than cffi for pypy, but unlikely to be slower than the
  slog of pure python.
- Graal don't work in tox (oracle/graalpython#427).
masklinn added a commit to ua-parser/uap-rust that referenced this issue Oct 5, 2024
Advantages
==========

- Can do the entire loading in one shot in pure rust from a python iterable.
- Work using rust semantics.
- Really just works.
- Only requires a pyi for type declarations (?).

Drawbacks
=========

- Likely slower than cffi for pypy, but unlikely to be slower than the
  slog of pure python.
- Graal don't work in tox (oracle/graalpython#427).
@msimacek
Copy link
Contributor

msimacek commented Oct 7, 2024

I can reproduce that, it seems that a recent virtualenv release broke the plugin. I'll look into it, thank you for the report

@msimacek msimacek self-assigned this Oct 7, 2024
@msimacek msimacek changed the title tox compatibility? vitrualenv plugin doesn't work with current tox Oct 7, 2024
@msimacek msimacek changed the title vitrualenv plugin doesn't work with current tox virtualenv plugin doesn't work with current tox Oct 7, 2024
@masklinn
Copy link
Author

masklinn commented Oct 7, 2024

🫡

@msimacek
Copy link
Contributor

Fixed on master, you can get the fixed version already by installing the plugin from github:

pip install --force-reinstall 'git+https://github.com/oracle/graalpython#egg=graalpy_virtualenv&subdirectory=graalpy_virtualenv'

@masklinn
Copy link
Author

Finally got around to trying it, it failed with the tox 4.20.1 but after upgrading to 4.21.2 it's now running just fine 👍

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