Skip to content

Fix pip install -e for daqp-python when run from outside the package directory#140

Merged
darnstrom merged 2 commits intomasterfrom
copilot/fix-setup-installation-issue
Mar 23, 2026
Merged

Fix pip install -e for daqp-python when run from outside the package directory#140
darnstrom merged 2 commits intomasterfrom
copilot/fix-setup-installation-issue

Conversation

Copy link
Contributor

Copilot AI commented Mar 23, 2026

setup.py used os.environ["PWD"] to locate the daqp source tree, assuming the user was in the daqp-python directory. Running pip install -e from any other directory produced incorrect paths and a broken install.

Changes

  • interfaces/daqp-python/setup.py: Replace os.environ["PWD"]-based path resolution with pathlib.Path(__file__).parent.resolve(), making all paths relative to setup.py itself rather than the caller's working directory.
    • src_path now resolves to the repo root via setup_dir / "../.." instead of PWD + "../../../daqp"
    • csrc_dir, source files, include dirs, README.md, and LICENSE all use absolute paths derived from setup_dir
    • Fixed misleading "Could not find daqp directory" message that also fired when csrc_dir already existed
# Before — breaks if not run from interfaces/daqp-python/
src_path = pathlib.Path(os.environ["PWD"], "../../../daqp")
csrc_dir = pathlib.Path('./csrc')

# After — works from any directory
setup_dir = pathlib.Path(__file__).parent.resolve()
src_path = (setup_dir / "../..").resolve()
csrc_dir = setup_dir / 'csrc'

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix setup to allow pip install from any directory Fix pip install -e for daqp-python when run from outside the package directory Mar 23, 2026
Copilot AI requested a review from darnstrom March 23, 2026 22:30
@darnstrom darnstrom marked this pull request as ready for review March 23, 2026 22:50
@darnstrom darnstrom merged commit 693b5d4 into master Mar 23, 2026
14 checks passed
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

Successfully merging this pull request may close these issues.

2 participants