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

Support for PEP 660 editable backend with different build-system #5655

Closed
2 tasks done
zifeo opened this issue May 20, 2022 · 21 comments · Fixed by python-poetry/poetry-core#368
Closed
2 tasks done
Labels
kind/feature Feature requests/implementations

Comments

@zifeo
Copy link

zifeo commented May 20, 2022

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

Currently poetry supports setup.py or poetry based local package:

[tool.poetry.dependencies]
native = { path = "./native", develop = true }

However other build-systems are not supported (e.g. https://maturin.rs/develop.html#pep-660-editable-installs)

@zifeo zifeo added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels May 20, 2022
@abn
Copy link
Member

abn commented May 20, 2022

What version of poetry are you using? Maybe try master?

https://github.com/python-poetry/poetry/blob/master/src/poetry/installation/executor.py#L572-L573

We should already be running pip install -e dir.

@zifeo
Copy link
Author

zifeo commented May 21, 2022

@abn Yes... I have a really hard time figuring what happened with poetry versions. Either there is a nasty/hidden item I am unable to remove, either there is definitely something wrong in the jump from 1.1 to 1.2. I started by cleaning any poetry related installations/folders, then got the same result with master whatever the installation method I use.

⋊> ~/D/m/m/example on main ⨯ which python
⋊> ~/D/m/m/example on main ⨯ which python3
/opt/homebrew/bin/python3
⋊> ~/D/m/m/example on main ⨯ which poetry
⋊> ~/D/m/m/example on main ⨯ /opt/homebrew/opt/python@3.10/bin/python3 -m venv .venv
⋊> ~/D/m/m/example on main ⨯ .venv/bin/activate.fish
(.venv) ⋊> ~/D/m/m/example on main ⨯ which python3
[REDACTED]/example/.venv/bin/python3
(.venv) ⋊> ~/D/m/m/example on main ⨯ which poetry
(.venv) ⋊> ~/D/m/m/example on main ⨯ pipx install git+https://github.com/python-poetry/poetry@master
  installed package poetry 1.2.0b2.dev0, installed using Python 3.10.4
  These apps are now globally available
    - poetry
done! ✨ 🌟 ✨
(.venv) ⋊> ~/D/m/m/example on main ⨯ which poetry
[REDACTED]/.local/bin/poetry
(.venv) ⋊> ~/D/m/m/example on main ⨯ poetry --version
Poetry (version 1.2.0b2.dev0)
(.venv) ⋊> ~/D/m/m/example on main ⨯ poetry install
Updating dependencies
Resolving dependencies... (0.0s)

  ValueError

  Directory [REDACTED]/native does not seem to be a Python package
[project]
name = "native"
requires-python = ">=3.6"

[build-system]
requires = ["maturin>=0.12,<0.13"]
build-backend = "maturin"

@Secrus
Copy link
Member

Secrus commented May 21, 2022

[project]
name = "native"
requires-python = ">=3.6"

[build-system]
requires = ["maturin>=0.12,<0.13"]
build-backend = "maturin"

If this is your pyproject.toml file, then poetry won't pick it up as it lacks [tool.poetry] section. For now, PEPs 621 and 631 are not supported. This might be a feature introduced in poetry 2.0. See #3332.

@Secrus Secrus removed the status/triage This issue needs to be triaged label May 21, 2022
@abn
Copy link
Member

abn commented May 23, 2022

does not seem to be a Python package

@zifeo can you post the logs for the same command but with -vvv? Ideally using poetry from master.

Install Poetry from VCS

pipx install --force --suffix=@git 'poetry @ git+https://github.com/python-poetry/poetry.git'

@Secrus seems the issue here is during project inspection, we should in theory support any project that is built by a PEP 517 build backend. Unless I am missing something obvious here.

I suspect the relevant code is here.

def from_directory(cls, path: Path, disable_build: bool = False) -> PackageInfo:
"""
Generate package information from a package source directory. If `disable_build`
is not `True` and introspection of all available metadata fails, the package is
attempted to be built in an isolated environment so as to generate required
metadata.
:param path: Path to generate package information from.
:param disable_build: If not `True` and setup reader fails, PEP 517 isolated
build is attempted in order to gather metadata.
"""
project_package = cls._get_poetry_package(path)
info: PackageInfo | None
if project_package:
info = cls.from_package(project_package)
else:
info = cls.from_metadata(path)
if not info or info.requires_dist is None:
try:
if disable_build:
info = cls.from_setup_files(path)
else:
info = get_pep517_metadata(path)
except PackageInfoError:
if not info:
raise
# we discovered PkgInfo but no requirements were listed
info._source_type = "directory"
info._source_url = path.as_posix()
return info

@zifeo
Copy link
Author

zifeo commented May 23, 2022

@abn Thanks. Following the output/logs and adding a poetry section does the job. I guess this can be closed in favour of the release 1.2 and #3332.

[tool.poetry]
name = "native"
version = "0.1.0"
description = ""
authors = []

@abn
Copy link
Member

abn commented May 23, 2022

@zifeo I don't think that is the right solution here though. What you have done is basically fed poetry that information. Ideally, that should come from maturin. What I suspect is happening is that something fails when poetry tries to build your project's metadata. I cannot determine that without the logs unfortunately or a test project.

@zifeo
Copy link
Author

zifeo commented May 24, 2022

@abn

(.venv) ⋊> ~/D/m/m/t/native on main ⨯ poetry@git install -vvv

  Stack trace:

  15  ~/.local/pipx/venvs/poetry@git/lib/python3.10/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:

  14  ~/.local/pipx/venvs/poetry@git/lib/python3.10/site-packages/poetry/console/application.py:182 in _run
       180│         self._load_plugins(io)
       181│ 
     → 182│         exit_code: int = super()._run(io)
       183│         return exit_code
       184│ 

  13  ~/.local/pipx/venvs/poetry@git/lib/python3.10/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│ 

  12  ~/.local/pipx/venvs/poetry@git/lib/python3.10/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

  11  ~/.local/pipx/venvs/poetry@git/lib/python3.10/site-packages/cleo/application.py:448 in _run_command
       446│ 
       447│         try:
     → 448│             self._event_dispatcher.dispatch(event, COMMAND)
       449│ 
       450│             if event.command_should_run():

  10  ~/.local/pipx/venvs/poetry@git/lib/python3.10/site-packages/cleo/events/event_dispatcher.py:22 in dispatch
        20│ 
        21│         if listeners:
     →  22│             self._do_dispatch(listeners, event_name, event)
        23│ 
        24│         return event

   9  ~/.local/pipx/venvs/poetry@git/lib/python3.10/site-packages/cleo/events/event_dispatcher.py:89 in _do_dispatch
        87│                 break
        88│ 
     →  89│             listener(event, event_name, self)
        90│ 
        91│     def _sort_listeners(self, event_name: str) -> None:

   8  ~/.local/pipx/venvs/poetry@git/lib/python3.10/site-packages/poetry/console/application.py:289 in configure_env
       287│ 
       288│         io = event.io
     → 289│         poetry = command.poetry
       290│ 
       291│         env_manager = EnvManager(poetry)

   7  ~/.local/pipx/venvs/poetry@git/lib/python3.10/site-packages/poetry/console/commands/command.py:23 in poetry
        21│     def poetry(self) -> Poetry:
        22│         if self._poetry is None:
     →  23│             return self.get_application().poetry
        24│ 
        25│         return self._poetry

   6  ~/.local/pipx/venvs/poetry@git/lib/python3.10/site-packages/poetry/console/application.py:122 in poetry
       120│             return self._poetry
       121│ 
     → 122│         self._poetry = Factory().create_poetry(
       123│             Path.cwd(),
       124│             io=self._io,

   5  ~/.local/pipx/venvs/poetry@git/lib/python3.10/site-packages/poetry/factory.py:59 in create_poetry
        57│             io = NullIO()
        58│ 
     →  59│         base_poetry = super().create_poetry(cwd)
        60│ 
        61│         locker = Locker(

   4  ~/.local/pipx/venvs/poetry@git/lib/python3.10/site-packages/poetry/core/factory.py:62 in create_poetry
        60│         version = cast(str, local_config["version"])
        61│         package = self.get_package(name, version)
     →  62│         package = self.configure_package(
        63│             package, local_config, poetry_file.parent, with_groups=with_groups
        64│         )

   3  ~/.local/pipx/venvs/poetry@git/lib/python3.10/site-packages/poetry/core/factory.py:156 in configure_package
       154│ 
       155│         if "dependencies" in config:
     → 156│             cls._add_package_group_dependencies(
       157│                 package=package, group=MAIN_GROUP, dependencies=config["dependencies"]
       158│             )

   2  ~/.local/pipx/venvs/poetry@git/lib/python3.10/site-packages/poetry/core/factory.py:102 in _add_package_group_dependencies
       100│ 
       101│                 group.add_dependency(
     → 102│                     cls.create_dependency(
       103│                         name,
       104│                         _constraint,

   1  ~/.local/pipx/venvs/poetry@git/lib/python3.10/site-packages/poetry/core/factory.py:313 in create_dependency
       311│                     )
       312│                 else:
     → 313│                     dependency = DirectoryDependency(
       314│                         name,
       315│                         path,

  ValueError

  Directory [REDACTED]/native does not seem to be a Python package

  at ~/.local/pipx/venvs/poetry@git/lib/python3.10/site-packages/poetry/core/packages/directory_dependency.py:54 in __init__
       50│             self._full_path / "pyproject.toml"
       51│         ).is_poetry_project()
       52│ 
       53│         if not setup.exists() and not self._supports_poetry:
    →  54│             raise ValueError(
       55│                 f"Directory {self._full_path} does not seem to be a Python package"
       56│             )
       57│ 
       58│         super().__init__(

@abn
Copy link
Member

abn commented May 24, 2022

Ah. Thanks @zifeo. This gives a better picture of what's going on. We seem to be overly restrictive on what constitutes a python project. We should really be checking for the presence of the build-system section prior to checking for setup.py.

@abn
Copy link
Member

abn commented May 24, 2022

@zifeo would be great if you can test the fix as detailed in python-poetry/poetry-core#368 (comment). Note that I'd recommend you remove the tool.poetry section in your native project.

@zifeo
Copy link
Author

zifeo commented May 24, 2022

@abn Followed instruction and got a similar behaviour (no tool.poetry in the pyproject.toml)

poetry@5655 install -vvv                                                                                                                                                                     (kiwi-infra/data) 21:25:14
Configuration file exists at [REDACTED]/Library/Application Support/pypoetry, reusing this directory.

Consider moving configuration to [REDACTED]/Library/Preferences/pypoetry, as support for the legacy directory will be removed in an upcoming release.

  Stack trace:

  15  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/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:

  14  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/console/application.py:182 in _run
       180│         self._load_plugins(io)
       181│ 
     → 182│         exit_code: int = super()._run(io)
       183│         return exit_code
       184│ 

  13  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/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│ 

  12  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/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

  11  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/cleo/application.py:448 in _run_command
       446│ 
       447│         try:
     → 448│             self._event_dispatcher.dispatch(event, COMMAND)
       449│ 
       450│             if event.command_should_run():

  10  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/cleo/events/event_dispatcher.py:22 in dispatch
        20│ 
        21│         if listeners:
     →  22│             self._do_dispatch(listeners, event_name, event)
        23│ 
        24│         return event

   9  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/cleo/events/event_dispatcher.py:89 in _do_dispatch
        87│                 break
        88│ 
     →  89│             listener(event, event_name, self)
        90│ 
        91│     def _sort_listeners(self, event_name: str) -> None:

   8  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/console/application.py:289 in configure_env
       287│ 
       288│         io = event.io
     → 289│         poetry = command.poetry
       290│ 
       291│         env_manager = EnvManager(poetry)

   7  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/console/commands/command.py:23 in poetry
        21│     def poetry(self) -> Poetry:
        22│         if self._poetry is None:
     →  23│             return self.get_application().poetry
        24│ 
        25│         return self._poetry

   6  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/console/application.py:122 in poetry
       120│             return self._poetry
       121│ 
     → 122│         self._poetry = Factory().create_poetry(
       123│             Path.cwd(),
       124│             io=self._io,

   5  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/factory.py:59 in create_poetry
        57│             io = NullIO()
        58│ 
     →  59│         base_poetry = super().create_poetry(cwd)
        60│ 
        61│         locker = Locker(

   4  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/core/factory.py:62 in create_poetry
        60│         version = cast(str, local_config["version"])
        61│         package = self.get_package(name, version)
     →  62│         package = self.configure_package(
        63│             package, local_config, poetry_file.parent, with_groups=with_groups
        64│         )

   3  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/core/factory.py:156 in configure_package
       154│ 
       155│         if "dependencies" in config:
     → 156│             cls._add_package_group_dependencies(
       157│                 package=package, group=MAIN_GROUP, dependencies=config["dependencies"]
       158│             )

   2  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/core/factory.py:102 in _add_package_group_dependencies
       100│ 
       101│                 group.add_dependency(
     → 102│                     cls.create_dependency(
       103│                         name,
       104│                         _constraint,

   1  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/core/factory.py:313 in create_dependency
       311│                     )
       312│                 else:
     → 313│                     dependency = DirectoryDependency(
       314│                         name,
       315│                         path,

  ValueError

  Directory [REDACTED]/native does not seem to be a Python package

  at ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/core/packages/directory_dependency.py:54 in __init__
       50│             self._full_path / "pyproject.toml"
       51│         ).is_poetry_project()
       52│ 
       53│         if not setup.exists() and not self._supports_poetry:
    →  54│             raise ValueError(
       55│                 f"Directory {self._full_path} does not seem to be a Python package"
       56│             )
       57│ 
       58│         super().__init__(

@abn
Copy link
Member

abn commented May 24, 2022

if not setup.exists() and not self._supports_poetry:

Says it's using the old code. Did you do the inject command as well? With the poetry-core repo?

@zifeo
Copy link
Author

zifeo commented May 24, 2022

@abn I copy pasted your commands from the pull request

@abn
Copy link
Member

abn commented May 24, 2022

@zifeo looks like the command was incorrect. My bad. Try this.

pipx inject --force --pip-args="--force --no-deps" poetry@5655 'poetry-core @ git+https://github.com/python-poetry/poetry-core.git@refs/pull/368/head'

@zifeo
Copy link
Author

zifeo commented May 24, 2022

@abn Still failing:

  Stack trace:

  15  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/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:

  14  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/console/application.py:182 in _run
       180│         self._load_plugins(io)
       181│ 
     → 182│         exit_code: int = super()._run(io)
       183│         return exit_code
       184│ 

  13  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/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│ 

  12  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/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

  11  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/cleo/application.py:448 in _run_command
       446│ 
       447│         try:
     → 448│             self._event_dispatcher.dispatch(event, COMMAND)
       449│ 
       450│             if event.command_should_run():

  10  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/cleo/events/event_dispatcher.py:22 in dispatch
        20│ 
        21│         if listeners:
     →  22│             self._do_dispatch(listeners, event_name, event)
        23│ 
        24│         return event

   9  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/cleo/events/event_dispatcher.py:89 in _do_dispatch
        87│                 break
        88│ 
     →  89│             listener(event, event_name, self)
        90│ 
        91│     def _sort_listeners(self, event_name: str) -> None:

   8  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/console/application.py:289 in configure_env
       287│ 
       288│         io = event.io
     → 289│         poetry = command.poetry
       290│ 
       291│         env_manager = EnvManager(poetry)

   7  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/console/commands/command.py:23 in poetry
        21│     def poetry(self) -> Poetry:
        22│         if self._poetry is None:
     →  23│             return self.get_application().poetry
        24│ 
        25│         return self._poetry

   6  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/console/application.py:122 in poetry
       120│             return self._poetry
       121│ 
     → 122│         self._poetry = Factory().create_poetry(
       123│             Path.cwd(),
       124│             io=self._io,

   5  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/factory.py:59 in create_poetry
        57│             io = NullIO()
        58│ 
     →  59│         base_poetry = super().create_poetry(cwd)
        60│ 
        61│         locker = Locker(

   4  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/core/factory.py:62 in create_poetry
        60│         version = cast(str, local_config["version"])
        61│         package = self.get_package(name, version)
     →  62│         package = self.configure_package(
        63│             package, local_config, poetry_file.parent, with_groups=with_groups
        64│         )

   3  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/core/factory.py:156 in configure_package
       154│ 
       155│         if "dependencies" in config:
     → 156│             cls._add_package_group_dependencies(
       157│                 package=package, group=MAIN_GROUP, dependencies=config["dependencies"]
       158│             )

   2  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/core/factory.py:102 in _add_package_group_dependencies
       100│ 
       101│                 group.add_dependency(
     → 102│                     cls.create_dependency(
       103│                         name,
       104│                         _constraint,

   1  ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/core/factory.py:313 in create_dependency
       311│                     )
       312│                 else:
     → 313│                     dependency = DirectoryDependency(
       314│                         name,
       315│                         path,

  ValueError

  Directory  [REDACTED]/native does not seem to be a Python package

  at ~/.local/pipx/venvs/poetry@5655/lib/python3.10/site-packages/poetry/core/packages/directory_dependency.py:54 in __init__
       50│         self._supports_pep517 = setup.exists() or pyproject.is_build_system_defined()
       51│         self._supports_poetry = pyproject.is_poetry_project()
       52│ 
       53│         if not (setup.exists() or self._supports_pep517 or self._supports_poetry):
    →  54│             raise ValueError(
       55│                 f"Directory {self._full_path} does not seem to be a Python package"
       56│             )
       57│ 
       58│         super().__init__(

@abn
Copy link
Member

abn commented May 24, 2022

Hmm. Thanks for testing @zifeo I'll try get a project setup to test.

@abn
Copy link
Member

abn commented May 25, 2022

@zifeo tried to create a simple project to try it out. Seems to be working fine with the PR. See the example below.

podman run --rm -i --entrypoint bash python:3.10 <<EOF
set -xe
export PATH=/root/.cargo/bin:/root/.local/bin:\$PATH
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -q
pip --quiet --disable-pip-version-check install pipx
pipx install maturin
pipx install --force --suffix=@5655 'poetry @ git+https://github.com/python-poetry/poetry.git'
pipx inject --force --pip-args="--force --no-deps" poetry@5655 'poetry-core @ git+https://github.com/python-poetry/poetry-core.git@refs/pull/368/head'
poetry@5655 new foobar
pushd foobar/
maturin new -b pyo3 native
poetry@5655 add --editable ./native
poetry@5655 show
cat native/pyproject.toml
EOF
output

+ export PATH=/root/.cargo/bin:/root/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ PATH=/root/.cargo/bin:/root/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ curl --proto =https --tlsv1.2 -sSf https://sh.rustup.rs
+ sh -s -- -y -q
info: downloading installer
...
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'
  stable-x86_64-unknown-linux-gnu installed - rustc 1.61.0 (fe5b13d68 2022-05-18)


Rust is installed now. Great!
...
source $HOME/.cargo/env
+ pip --quiet --disable-pip-version-check install pipx
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
+ pipx install maturin
creating virtual environment...
creating shared libraries...
upgrading shared libraries...
installing maturin...
  installed package maturin 0.12.17, installed using Python 3.10.2
  These apps are now globally available
    - maturin
done! ✨ 🌟 ✨
+ pipx install --force --suffix=@5655 'poetry @ git+https://github.com/python-poetry/poetry.git'
creating virtual environment...
determining package name from 'poetry@ git+https://github.com/python-poetry/poetry.git'...
creating virtual environment...
installing poetry from spec 'poetry@ git+https://github.com/python-poetry/poetry.git'...
  installed package poetry 1.2.0b2.dev0 (poetry@5655), installed using Python 3.10.2
  These apps are now globally available
    - poetry@5655
done! ✨ 🌟 ✨
+ pipx inject --force '--pip-args=--force --no-deps' poetry@5655 'poetry-core @ git+https://github.com/python-poetry/poetry-core.git@refs/pull/368/head'
creating virtual environment...
determining package name from 'poetry-core@ git+https://github.com/python-poetry/poetry-core.git@refs/pull/368/head'...
installing poetry-core from spec 'poetry-core@ git+https://github.com/python-poetry/poetry-core.git@refs/pull/368/head'...
done! ✨ 🌟 ✨
  injected package poetry-core into venv poetry@5655
+ poetry@5655 new foobar
Created package foobar in foobar
/foobar /
+ pushd foobar/
+ maturin new -b pyo3 native
  ✨ Done! New project created native
+ poetry@5655 add --editable ./native
Creating virtualenv foobar-lWDpn5M1-py3.10 in /root/.cache/pypoetry/virtualenvs

Updating dependencies
Resolving dependencies...

Writing lock file

Package operations: 1 install, 0 updates, 0 removals

  • Installing native (0.1.0 /foobar/native)
+ poetry@5655 show
native 0.1.0 native
+ cat native/pyproject.toml
[build-system]
requires = ["maturin>=0.12,<0.13"]
build-backend = "maturin"

[project]
name = "native"
requires-python = ">=3.6"
classifiers = [
    "Programming Language :: Rust",
    "Programming Language :: Python :: Implementation :: CPython",
    "Programming Language :: Python :: Implementation :: PyPy",
]

Are you sure the native project's pyproject.toml contains something like this?

[build-system]
requires = ["maturin>=0.12,<0.13"]
build-backend = "maturin"

@zifeo
Copy link
Author

zifeo commented May 25, 2022

@abn I removed my dirty? lockfile to see my pyproject was a in subfolder 😟 The fix is indeed working well now, thanks for the reactivity. Can you clarify the behaviour with the --editable setup? When will it rebuild and when will it not (maturin develop)?

@abn
Copy link
Member

abn commented May 25, 2022

When "editable" is used, this works the same way as pip install -e ./native. Builds happen only according to what maturin does.

If you update the code, the expectation is for you to run any build steps manually within the project. Alternatively, uninstall and reinstall: or update the package metadata.

This is because as far as poetry is concerned, if the metadata has not changed it needs to do nothing for the package.

@zifeo
Copy link
Author

zifeo commented Jun 14, 2022

@abn Thanks again, everything still work fine. When will the poetry-core be upgraded into poetry? I am looking to find a way to use the fix without pipx and most of the attempt fail because of https://github.com/python-poetry/poetry/blob/master/pyproject.toml#L47

@CLOVIS-AI
Copy link

Is there an estimate of when the next version with the fix will be available? I'm stuck on this as well.

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/feature Feature requests/implementations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants