Skip to content

Non existing nested directory output support for wheel  #9721

@AsifArmanRahman

Description

@AsifArmanRahman

Description

Using build command to generate only wheel file, with an output directory dist/build, where the dist directory itself does not exist throws an error.

Workarounds

Not using non existing nested directory for output flag

Poetry Installation Method

install.python-poetry.org

Operating System

Ubuntu 24.04.1 LTS

Poetry Version

1.8.3

Poetry Configuration

cache-dir = "~/.cache/pypoetry"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
solver.lazy-wheel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = true

Python Sysconfig

No response

Example pyproject.toml

No response

Poetry Runtime Logs

Loading configuration file ~/.config/pypoetry/config.toml
Using virtualenv: ~/simple_project/venv
Building simple-project (1.2.3)
  - Building wheel

  Stack trace:

  10  /opt/poetry/venv/lib/python3.12/site-packages/cleo/application.py:327 in run
       325│ 
       326│             try:
     → 327│                 exit_code = self._run(io)
       328│             except BrokenPipeError:
       329│                 # If we are piped to another process, it may close early and send a

   9  /opt/poetry/venv/lib/python3.12/site-packages/poetry/console/application.py:190 in _run
       188│         self._load_plugins(io)
       189│ 
     → 190│         exit_code: int = super()._run(io)
       191│         return exit_code
       192│ 

   8  /opt/poetry/venv/lib/python3.12/site-packages/cleo/application.py:431 in _run
       429│             io.input.interactive(interactive)
       430│ 
     → 431│         exit_code = self._run_command(command, io)
       432│         self._running_command = None
       433│ 

   7  /opt/poetry/venv/lib/python3.12/site-packages/cleo/application.py:473 in _run_command
       471│ 
       472│         if error is not None:
     → 473│             raise error
       474│ 
       475│         return terminate_event.exit_code

   6  /opt/poetry/venv/lib/python3.12/site-packages/cleo/application.py:457 in _run_command
       455│ 
       456│             if command_event.command_should_run():
     → 457│                 exit_code = command.run(io)
       458│             else:
       459│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

   5  /opt/poetry/venv/lib/python3.12/site-packages/cleo/commands/base_command.py:117 in run
       115│         io.input.validate()
       116│ 
     → 117│         return self.execute(io) or 0
       118│ 
       119│     def merge_application_definition(self, merge_args: bool = True) -> None:

   4  /opt/poetry/venv/lib/python3.12/site-packages/cleo/commands/command.py:61 in execute
        59│ 
        60│         try:
     →  61│             return self.handle()
        62│         except KeyboardInterrupt:
        63│             return 1

   3  /opt/poetry/venv/lib/python3.12/site-packages/poetry/console/commands/build.py:66 in handle
        64│             if not dist_dir.is_absolute():
        65│                 dist_dir = self.poetry.pyproject_path.parent / dist_dir
     →  66│             self._build(fmt, executable=env.python, target_dir=dist_dir)
        67│ 
        68│         return 0

   2  /opt/poetry/venv/lib/python3.12/site-packages/poetry_plugin_nar/command.py:38 in _build
        36│ 
        37│         for builder in builders:
     →  38│             builder(self.poetry, executable=executable).build(target_dir)
        39│ 

   1  /opt/poetry/venv/lib/python3.12/site-packages/poetry/core/masonry/builders/wheel.py:105 in build
       103│         target_dir = target_dir or self.default_target_dir
       104│         if not target_dir.exists():
     → 105│             target_dir.mkdir()
       106│ 
       107│         fd, temp_path = tempfile.mkstemp(suffix=".whl")

  FileNotFoundError

  [Errno 2] No such file or directory: '~/simple_project/dist/build'

  at /usr/lib/python3.12/pathlib.py:1313 in mkdir
      1309│         """
      1310│         Create a new directory at this given path.
      1311│         """
      1312│         try:
    → 1313│             os.mkdir(self, mode)
      1314│         except FileNotFoundError:
      1315│             if not parents or self.parent == self:
      1316│                 raise
      1317│             self.parent.mkdir(parents=True, exist_ok=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreRelated to the poetry-core librarykind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions