Skip to content

Cannot install optional dependencies on local repositories under Linux #2560

@freakboy3742

Description

@freakboy3742

Describe the bug

A project that declares a requirement with an optional dependency, installed from a local source folder, cannot be built on Linux.

Steps to reproduce

  1. Define a project with requires = ['../path/to/package[optional]']
  2. Run briefcase create
  3. See error
Unable to find local requirement ../path/to/package[optional]

Expected behavior

Packages with optional dependencies should build without error, installing the optional dependencies.

Screenshots

No response

Environment

  • Operating System: Linux
  • Python version: all (tested on 3.12)
  • Software versions:
    • Briefcase: 0.3.25

Logs


Additional context

This was discovered in the process of developing tests for the Toga QT backend, which has optional dependencies because of the multiple Qt backend implementations.

The problem doesn't manifest on dev; it's only when the full build occurs.

The problem appears to be caused because for a Linux system install, Briefcase first builds all the requirements as wheels, and then writes a requirements.txt file that includes the dependencies. This involves a call to python -m build ../path/to/package[option], which fails, because that isn't a valid path. The [] optional component should be stripped for the purposes of the call to build, and then included when the requirements file is finalised.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA crash or error in behavior.linuxThe issue relates Linux support.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions