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

Bare Git Repo at UNC Shared Drive Filepath #5493

Closed
1 task done
whatamithinking opened this issue Apr 26, 2022 · 12 comments · Fixed by python-poetry/poetry-core#341 or #5428
Closed
1 task done

Bare Git Repo at UNC Shared Drive Filepath #5493

whatamithinking opened this issue Apr 26, 2022 · 12 comments · Fixed by python-poetry/poetry-core#341 or #5428
Labels
area/core Related to the poetry-core library area/docs Documentation issues/improvements kind/bug Something isn't working as expected

Comments

@whatamithinking
Copy link

whatamithinking commented Apr 26, 2022

  • I have searched the issues of this repo and believe that this is not a duplicate.

Issue

System: latest version of poetry, python 3.10.2, Windows 10 64-bit

I have a bare GIT repo on a shared drive which I need to include as a dependency. I have the following dependency in pyproject.toml:

[tool.poetry.dependencies]
repo-name = {git="file://drive-name/path/repo-name.git"}

When using "poetry build" I get the following error:
No file/folder found for package
"poetry install" seems to silently fail. It does not install the dependency.

In setuptools setup.py I can use the following path and install/uninstall works without issue:
repo-name@file://drive-name/path/repo-name.git#egg=repo-name

The documentation seems, as far as I can tell, a little sparse on this scenario.
What am I missing?

@whatamithinking whatamithinking added area/docs Documentation issues/improvements status/triage This issue needs to be triaged labels Apr 26, 2022
@abn
Copy link
Member

abn commented Apr 26, 2022

Can you try the fix at #5428? Unsure if it's related to git client usage.

@abn
Copy link
Member

abn commented Apr 26, 2022

No file/folder found for package

This one is likely because the project does not define packages in pyproject.toml and auto discovery fails to find your package.

@whatamithinking
Copy link
Author

No file/folder found for package

This one is likely because the project does not define packages in pyproject.toml and auto discovery fails to find your package.

You were right. I made a copy of the repo to test with and that messed up the package name.

@whatamithinking
Copy link
Author

The next issue I get is "Invalid git url". This seems to be happening because I am using a hidden folder on Windows.

Changing the PATH regex pattern in "poetry\core\vcs\git.py"
from

PATH = r"[\w\~.\-/\\]+"

to

PATH = r"[\w\$~.\-/\\]+"

resolves the issue in addition to using 4 slashes after the schema and :

Final filepath looks like: file:////<drive-name>/<hidden-folder-name>$/<remaining-path-parts>/<repo-name>.git

@abn
Copy link
Member

abn commented Apr 26, 2022

@ConnorSMaynes can you try #5428 please?

@abn
Copy link
Member

abn commented Apr 26, 2022

Feel free to als osend a PR to core with the regex fix.

@whatamithinking
Copy link
Author

@abn I was going to do a pull request, but I cannot find the source file in the repo. I do not use github that often, so apologies if i am missing the obvious.

@abn
Copy link
Member

abn commented Apr 26, 2022

No worries. It is a different project (poetry-core). The file is at https://github.com/python-poetry/poetry-core/blob/master/src/poetry/core/vcs/git.py.

@whatamithinking
Copy link
Author

#5428 also seems to be working, thank you.
I did not try that before because I was running into some issues uninstalling, but it is working now.
I will use that fork until it is merged.

@whatamithinking
Copy link
Author

I was using poetry build and poetry install to test before. When I tried to use pip install, it failed with the same git path error as before.

I believe the issue is that the build-system in pyproject still points to the one from pypi and not the dulwich one. I tried the following variations but none worked.

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[build-system]
requires = ["git+https://github.com/abn/poetry@use-dulwich"]
build-backend = "poetry.core.masonry.api"
[build-system]
requires = ["poetry@git+https://github.com/abn/poetry@use-dulwich#egg=poetry"]
build-backend = "poetry.core.masonry.api"

For the last one I got the following traceback

WARNING: Ignoring invalid distribution -oetry (c:\program files (x86)\python310-32\lib\site-packages)
WARNING: Ignoring invalid distribution -oetry (c:\program files (x86)\python310-32\lib\site-packages)
Processing c:\users\<username>\desktop\repos\scheduled_futures
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [24 lines of output]
      Traceback (most recent call last):
        File "C:\Users\<username>\AppData\Roaming\Python\Python310-32\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module>
          main()
        File "C:\Users\<username>\AppData\Roaming\Python\Python310-32\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\Users\<username>\AppData\Roaming\Python\Python310-32\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 164, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-or631em7\overlay\Lib\site-packages\poetry\core\masonry\api.py", line 42, in prepare_metadata_for_build_wheel
          builder = WheelBuilder(poetry)
        File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-or631em7\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py", line 57, in __init__
          super().__init__(poetry, executable=executable)
        File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-or631em7\overlay\Lib\site-packages\poetry\core\masonry\builders\builder.py", line 93, in __init__
          self._meta = Metadata.from_package(self._package)
        File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-or631em7\overlay\Lib\site-packages\poetry\core\masonry\metadata.py", line 83, in from_package
          meta.requires_dist = [d.to_pep_508() for d in package.requires]
        File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-or631em7\overlay\Lib\site-packages\poetry\core\masonry\metadata.py", line 83, in <listcomp>
          meta.requires_dist = [d.to_pep_508() for d in package.requires]
        File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-or631em7\overlay\Lib\site-packages\poetry\core\packages\dependency.py", line 311, in to_pep_508
          requirement = self.base_pep_508_name
        File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-or631em7\overlay\Lib\site-packages\poetry\core\packages\vcs_dependency.py", line 110, in base_pep_508_name
          parsed_url = git.ParsedUrl.parse(self._source)
        File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-or631em7\overlay\Lib\site-packages\poetry\core\vcs\git.py", line 134, in parse
          raise ValueError(f'Invalid git url "{url}"')
      ValueError: Invalid git url "file:////<drive-name>/<hidden-folder-name>$/<remaining-path-parts>/<repo-name>.git"
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
WARNING: Ignoring invalid distribution -oetry (c:\program files (x86)\python310-32\lib\site-packages)

@abn
Copy link
Member

abn commented May 2, 2022

@ConnorSMaynes the build-system setting does not need to be modified, the changes in #5428 only impacts the Poetry frontend, ie. commands like poetry install. When you perform pip install, pip creates a new isolated environments, copies the source from your project into a temporary directory and then calls poetry-core to construct the wheel. When it does this, poetry-core tries to validate the metadata it has from the pyproject.toml files and determines that the $ in the url is invalid.

As mentioned above, this is a validation done in core. I suspect the issue is, as you pointed out, the use of $. The fix at python-poetry/poetry-core#341 should resolve this.

@abn abn added kind/bug Something isn't working as expected area/core Related to the poetry-core library and removed status/triage This issue needs to be triaged labels May 2, 2022
abn added a commit to python-poetry/poetry-core that referenced this issue May 4, 2022
bcavagnolo added a commit to bcavagnolo/poetry-core that referenced this issue Aug 24, 2022
This enables support for dynamically setting the package version
(e.g., from a plugin)

Resolves: python-poetry/poetry#5493
bcavagnolo added a commit to bcavagnolo/poetry-core that referenced this issue Aug 24, 2022
This enables support for dynamically setting the package version
(e.g., from a plugin)

Resolves: python-poetry/poetry#5493
bcavagnolo added a commit to bcavagnolo/poetry-core that referenced this issue Aug 24, 2022
This enables support for dynamically setting the package version
(e.g., from a plugin)

Resolves: python-poetry/poetry#5493
bcavagnolo added a commit to bcavagnolo/poetry-core that referenced this issue Aug 24, 2022
This enables support for dynamically setting the package version
(e.g., from a plugin)

Resolves: python-poetry/poetry#5493
bcavagnolo added a commit to bcavagnolo/poetry-core that referenced this issue Aug 24, 2022
This enables support for dynamically setting the package version
(e.g., from a plugin)

Resolves: python-poetry/poetry#5493
bcavagnolo added a commit to bcavagnolo/poetry-core that referenced this issue Aug 24, 2022
This enables support for dynamically setting the package version
(e.g., from a plugin)

Resolves: python-poetry/poetry#5493
bostonrwalker pushed a commit to bostonrwalker/poetry-core that referenced this issue Aug 29, 2022
DavidVujic pushed a commit to DavidVujic/poetry-core that referenced this issue Aug 31, 2022
Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/core Related to the poetry-core library area/docs Documentation issues/improvements kind/bug Something isn't working as expected
Projects
None yet
2 participants