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

Add name key to sources in Pipfiles #7744

Merged
merged 1 commit into from
Aug 10, 2023
Merged

Conversation

jeffwidman
Copy link
Member

@jeffwidman jeffwidman commented Aug 6, 2023

Newer versions of pipenv require any specified sources to be
explicitly name'd.

More context here: pypa/pipenv#5370 (comment)

This has been true since at least Sept 2022. Our version of pipenv is
from April of 2022, so it doesn't complain. But it will as soon as we upgrade.

Also, for sources that :dependabot: dynamically injects into the
Pipfile, they need a name. These sources are stripped from the final
Pipfile / Pipfile.lock during the FileUpdater#post_process_lockfile
method, so all we need is a placeholder name to placate pipenv.

Long term, we may want to add custom error handling to flag this
missing key as a Dependabot::DependencyFileNotResolvable error.

But I decided that was out of scope for now as this PR does not generate
the error... that will not happen until we upgrade to newer pipenv.
And even at that point, our first priority will be upgrading, and then
from there handling any new errors that start popping up.

And even then, most of the active users of pipenv are unlikely to see this
error because they're likely running a newer version of pipenv.

@jeffwidman
Copy link
Member Author

jeffwidman commented Aug 6, 2023

Likely there will be hash mismatches in the fixture lockfiles, so they'll need regenerating... if so, probably best to only do what's necessary to get past CI... as no point in regenerating in this PR using an older version of pipenv only to have to regenerate them again under the newer version of pipenv... and probably best to wait until we switch to pipenv upgrade so that we don't have to regenerate yet again:

@jeffwidman jeffwidman added the Ecosystems Used by the maintainer team for internal-facing project tracking label Aug 6, 2023
@jeffwidman jeffwidman self-assigned this Aug 6, 2023
@jeffwidman jeffwidman force-pushed the add-missing-name-key-to-sources branch 5 times, most recently from 9b638cf to 62f4d33 Compare August 10, 2023 00:48
@jeffwidman jeffwidman marked this pull request as ready for review August 10, 2023 00:49
@jeffwidman jeffwidman requested a review from a team as a code owner August 10, 2023 00:49
@jeffwidman jeffwidman force-pushed the add-missing-name-key-to-sources branch 5 times, most recently from 883d742 to d97b36b Compare August 10, 2023 03:05
@@ -1,12 +1,13 @@
{
"_meta": {
"hash": {
"sha256": "c402ea48092e9d467af51a483bb8dd8ad0620e11c94f009dcd433f97a99d45db"
"sha256": "e76ae491d793d659f05c7f7eab261fd6167dc062efcba08f17be68e73eb87665"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the only lockfile that the tests required to have an updated hash.

I strongly suspect the hashes are outdated for the other fixture lockfiles, but again, we can regenerate them all after updating to latest pipenv once we drop Python 3.7.

@jeffwidman jeffwidman force-pushed the add-missing-name-key-to-sources branch from d97b36b to 26d416e Compare August 10, 2023 17:24
@jeffwidman jeffwidman force-pushed the add-missing-name-key-to-sources branch 2 times, most recently from ae4e7bd to dd9672c Compare August 10, 2023 19:01
@jeffwidman jeffwidman changed the title Add name key to sources Add name key to Pipfile's sources Aug 10, 2023
@jeffwidman jeffwidman changed the title Add name key to Pipfile's sources Add name key to sources in Pipfiles Aug 10, 2023
@jeffwidman jeffwidman force-pushed the add-missing-name-key-to-sources branch 2 times, most recently from 7b0c471 to 781896c Compare August 10, 2023 19:06
Newer versions of `pipenv` require any specified `sources` to be
explicitly `name`'d.

More context here: pypa/pipenv#5370 (comment)

This has been true since at least Sept 2022. Our version of `pipenv` is
from April of 2022, so it doesn't complain. But it will as soon as we upgrade.

Also, for sources that :dependabot: dynamically injects into the
`Pipfile`, they need a name. These sources are stripped from the final
`Pipfile` / `Pipfile.lock` during the `FileUpdater#post_process_lockfile`
method, so all we need is a placeholder `name` to placate `pipenv`.

Long term, we may want to add custom error handling to flag this
missing key as a `Dependabot::DependencyFileNotResolvable` error.

But I decided that was out of scope for now as this PR does not generate
the error... that will not happen until we upgrade to newer `pipenv`.
And even at that point, our first priority will be upgrading, and then
from there handling any new errors that start popping up.

And even then, most of the active users of `pipenv` are unlikely to see this
error because they're likely running a newer version of `pipenv`.
@jeffwidman jeffwidman force-pushed the add-missing-name-key-to-sources branch from 781896c to 16be5d4 Compare August 10, 2023 19:12
@jeffwidman jeffwidman enabled auto-merge (squash) August 10, 2023 19:13
@jeffwidman jeffwidman merged commit 918333f into main Aug 10, 2023
90 checks passed
@jeffwidman jeffwidman deleted the add-missing-name-key-to-sources branch August 10, 2023 19:40
@jeffwidman
Copy link
Member Author

We got a report via a support ticket that :dependabot: opened a PR that included index: dependabot-inserted-index-0 in Pipfile.lock. So this PR introduced some bug...

Unfortunately, I can't repro and the affected user's repo is a private company so I can't access their repo and they are migrating to a different python package manager so decided it wasn't worthwhile for them to try to create a reproducible example.

The one observation they made:

the bad index seems to be added while updating the sub-dependencies of our private libs.

If anyone else encounters this, please feel free to file a new issue, preferably here in dependabot-core and linking to reproducible example and I'd be happy to take a look.

@juanitosvq
Copy link

We are having the same issue but unfortunately also in a private repository 😞

It looks like older versions of pipenv are happy with that new index, but certainly the newest version pipenv-2023.8.28 is not:

Successfully uninstalled pipenv-2023.2.4

..............................................................................................................................

Installing dependencies from Pipfile.lock (923e0b)...
--
125 | Unable to find dependabot-inserted-index-0 in sources, please check
126 | dependencies:

We also have private libraries, so not sure I'll be able to create a reproducible example.

@jeffwidman
Copy link
Member Author

jeffwidman commented Aug 31, 2023

@juanitosvq Can you at least create a new issue describing what you're seeing? The pipenv maintainers are great folks and we have good lines of communication open with them, so maybe between all of us we can get it figured out...

But this isn't a conversation we should be having on an already merged PR... 😁

brettfo pushed a commit to brettfo/dependabot-core that referenced this pull request Oct 11, 2023
Newer versions of `pipenv` require any specified `sources` to be
explicitly `name`'d.

More context here: pypa/pipenv#5370 (comment)

This has been true since at least Sept 2022. Our version of `pipenv` is
from April of 2022, so it doesn't complain. But it will as soon as we upgrade.

Also, for sources that :dependabot: dynamically injects into the
`Pipfile`, they need a name. These sources are stripped from the final
`Pipfile` / `Pipfile.lock` during the `FileUpdater#post_process_lockfile`
method, so all we need is a placeholder `name` to placate `pipenv`.

Long term, we may want to add custom error handling to flag this
missing key as a `Dependabot::DependencyFileNotResolvable` error.

But I decided that was out of scope for now as this PR does not generate
the error... that will not happen until we upgrade to newer `pipenv`.
And even at that point, our first priority will be upgrading, and then
from there handling any new errors that start popping up.

And even then, most of the active users of `pipenv` are unlikely to see this
error because they're likely running a newer version of `pipenv`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ecosystems Used by the maintainer team for internal-facing project tracking L: python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants