Skip to content

Conversation

@connesy
Copy link
Contributor

@connesy connesy commented Nov 5, 2024

Implement basic and bearer token authentication for downloading private inventory files in mkdocstrings. This allows users to provide credentials via environment variables in the URL.

Update documentation to reflect these changes and add test cases to ensure functionality.

Closes #707.

Copy link
Member

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

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

Thanks a lot! Clean code 👍 A few questions.

@connesy connesy force-pushed the feat-parse-inventory-url-userinfo branch from 3c8a294 to 5b8be89 Compare November 7, 2024 09:09
@connesy connesy requested a review from pawamoy November 8, 2024 08:36
Copy link
Member

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

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

Thanks for the updates!

Just a round on docstrings and comments. I'll apply in batch. Next I'll suggest a few changes to log messages, to make them more informative.

Copy link
Member

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

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

OK WDYT of this? We mention the actual URLs in log messages, to make them more explicit (and/or actionable).

We use %-formatting instead of f-strings for performance (and consistency) reasons.

@connesy
Copy link
Contributor Author

connesy commented Nov 8, 2024

We mention the actual URLs in log messages, to make them more explicit (and/or actionable)

Sure, we can do that.

We use %-formatting instead of f-strings for performance (and consistency) reasons.

I'm happy to change it to %-formatting for consistency, but as far as I know, f-strings are faster 🙂

Edit: Sorry, consistency with what exactly? I can't find any %-formatted strings in the rest of the package, but a lot of f-strings? 🤔

@pawamoy
Copy link
Member

pawamoy commented Nov 8, 2024

I'm happy to change it to %-formatting for consistency, but as far as I know, f-strings are faster

f-strings are faster. But when logging debug messages, if the debug level is not actually enabled, you can skip building the string entirely, which logging supports, but only with %-formatting:

log.debug(f"Debug message with {costly_string_transform}")
log.debug("String transform of %s not performed if logging level is INFO", costly_string_transform)

It's generally not a perf gain, but for the few times it is, we want the consistency of using %-formatting for every logging message 😄

@pawamoy
Copy link
Member

pawamoy commented Nov 8, 2024

Edit: Sorry, consistency with what exactly? I can't find any %-formatted strings in the rest of the package, but a lot of f-strings? 🤔

Oh yeah, I've only started recently using %-formatting again for log messages, I suppose I didn't update mkdocstrings yet. Will do in another PR 😄 Therefore, feel free to use f-strings here, or %-formatting, it's not important.

@connesy
Copy link
Contributor Author

connesy commented Nov 8, 2024

f-strings are faster. But when logging debug messages, if the debug level is not actually enabled, you can skip building the string entirely, which logging supports, but only with %-formatting:

Sorry, I didn't notice you were using the logging module to format the message and not "%s" % value 🙂

Copy link
Member

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you so much 🚀

@pawamoy pawamoy merged commit 1c23c1b into mkdocstrings:main Nov 8, 2024
@pawamoy
Copy link
Member

pawamoy commented Nov 8, 2024

Released in v0.27.0.

@connesy
Copy link
Contributor Author

connesy commented Nov 8, 2024

LGTM! Thank you so much 🚀

Thank you for the nice feedback 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: Download private inventory files

2 participants