Skip to content

Conversation

@rjwalters
Copy link

Allow pip install when package is not at repo root

Problem

Currently, PufferLib can only be installed properly when it's located at the root of a repository. This makes it difficult to vendor the library as a subdirectory (e.g., deps/pufferlib) or use it as a submodule, especially with editable installs.

Solution

This PR makes PufferLib installable regardless of its location in the directory structure by:

  1. Scoping find_packages() to pufferlib explicitly
  2. Using package_dir={"": "pufferlib"} to specify the package root
  3. Updating Cython paths to be relative to the project root
  4. Adding pyproject.toml fields to support modern build tools and PEP 660

Benefits

  • Fully backward-compatible: Existing installations and builds work exactly as before
  • Improved flexibility: Can now be vendored in subdirectories or used as a submodule
  • Better editable installs: -e installs work correctly regardless of package location
  • Modern standards: Adds proper PEP 660 support via pyproject.toml configuration

These changes are minimal and focused solely on improving the installation process without affecting functionality or existing workflows.

@rjwalters
Copy link
Author

This was an attempt to get pufferlib to install in editable mode within a a subfolder (/deps/pufferlib)

pip install -e .

I could not get it to work but it seems to work in normal mode:

pip install .

the error was

error: could not create 'deps/pufferlib/pufferlib/extensions.cpython-311-darwin.so': No such file or directory

@rjwalters rjwalters closed this Apr 24, 2025
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.

3 participants