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

[1.2.0a2] Various issues while trying to develop a plugin #4366

Closed
3 tasks done
mtkennerly opened this issue Aug 9, 2021 · 3 comments
Closed
3 tasks done

[1.2.0a2] Various issues while trying to develop a plugin #4366

mtkennerly opened this issue Aug 9, 2021 · 3 comments
Labels
kind/bug Something isn't working as expected

Comments

@mtkennerly
Copy link

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Windows 10
  • Poetry version: 1.2.0a2
  • Python version: 3.7.0
  • Link of a Gist with the contents of your pyproject.toml file: See below

Files

pyproject.toml:

[tool.poetry]
name = "simple-plugin"
version = "0.1.0"
description = ""
authors = []

[tool.poetry.dependencies]
python = "^3.6"
poetry = "^1.2.0a1"  # ^1.2

[tool.poetry.plugins."poetry.plugin"]
simple-plugin = 'simple_plugin.__init__:SimplePlugin'

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

simple_plugin/__init__.py:

from cleo.io.io import IO

from poetry.plugins.plugin import Plugin
from poetry.poetry import Poetry


class SimplePlugin(Plugin):
    def activate(self, poetry: Poetry, io: IO):
        version = "1.2.3"
        io.write_line(f"Setting package version to <b>{version}</b>")
        poetry.package.set_version(version)

Issue

Hi! I'm trying to update poetry-dynamic-versioning to use the new plugin system (ref: mtkennerly/poetry-dynamic-versioning#39), but I've encountered several issues, and I'm currently unable to proceed because of the last one. To narrow things down, I've reproduced them using a bare-minimum sample plugin. Let me know if you'd like separate reports for each problem, but I didn't want to clutter the issue list if they're ultimately related.

Poetry's cachecontrol dependency is too low

Poetry declares a dependency on:

cachecontrol = { version = "^0.12.4", extras = ["filecache"] }

However, using cachecontrol 0.12.5 produces this error on poetry plugin add -vvv .:

Loading configuration file C:\Users\mtken\AppData\Roaming\pypoetry\config.toml
Loading configuration file C:\Users\mtken\AppData\Roaming\pypoetry\auth.toml

  Stack trace:

  26  c:\python\3.7.0-32\lib\site-packages\cleo\application.py:330 in run
       328│
       329│             try:
     → 330│                 exit_code = self._run(io)
       331│             except Exception as e:
       332│                 if not self._catch_exceptions:

  25  c:\python\3.7.0-32\lib\site-packages\poetry\console\application.py:180 in _run
       178│         self._load_plugins(io)
       179│
     → 180│         return super()._run(io)
       181│
       182│     def _configure_io(self, io: IO) -> None:

  24  c:\python\3.7.0-32\lib\site-packages\cleo\application.py:425 in _run
       423│                 io.set_input(ArgvInput(argv))
       424│
     → 425│         exit_code = self._run_command(command, io)
       426│         self._running_command = None
       427│

  23  c:\python\3.7.0-32\lib\site-packages\cleo\application.py:467 in _run_command
       465│
       466│         if error is not None:
     → 467│             raise error
       468│
       469│         return event.exit_code

  22  c:\python\3.7.0-32\lib\site-packages\cleo\application.py:451 in _run_command
       449│
       450│             if event.command_should_run():
     → 451│                 exit_code = command.run(io)
       452│             else:
       453│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

  21  c:\python\3.7.0-32\lib\site-packages\cleo\commands\base_command.py:118 in run
       116│         io.input.validate()
       117│
     → 118│         status_code = self.execute(io)
       119│
       120│         if status_code is None:

  20  c:\python\3.7.0-32\lib\site-packages\cleo\commands\command.py:85 in execute
        83│
        84│         try:
     →  85│             return self.handle()
        86│         except KeyboardInterrupt:
        87│             return 1

  19  c:\python\3.7.0-32\lib\site-packages\poetry\console\commands\plugin\add.py:99 in handle
        97│             return 0
        98│
     →  99│         plugins = self._determine_requirements(plugins)
       100│
       101│         # We retrieve the packages installed in the system environment.

  18  c:\python\3.7.0-32\lib\site-packages\poetry\console\commands\init.py:341 in _determine_requirements
       339│                     requirement["name"],
       340│                     allow_prereleases=allow_prereleases,
     → 341│                     source=source,
       342│                 )
       343│                 requirement["version"] = version

  17  c:\python\3.7.0-32\lib\site-packages\poetry\console\commands\init.py:376 in _find_best_version_for_package
       374│         selector = VersionSelector(self._get_pool())
       375│         package = selector.find_best_candidate(
     → 376│             name, required_version, allow_prereleases=allow_prereleases, source=source
       377│         )
       378│

  16  c:\python\3.7.0-32\lib\site-packages\poetry\version\version_selector.py:38 in find_best_candidate
        36│             },
        37│         )
     →  38│         candidates = self._pool.find_packages(dependency)
        39│         only_prereleases = all([c.version.is_unstable() for c in candidates])
        40│

  15  c:\python\3.7.0-32\lib\site-packages\poetry\repositories\pool.py:171 in find_packages
       169│         packages = []
       170│         for repo in self._repositories:
     → 171│             packages += repo.find_packages(dependency)
       172│
       173│         return packages

  14  c:\python\3.7.0-32\lib\site-packages\poetry\repositories\pypi_repository.py:108 in find_packages
       106│
       107│         try:
     → 108│             info = self.get_package_info(dependency.name)
       109│         except PackageNotFound:
       110│             self._log(

  13  c:\python\3.7.0-32\lib\site-packages\poetry\repositories\pypi_repository.py:210 in get_package_info
       208│
       209│         return self._cache.store("packages").remember_forever(
     → 210│             name, lambda: self._get_package_info(name)
       211│         )
       212│

  12  ~\AppData\Roaming\Python\Python37\site-packages\cachy\repository.py:174 in remember_forever
       172│             return val
       173│
     → 174│         val = value(callback)
       175│
       176│         self.forever(key, val)

  11  ~\AppData\Roaming\Python\Python37\site-packages\cachy\helpers.py:6 in value
         4│ def value(val):
         5│     if callable(val):
     →   6│         return val()
         7│
         8│     return val

  10  c:\python\3.7.0-32\lib\site-packages\poetry\repositories\pypi_repository.py:210 in <lambda>
       208│
       209│         return self._cache.store("packages").remember_forever(
     → 210│             name, lambda: self._get_package_info(name)
       211│         )
       212│

   9  c:\python\3.7.0-32\lib\site-packages\poetry\repositories\pypi_repository.py:214 in _get_package_info
       212│
       213│     def _get_package_info(self, name: str) -> dict:
     → 214│         data = self._get(f"pypi/{name}/json")
       215│         if data is None:
       216│             raise PackageNotFound(f"Package [{name}] not found.")

   8  c:\python\3.7.0-32\lib\site-packages\poetry\repositories\pypi_repository.py:326 in _get
       324│     def _get(self, endpoint: str) -> Union[dict, None]:
       325│         try:
     → 326│             json_response = self.session.get(self._base_url + endpoint)
       327│         except requests.exceptions.TooManyRedirects:
       328│             # Cache control redirect loop.

   7  c:\python\3.7.0-32\lib\site-packages\requests\sessions.py:555 in get
       553│
       554│         kwargs.setdefault('allow_redirects', True)
     → 555│         return self.request('GET', url, **kwargs)
       556│
       557│     def options(self, url, **kwargs):

   6  c:\python\3.7.0-32\lib\site-packages\requests\sessions.py:542 in request
       540│         }
       541│         send_kwargs.update(settings)
     → 542│         resp = self.send(prep, **send_kwargs)
       543│
       544│         return resp

   5  c:\python\3.7.0-32\lib\site-packages\requests\sessions.py:655 in send
       653│
       654│         # Send the request
     → 655│         r = adapter.send(request, **kwargs)
       656│
       657│         # Total elapsed time of the request (approximately)

   4  c:\python\3.7.0-32\lib\site-packages\cachecontrol\adapter.py:44 in send
        42│         if request.method in cacheable:
        43│             try:
     →  44│                 cached_response = self.controller.cached_request(request)
        45│             except zlib.error:
        46│                 cached_response = None

   3  c:\python\3.7.0-32\lib\site-packages\cachecontrol\controller.py:145 in cached_request
       143│
       144│         # Check whether it can be deserialized
     → 145│         resp = self.serializer.loads(request, cache_data)
       146│         if not resp:
       147│             logger.warning("Cache entry deserialization failed, entry ignored")

   2  c:\python\3.7.0-32\lib\site-packages\cachecontrol\serialize.py:97 in loads
        95│         # Dispatch to the actual load method for the given version
        96│         try:
     →  97│             return getattr(self, "_loads_v{}".format(ver))(request, data)
        98│
        99│         except AttributeError:

   1  c:\python\3.7.0-32\lib\site-packages\cachecontrol\serialize.py:182 in _loads_v4
       180│     def _loads_v4(self, request, data):
       181│         try:
     → 182│             cached = msgpack.loads(data, encoding="utf-8")
       183│         except ValueError:
       184│             return

  TypeError

  unpackb() got an unexpected keyword argument 'encoding'

  at msgpack\_unpacker.pyx:144 in msgpack._cmsgpack.unpackb

This can be fixed by upgrading to cachecontrol 0.12.6.

Can't refer to current project with . when adding plugin

poetry plugin add -vvv . yields this error:

Loading configuration file C:\Users\mtken\AppData\Roaming\pypoetry\config.toml
Loading configuration file C:\Users\mtken\AppData\Roaming\pypoetry\auth.toml

  Stack trace:

  9  c:\python\3.7.0-32\lib\site-packages\cleo\application.py:330 in run
      328│
      329│             try:
    → 330│                 exit_code = self._run(io)
      331│             except Exception as e:
      332│                 if not self._catch_exceptions:

  8  c:\python\3.7.0-32\lib\site-packages\poetry\console\application.py:180 in _run
      178│         self._load_plugins(io)
      179│
    → 180│         return super()._run(io)
      181│
      182│     def _configure_io(self, io: IO) -> None:

  7  c:\python\3.7.0-32\lib\site-packages\cleo\application.py:425 in _run
      423│                 io.set_input(ArgvInput(argv))
      424│
    → 425│         exit_code = self._run_command(command, io)
      426│         self._running_command = None
      427│

  6  c:\python\3.7.0-32\lib\site-packages\cleo\application.py:467 in _run_command
      465│
      466│         if error is not None:
    → 467│             raise error
      468│
      469│         return event.exit_code

  5  c:\python\3.7.0-32\lib\site-packages\cleo\application.py:451 in _run_command
      449│
      450│             if event.command_should_run():
    → 451│                 exit_code = command.run(io)
      452│             else:
      453│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

  4  c:\python\3.7.0-32\lib\site-packages\cleo\commands\base_command.py:118 in run
      116│         io.input.validate()
      117│
    → 118│         status_code = self.execute(io)
      119│
      120│         if status_code is None:

  3  c:\python\3.7.0-32\lib\site-packages\cleo\commands\command.py:85 in execute
       83│
       84│         try:
    →  85│             return self.handle()
       86│         except KeyboardInterrupt:
       87│             return 1

  2  c:\python\3.7.0-32\lib\site-packages\poetry\console\commands\plugin\add.py:99 in handle
       97│             return 0
       98│
    →  99│         plugins = self._determine_requirements(plugins)
      100│
      101│         # We retrieve the packages installed in the system environment.

  1  c:\python\3.7.0-32\lib\site-packages\poetry\console\commands\init.py:341 in _determine_requirements
      339│                     requirement["name"],
      340│                     allow_prereleases=allow_prereleases,
    → 341│                     source=source,
      342│                 )
      343│                 requirement["version"] = version

  ValueError

  Could not find a matching version of package .

  at c:\python\3.7.0-32\lib\site-packages\poetry\console\commands\init.py:382 in _find_best_version_for_package
      378│
      379│         if not package:
      380│             # TODO: find similar
      381│             raise ValueError(
    → 382│                 "Could not find a matching version of package {}".format(name)
      383│             )
      384│
      385│         return package.pretty_name, selector.find_recommended_require_version(package)
      386│

I can work around this by building a wheel and adding that instead.

Can't use relative path to wheel when adding plugin

poetry build followed by poetry plugin add -vvv dist\simple_plugin-0.1.0-py3-none-any.whl yields this error:

Loading configuration file C:\Users\mtken\AppData\Roaming\pypoetry\config.toml
Loading configuration file C:\Users\mtken\AppData\Roaming\pypoetry\auth.toml

  Stack trace:

  12  c:\python\3.7.0-32\lib\site-packages\cleo\application.py:330 in run
       328│
       329│             try:
     → 330│                 exit_code = self._run(io)
       331│             except Exception as e:
       332│                 if not self._catch_exceptions:

  11  c:\python\3.7.0-32\lib\site-packages\poetry\console\application.py:180 in _run
       178│         self._load_plugins(io)
       179│
     → 180│         return super()._run(io)
       181│
       182│     def _configure_io(self, io: IO) -> None:

  10  c:\python\3.7.0-32\lib\site-packages\cleo\application.py:425 in _run
       423│                 io.set_input(ArgvInput(argv))
       424│
     → 425│         exit_code = self._run_command(command, io)
       426│         self._running_command = None
       427│

   9  c:\python\3.7.0-32\lib\site-packages\cleo\application.py:467 in _run_command
       465│
       466│         if error is not None:
     → 467│             raise error
       468│
       469│         return event.exit_code

   8  c:\python\3.7.0-32\lib\site-packages\cleo\application.py:451 in _run_command
       449│
       450│             if event.command_should_run():
     → 451│                 exit_code = command.run(io)
       452│             else:
       453│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

   7  c:\python\3.7.0-32\lib\site-packages\cleo\commands\base_command.py:118 in run
       116│         io.input.validate()
       117│
     → 118│         status_code = self.execute(io)
       119│
       120│         if status_code is None:

   6  c:\python\3.7.0-32\lib\site-packages\cleo\commands\command.py:85 in execute
        83│
        84│         try:
     →  85│             return self.handle()
        86│         except KeyboardInterrupt:
        87│             return 1

   5  c:\python\3.7.0-32\lib\site-packages\poetry\console\commands\plugin\add.py:162 in handle
       160│         # We won't go through the event dispatching done by the application
       161│         # so we need to configure the command manually
     → 162│         update_command.set_poetry(Factory().create_poetry(env_dir))
       163│         update_command.set_env(system_env)
       164│         application._configure_installer(update_command, self._io)

   4  c:\python\3.7.0-32\lib\site-packages\poetry\factory.py:44 in create_poetry
        42│             io = NullIO()
        43│
     →  44│         base_poetry = super(Factory, self).create_poetry(cwd)
        45│
        46│         locker = Locker(

   3  c:\python\3.7.0-32\lib\site-packages\poetry\core\factory.py:52 in create_poetry
        50│         package = self.get_package(name, version)
        51│         package = self.configure_package(
     →  52│             package, local_config, poetry_file.parent, with_groups=with_groups
        53│         )
        54│

   2  c:\python\3.7.0-32\lib\site-packages\poetry\core\factory.py:120 in configure_package
       118│
       119│                 group.add_dependency(
     → 120│                     cls.create_dependency(name, constraint, root_dir=package.root_dir)
       121│                 )
       122│

   1  c:\python\3.7.0-32\lib\site-packages\poetry\core\factory.py:317 in create_dependency
       315│                         base=root_dir,
       316│                         develop=constraint.get("develop", False),
     → 317│                         extras=constraint.get("extras", []),
       318│                     )
       319│             elif "url" in constraint:

  ValueError

  Directory dist\simple_plugin-0.1.0-py3-none-any.whl does not exist

  at c:\python\3.7.0-32\lib\site-packages\poetry\core\packages\directory_dependency.py:43 in __init__
       39│         self._develop = develop
       40│         self._supports_poetry = False
       41│
       42│         if not self._full_path.exists():
    →  43│             raise ValueError("Directory {} does not exist".format(self._path))
       44│
       45│         if self._full_path.is_file():
       46│             raise ValueError("{} is a file, expected a directory".format(self._path))
       47│

I can work around this by using an absolute path.

Poetry's dataclasses dependency blocks Python 3.7 when adding plugin

Poetry declares a dependency on:

dataclasses = {version = "^0.8", python = "~3.6"}

poetry plugin add -vvv C:\tmp\simple-plugin\dist\simple_plugin-0.1.0-py3-none-any.whl yields this error:

Loading configuration file C:\Users\mtken\AppData\Roaming\pypoetry\config.toml
Loading configuration file C:\Users\mtken\AppData\Roaming\pypoetry\auth.toml
Updating dependencies
Resolving dependencies...
   1: fact: poetry is 1.2.0a2
   1: derived: poetry
   1: fact: poetry depends on cachecontrol (>=0.12.4,<0.13.0)
   1: fact: poetry depends on cachy (>=0.3.0,<0.4.0)
   1: fact: poetry depends on cleo (>=1.0.0a4,<2.0.0)
   1: fact: poetry depends on crashtest (>=0.3.0,<0.4.0)
   1: fact: poetry depends on dataclasses (>=0.8,<0.9)
   1: fact: poetry depends on entrypoints (>=0.3,<0.4)
   1: fact: poetry depends on html5lib (>=1.0,<2.0)
   1: fact: poetry depends on importlib-metadata (>=1.6.0,<2.0.0)
   1: fact: poetry depends on keyring (>=21.2.0)
   1: fact: poetry depends on packaging (>=20.4,<21.0)
   1: fact: poetry depends on pexpect (>=4.7.0,<5.0.0)
   1: fact: poetry depends on pkginfo (>=1.5,<2.0)
   1: fact: poetry depends on poetry-core (>=1.1.0a6,<2.0.0)
   1: fact: poetry depends on requests (>=2.18,<3.0)
   1: fact: poetry depends on requests-toolbelt (>=0.9.1,<0.10.0)
   1: fact: poetry depends on shellingham (>=1.1,<2.0)
   1: fact: poetry depends on tomlkit (>=0.7.0,<1.0.0)
   1: fact: poetry depends on virtualenv (>=20.4.3,<20.4.5)
   1: fact: poetry depends on poetry-version-plugin (^0.1.3)
   1: fact: poetry depends on poetry-dynamic-versioning (0.14.0a1)
   1: fact: poetry depends on simple-plugin (0.1.0)
   1: selecting poetry (1.2.0a2)
   1: derived: simple-plugin (0.1.0 C:\tmp\simple-plugin\dist\simple_plugin-0.1.0-py3-none-any.whl)
   1: derived: poetry-dynamic-versioning (0.14.0a1 D:\GitHub\mtkennerly\poetry-dynamic-versioning\dist\poetry_dynamic_versioning-0.14.0a1-py3-none-any.whl)
   1: derived: poetry-version-plugin (>=0.1.3,<0.2.0)
   1: derived: virtualenv (>=20.4.3,<20.4.5)
   1: derived: tomlkit (>=0.7.0,<1.0.0)
   1: derived: shellingham (>=1.1,<2.0)
   1: derived: requests-toolbelt (>=0.9.1,<0.10.0)
   1: derived: requests (>=2.18,<3.0)
   1: derived: poetry-core (>=1.1.0a6,<2.0.0)
   1: derived: pkginfo (>=1.5,<2.0)
   1: derived: pexpect (>=4.7.0,<5.0.0)
   1: derived: packaging (>=20.4,<21.0)
   1: derived: keyring (>=21.2.0)
   1: derived: importlib-metadata (>=1.6.0,<2.0.0)
   1: derived: html5lib (>=1.0,<2.0)
   1: derived: entrypoints (>=0.3,<0.4)
   1: derived: dataclasses (>=0.8,<0.9)
   1: derived: crashtest (>=0.3.0,<0.4.0)
   1: derived: cleo (>=1.0.0a4,<2.0.0)
   1: derived: cachy (>=0.3.0,<0.4.0)
   1: derived: cachecontrol[filecache] (>=0.12.4,<0.13.0)
   1: fact: simple-plugin (0.1.0) depends on poetry (>=1.2.0a1,<2.0.0)
   1: selecting simple-plugin (0.1.0 C:/tmp/simple-plugin/dist/simple_plugin-0.1.0-py3-none-any.whl)
   1: fact: poetry-dynamic-versioning (0.14.0a1) depends on dunamai (>=1.5,<2.0)
   1: fact: poetry-dynamic-versioning (0.14.0a1) depends on jinja2 (>=2.11.1,<4)
   1: fact: poetry-dynamic-versioning (0.14.0a1) depends on poetry (>=1.2.0a1,<2.0.0)
   1: selecting poetry-dynamic-versioning (0.14.0a1 D:/GitHub/mtkennerly/poetry-dynamic-versioning/dist/poetry_dynamic_versioning-0.14.0a1-py3-none-any.whl)
   1: derived: jinja2 (>=2.11.1,<4)
   1: derived: dunamai (>=1.5,<2.0)
   1: fact: poetry-version-plugin (0.1.3) depends on poetry (>=1.2.0a1,<2.0.0)
   1: selecting poetry-version-plugin (0.1.3)
   1: fact: virtualenv (20.4.4) depends on appdirs (>=1.4.3,<2)
   1: fact: virtualenv (20.4.4) depends on distlib (>=0.3.1,<1)
   1: fact: virtualenv (20.4.4) depends on filelock (>=3.0.0,<4)
   1: fact: virtualenv (20.4.4) depends on six (>=1.9.0,<2)
   1: fact: virtualenv (20.4.4) depends on importlib-metadata (>=0.12)
   1: selecting virtualenv (20.4.4)
   1: derived: six (>=1.9.0,<2)
   1: derived: filelock (>=3.0.0,<4)
   1: derived: distlib (>=0.3.1,<1)
   1: derived: appdirs (>=1.4.3,<2)
   1: selecting tomlkit (0.7.2)
   1: selecting shellingham (1.4.0)
   1: fact: requests-toolbelt (0.9.1) depends on requests (>=2.0.1,<3.0.0)
   1: selecting requests-toolbelt (0.9.1)
   1: fact: requests (2.26.0) depends on urllib3 (>=1.21.1,<1.27)
   1: fact: requests (2.26.0) depends on certifi (>=2017.4.17)
   1: fact: requests (2.26.0) depends on charset-normalizer (>=2.0.0,<2.1.0)
   1: fact: requests (2.26.0) depends on idna (>=2.5,<4)
   1: selecting requests (2.26.0)
   1: derived: idna (>=2.5,<4)
   1: derived: charset-normalizer (>=2.0.0,<2.1.0)
   1: derived: certifi (>=2017.4.17)
   1: derived: urllib3 (>=1.21.1,<1.27)
   1: fact: poetry-core (1.1.0a6) depends on importlib-metadata (>=1.7.0)
   1: selecting poetry-core (1.1.0a6)
   1: derived: importlib-metadata (>=1.7.0)
   1: selecting pkginfo (1.7.1)
   1: fact: pexpect (4.8.0) depends on ptyprocess (>=0.5)
   1: selecting pexpect (4.8.0)
   1: derived: ptyprocess (>=0.5)
   1: fact: packaging (20.9) depends on pyparsing (>=2.0.2)
   1: selecting packaging (20.9)
   1: derived: pyparsing (>=2.0.2)
   1: fact: keyring (22.3.0) depends on importlib-metadata (>=1)
   1: fact: keyring (22.3.0) depends on SecretStorage (>=3.2)
   1: fact: keyring (22.3.0) depends on jeepney (>=0.4.2)
   1: fact: keyring (22.3.0) depends on pywin32-ctypes (<0.1.0 || >0.1.0,<0.1.1 || >0.1.1)
   1: selecting keyring (22.3.0)
   1: derived: pywin32-ctypes (!=0.1.0,!=0.1.1)
   1: derived: jeepney (>=0.4.2)
   1: derived: SecretStorage (>=3.2)
   1: fact: html5lib (1.1) depends on six (>=1.9)
   1: fact: html5lib (1.1) depends on webencodings (*)
   1: selecting html5lib (1.1)
   1: derived: webencodings
   1: selecting entrypoints (0.3)
   1: selecting crashtest (0.3.1)
   1: fact: cleo (1.0.0a4) depends on pylev (>=1.3.0,<2.0.0)
   1: fact: cleo (1.0.0a4) depends on crashtest (>=0.3.1,<0.4.0)
   1: selecting cleo (1.0.0a4)
   1: derived: pylev (>=1.3.0,<2.0.0)
   1: selecting cachy (0.3.0)
   1: selecting six (1.16.0)
   1: selecting filelock (3.0.12)
   1: selecting distlib (0.3.2)
   1: selecting appdirs (1.4.4)
   1: selecting certifi (2021.5.30)
   1: selecting urllib3 (1.26.6)
   1: selecting ptyprocess (0.7.0)
   1: selecting pyparsing (2.4.7)
   1: selecting webencodings (0.5.1)
   1: selecting pylev (1.4.0)
   1: fact: cachecontrol (0.12.6) depends on cachecontrol (0.12.6)
   1: fact: cachecontrol (0.12.6) depends on requests (*)
   1: fact: cachecontrol (0.12.6) depends on msgpack (>=0.5.2)
   1: fact: cachecontrol (0.12.6) depends on lockfile (>=0.9)
   1: selecting cachecontrol[filecache] (0.12.6)
   1: derived: lockfile (>=0.9)
   1: derived: msgpack (>=0.5.2)
   1: derived: cachecontrol (==0.12.6)
   1: selecting msgpack (1.0.2)
   1: fact: jinja2 (3.0.1) depends on MarkupSafe (>=2.0)
   1: selecting jinja2 (3.0.1)
   1: derived: MarkupSafe (>=2.0)
   1: selecting markupsafe (2.0.1)
   1: fact: dunamai (1.6.0) depends on setuptools (>=8.0)
   1: selecting dunamai (1.6.0)
   1: derived: setuptools (>=8.0)
   1: selecting setuptools (57.4.0)
   1: fact: importlib-metadata (1.7.0) depends on zipp (>=0.5)
   1: selecting importlib-metadata (1.7.0)
   1: derived: zipp (>=0.5)
   1: selecting zipp (3.5.0)
   1: fact: dataclasses (0.8) requires Python >=3.6, <3.7
   1: derived: not dataclasses (==0.8)
   1: fact: no versions of dataclasses match >0.8,<0.9
   1: conflict: no versions of dataclasses match >0.8,<0.9
   1: derived: not dataclasses (>0.8,<0.9)
   1: conflict: dataclasses (0.8) requires Python >=3.6, <3.7
   1: ! dataclasses (==0.8) is partially satisfied by not dataclasses (>0.8,<0.9)
   1: ! which is caused by "no versions of dataclasses match >0.8,<0.9"
   1: ! thus: dataclasses is forbidden
   1: ! dataclasses (>=0.8,<0.9) is satisfied by dataclasses (>=0.8,<0.9)
   1: ! which is caused by "poetry depends on dataclasses (>=0.8,<0.9)"
   1: ! thus: version solving failed
   1: Version solving took 0.593 seconds.
   1: Tried 1 solutions.

  Stack trace:

  4  c:\python\3.7.0-32\lib\site-packages\poetry\puzzle\solver.py:139 in _solve
      137│         try:
      138│             result = resolve_version(
    → 139│                 self._package, self._provider, locked=locked, use_latest=use_latest
      140│             )
      141│

  3  c:\python\3.7.0-32\lib\site-packages\poetry\mixology\__init__.py:24 in resolve_version
       22│     solver = VersionSolver(root, provider, locked=locked, use_latest=use_latest)
       23│
    →  24│     return solver.solve()
       25│

  2  c:\python\3.7.0-32\lib\site-packages\poetry\mixology\version_solver.py:81 in solve
       79│             next = self._root.name
       80│             while next is not None:
    →  81│                 self._propagate(next)
       82│                 next = self._choose_package_version()
       83│

  1  c:\python\3.7.0-32\lib\site-packages\poetry\mixology\version_solver.py:121 in _propagate
      119│                     # where that incompatibility will allow us to derive new assignments
      120│                     # that avoid the conflict.
    → 121│                     root_cause = self._resolve_conflict(incompatibility)
      122│
      123│                     # Back jumping erases all the assignments we did at the previous

  SolveFailure

  The current project's Python requirement (3.7.0) is not compatible with some of the required packages Python requirement:
    - dataclasses requires Python >=3.6, <3.7, so it will not be satisfied for Python 3.7.0

  Because dataclasses (0.8) requires Python >=3.6, <3.7
   and no versions of dataclasses match >0.8,<0.9, dataclasses is forbidden.
  So, because poetry depends on dataclasses (>=0.8,<0.9), version solving failed.

  at c:\python\3.7.0-32\lib\site-packages\poetry\mixology\version_solver.py:315 in _resolve_conflict
      311│             )
      312│             self._log(f'{bang} which is caused by "{most_recent_satisfier.cause}"')
      313│             self._log(f"{bang} thus: {incompatibility}")
      314│
    → 315│         raise SolveFailure(incompatibility)
      316│
      317│     def _choose_package_version(self) -> Optional[str]:
      318│         """
      319│         Tries to select a version of a required package.

The following error occurred when trying to handle this error:


  Stack trace:

  14  c:\python\3.7.0-32\lib\site-packages\cleo\application.py:330 in run
       328│
       329│             try:
     → 330│                 exit_code = self._run(io)
       331│             except Exception as e:
       332│                 if not self._catch_exceptions:

  13  c:\python\3.7.0-32\lib\site-packages\poetry\console\application.py:180 in _run
       178│         self._load_plugins(io)
       179│
     → 180│         return super()._run(io)
       181│
       182│     def _configure_io(self, io: IO) -> None:

  12  c:\python\3.7.0-32\lib\site-packages\cleo\application.py:425 in _run
       423│                 io.set_input(ArgvInput(argv))
       424│
     → 425│         exit_code = self._run_command(command, io)
       426│         self._running_command = None
       427│

  11  c:\python\3.7.0-32\lib\site-packages\cleo\application.py:467 in _run_command
       465│
       466│         if error is not None:
     → 467│             raise error
       468│
       469│         return event.exit_code

  10  c:\python\3.7.0-32\lib\site-packages\cleo\application.py:451 in _run_command
       449│
       450│             if event.command_should_run():
     → 451│                 exit_code = command.run(io)
       452│             else:
       453│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

   9  c:\python\3.7.0-32\lib\site-packages\cleo\commands\base_command.py:118 in run
       116│         io.input.validate()
       117│
     → 118│         status_code = self.execute(io)
       119│
       120│         if status_code is None:

   8  c:\python\3.7.0-32\lib\site-packages\cleo\commands\command.py:85 in execute
        83│
        84│         try:
     →  85│             return self.handle()
        86│         except KeyboardInterrupt:
        87│             return 1

   7  c:\python\3.7.0-32\lib\site-packages\poetry\console\commands\plugin\add.py:174 in handle
       172│                 StringInput(" ".join(argv)),
       173│                 self._io.output,
     → 174│                 self._io.error_output,
       175│             )
       176│         )

   6  c:\python\3.7.0-32\lib\site-packages\cleo\commands\base_command.py:118 in run
       116│         io.input.validate()
       117│
     → 118│         status_code = self.execute(io)
       119│
       120│         if status_code is None:

   5  c:\python\3.7.0-32\lib\site-packages\cleo\commands\command.py:85 in execute
        83│
        84│         try:
     →  85│             return self.handle()
        86│         except KeyboardInterrupt:
        87│             return 1

   4  c:\python\3.7.0-32\lib\site-packages\poetry\console\commands\update.py:49 in handle
        47│         self._installer.update(True)
        48│
     →  49│         return self._installer.run()
        50│

   3  c:\python\3.7.0-32\lib\site-packages\poetry\installation\installer.py:114 in run
       112│         local_repo = Repository()
       113│
     → 114│         return self._do_install(local_repo)
       115│
       116│     def dry_run(self, dry_run: bool = True) -> "Installer":

   2  c:\python\3.7.0-32\lib\site-packages\poetry\installation\installer.py:251 in _do_install
       249│             )
       250│
     → 251│             ops = solver.solve(use_latest=self._whitelist).calculate_operations()
       252│         else:
       253│             self._io.write_line("Installing dependencies from lock file")

   1  c:\python\3.7.0-32\lib\site-packages\poetry\puzzle\solver.py:77 in solve
        75│         with self._provider.progress():
        76│             start = time.time()
     →  77│             packages, depths = self._solve(use_latest=use_latest)
        78│             end = time.time()
        79│

  SolverProblemError

  The current project's Python requirement (3.7.0) is not compatible with some of the required packages Python requirement:
    - dataclasses requires Python >=3.6, <3.7, so it will not be satisfied for Python 3.7.0

  Because dataclasses (0.8) requires Python >=3.6, <3.7
   and no versions of dataclasses match >0.8,<0.9, dataclasses is forbidden.
  So, because poetry depends on dataclasses (>=0.8,<0.9), version solving failed.

  at c:\python\3.7.0-32\lib\site-packages\poetry\puzzle\solver.py:146 in _solve
      142│             packages = result.packages
      143│         except OverrideNeeded as e:
      144│             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      145│         except SolveFailure as e:
    → 146│             raise SolverProblemError(e)
      147│
      148│         # NOTE passing explicit empty array for seen to reset between invocations during update + install cycle
      149│         results = dict(
      150│             depth_first_search(

  • Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties

    For dataclasses, a possible solution would be to set the `python` property to "<empty>"

    https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
    https://python-poetry.org/docs/dependency-specification/#using-environment-markers

I'm not sure how to resolve or work around this one, so it's currently a blocker for me.

@mtkennerly mtkennerly added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Aug 9, 2021
@noahp
Copy link

noahp commented Oct 6, 2021

I just tested this myself (BTW, thank you for the Dunamai and poetry-dynamic-versioning , very helpful packages!), and it seemed to work only after I created a fresh virtualenv:

# copy the example simple-plugin pyproject.toml and __init__.py file into the cwd
.
├── pyproject.toml
└── simple_plugin
    └── __init__.py
# make sure we're outside all our virtualenvs etc. I used a pipx installed version of poetry 1.1.10 to start with
$ poetry shell
$ pip install poetry==1.2.0a2  # installing to the poetry virtualenv
$ exit
$ poetry shell  # go back in to the virtualenv
$ which poetry
/home/noah/.cache/pypoetry/virtualenvs/simple-plugin-SCbmyHCo-py3.9/bin/poetry
$ poetry build && poetry plugin add -vvv $PWD/dist/simple_plugin-0.1.0-py3-none-any.whl
$ poetry plugin show

  • simple-plugin (0.1.0)
      1 plugin

      Dependencies
        - poetry (>=1.2.0a1,<2.0.0)

It did NOT work when updating existing poetry to 1.2.0.a2 (same errors as you had). I was using python 3.9.5.

@mtkennerly
Copy link
Author

Thanks! I just tried again, and I'm able to make progress now.

Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

3 participants