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

Relative paths in requirements files don't work #813

Closed
mhsmith opened this issue Aug 7, 2022 · 1 comment · Fixed by #816
Closed

Relative paths in requirements files don't work #813

mhsmith opened this issue Aug 7, 2022 · 1 comment · Fixed by #816
Labels
android The issue relates to Android mobile support. bug A crash or error in behavior. linux The issue relates Linux support.

Comments

@mhsmith
Copy link
Member

mhsmith commented Aug 7, 2022

Requirements in pyproject.toml files can be in any form accepted by pip install, including paths to local sdists, wheels, or directories. Paths are interpreted relative to the location of the pyproject.toml file.

However, when these paths are copied into a requirements.txt file for Flatpak or Chaquopy, they'll be interpreted relative to the location of the requirements file, which doesn't currently work.

Possible solutions:

  • Generate the requirements file in the same directory as pyproject.toml. Not ideal, because it would be a platform-specific file generated outside of the platform directory
  • Convert all relative paths in the requirements file to absolute paths. This is easy, but would prevent the project directory from being relocated.
  • Convert all relative paths in the requirements file to be relative to the file's location. I think this is the best solution, and there's a os.path.relpath function that should make it just as easy.
@mhsmith mhsmith added the bug A crash or error in behavior. label Aug 7, 2022
@freakboy3742 freakboy3742 added up-for-grabs linux The issue relates Linux support. android The issue relates to Android mobile support. labels Aug 8, 2022
@freakboy3742
Copy link
Member

+1 to this needing a fix. I think your intuition about using relative paths is also correct. The biggest complication I can see is how to identify which of the requirements are specified as relative paths - but I guess "does it start with ../ is probably a decent first approximation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android The issue relates to Android mobile support. bug A crash or error in behavior. linux The issue relates Linux support.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants