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

Poetry export git does not include commit hash #71

Closed
3 tasks done
lindycoder opened this issue Jan 10, 2022 · 6 comments
Closed
3 tasks done

Poetry export git does not include commit hash #71

lindycoder opened this issue Jan 10, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@lindycoder
Copy link

  • I am on the latest Poetry version. (PREVIEW)
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: macOS Monterey 12.0.1
  • Poetry version: 1.2.0a2
  • Link of a Gist with the contents of your pyproject.toml file: default from poetry init -n

Issue

Hello,

It seems exporting a git dependency does not include the resolved_reference from the poetry lock. Instead it just references the branch which it's tracking.

poetry export
test-package @ git+ssh://git@github.com/lindycoder/poetry-git-export-issue.git@main ; python_version >= "3.10" and python_version < "4.0"

The goal of exporting is to install the exact versions installed in the poetry lock so...

Expected

since my poetry.lock includes

[package.source]
type = "git"
url = "git@github.com:lindycoder/poetry-git-export-issue.git"
reference = "main"
resolved_reference = "640da7171839d4b7857728b321999ef7d5e171b2"

I would expect the export to be

poetry export
test-package @ git+ssh://git@github.com/lindycoder/poetry-git-export-issue.git@640da7171839d4b7857728b321999ef7d5e171b2 ; python_version >= "3.10" and python_version < "4.0"

Reproduce

I prepared a very small package to test, locally you can

poetry init -n
poetry add git+ssh://git@github.com:lindycoder/poetry-git-export-issue.git#main
poetry export
@lindycoder lindycoder added bug Something isn't working Triage labels Jan 10, 2022
@lindycoder
Copy link
Author

Note switching to branch instead of rev (by default when poetry add) still have the same effect

test-package = {git = "git@github.com:lindycoder/poetry-git-export-issue.git", branch = "main"}

poetry.lock

cat poetry.lock
[[package]]
name = "test-package"
version = "0.1.0"
description = ""
category = "main"
optional = false
python-versions = "^3"
develop = false

[package.source]
type = "git"
url = "git@github.com:lindycoder/poetry-git-export-issue.git"
reference = "main"
resolved_reference = "4d9f32baab486f394afb37f9e740424df652f54d"

Exporting

poetry export
test-package @ git+ssh://git@github.com/lindycoder/poetry-git-export-issue.git@main ; python_version >= "3" and python_version < "4"

@alexasosa
Copy link

This is also causing issues for me. Expected the version to be pinned to that specified in the pyproject.toml and poetry.lock file, but instead the exported requirements.txt uses the latest commit.

@bobwhitelock
Copy link

Ran into the same issue, via https://github.com/moneymeets/python-poetry-buildpack - very surprising as an unrelated deploy caused a Git dependency to update to the latest commit on that branch, ignoring the lockfile, and breaking things in the deployed environment!

@davegaeddert
Copy link

It looks to me like this was fixed in 4670b0c, it just hasn't been released yet. @radoering is that something you could help with, or explain how it works? Thanks!

@radoering
Copy link
Member

I'm planning to do a release just before the next poetry release. See python-poetry/poetry#8483 for the current status. Currently, I'm just waiting for a review of the race condition fix.

@radoering
Copy link
Member

Resolved in poetry-plugin-export 1.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants