-
Notifications
You must be signed in to change notification settings - Fork 224
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
feat: use new mapping #888
Conversation
Before we merge this we want to make sure we open source the repository that generates the mapping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also use the mapping in lock_file::pypi::resolve_dependencies
so we don't add the wrong packages to the resolve.
f051f66
to
5ba6042
Compare
I just rebased this PR on main. A few things I am wondering:
I think we might be better off not retrying and it might also be good to have some graceful fallback - maybe with the current github file, or something hard-coded? |
What do you mean by hard-coded/current github file? |
Retry with the middleware only happens for 500 errors and same rare 42x cases. A missing entry will not be retried. I assume corporate firewalls will also return a normal 40x status which will also not be retried. The main usecase for retry is to retry server issues. |
Ah great, good to know! |
Could you also add documentation on the use and working of this mapping? |
src/project/manifest/metadata.rs
Outdated
@@ -50,4 +50,7 @@ pub struct ProjectMetadata { | |||
|
|||
/// URL of the project documentation | |||
pub documentation: Option<Url>, | |||
|
|||
/// URL of the pypi name mapping | |||
pub pypi_name_mapping: Option<Url>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im thinking that maybe we should have a mapping per channel. So you can use the prefix one for conda-forge
but use a custom mapping for your own private channel?
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea!
some small discovery questions about how do you see it:
- do we want to also allow to override conda-forge with your own mapping?
- do we want to expose configuration via
pypi-name-mapping = {"conda-forge": ..my_path, "my-own-channel": ..my_another_path }
, or to hide the channel in the mapping itself? ( I go with the first approach )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to also allow to override conda-forge with your own mapping?
When we have mirrors or you are behind a firewall, then yes.
do we want to expose configuration via pypi-name-mapping = {"conda-forge": ..my_path, "my-own-channel": ..my_another_path } , or to hide the channel in the mapping itself? ( I go with the first approach )
@ruben-arts @wolfv WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this!
Edit: Scrap the seperate table idea, this is a standalone definition specific to the project. So this is good.
[project]
pypi-name-mapping = { conda-forge = "url", "https://prefix.dev/my_channel" = "url" }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm having some doubts on the name. What about:
conda-pypi-map
channel-index-map
conda-pypi-package-map
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about starting a [pypi-options]
table? I feel there could be a number of future options to handle (keyring, extra index, etc.)
Not sure re. the specific name of the map, but we could maybe take 'pypi' out of it if it sits under a [pypi-options]
table
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about starting a
[pypi-options]
table? I feel there could be a number of future options to handle (keyring, extra index, etc.)Not sure re. the specific name of the map, but we could maybe take 'pypi' out of it if it sits under a
[pypi-options]
table
Hey @olivier-lacroix ! Good question!
My rationale for using [project] is that mapping is used for both conda and pypi - so in my view because we map conda name to python name, the upstream for it is the [project] table.
I'm totally open for any other ideas - maybe we can also ask @ruben-arts and @baszalmstra
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @nichmor, not a bad idea but not required in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty good to me except that if I read it correctly you are only using the prefix mapping by default for packages from conda-forge. However, you can use the prefix mapping for all packages!
I approve of this PR! @ruben-arts If you are happy with it, feel free to merge :) |
let response = client | ||
.get(url.clone()) | ||
.send() | ||
.await | ||
.into_diagnostic() | ||
.context("failed to download pypi mapping from custom location")?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested what happens if you give a broken URL but then this doesn't get shown but then next one does. Could you make sure that it fails on downloading, and that it adds atleast also adds the url to the error so it helps the user find the cultprit? Now it gives this error:
× failed to parse pypi name mapping
├─▶ error decoding response body: invalid type: integer `404`, expected a map at line 1 column 3
╰─▶ invalid type: integer `404`, expected a map at line 1 column 3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/project/manifest/mod.rs
Outdated
}) | ||
.collect::<miette::Result<HashMap<ChannelName, MappingLocation>>>()?; | ||
|
||
Ok(MappingSource::Custom { mapping }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to also warn the user if the have a mapping to conda-flibediefloep
that it tells them that that channel doesn't exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome
No description provided.