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

added env override for default index URL #286

Closed
wants to merge 7 commits into from

Conversation

djcass44
Copy link
Contributor

Related Issues and Dependencies

This introduces a breaking change

  • Yes
  • No

This Pull Request implements

Updates the _DEFAULT_INDEX_URLS so that it can be set from an environment variable rather than being hardcoded.

Description

Context: I am attempting to use Micropipenv in an environment behind a corporate firewall where I cannot access pypi.org. To make things more complex, I need to build the application in two different environments which do not have a consistent Pip registry available, meaning I cannot put the registry URL in the package manager configuration file.

This change adds the MICROPIPENV_DEFAULT_INDEX_URLS environment variable which allows a consumer to override the default registry that Micropipenv uses if it cannot find one in the package manager config.

This change is implemented in a way that is not breaking. If the environment variable is not set it will behave identically to how it did before.

@op1st-prow
Copy link

op1st-prow bot commented Sep 12, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign frenzymadness for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@op1st-prow op1st-prow bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 12, 2023
@op1st-prow
Copy link

op1st-prow bot commented Sep 12, 2023

Hi @djcass44. Thanks for your PR.

I'm waiting for a thoth-station member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@op1st-prow op1st-prow bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Sep 12, 2023
Copy link
Collaborator

@fridex fridex 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 your contribution, @djcass44, this looks valuable. Do you think it would make sense to promote this to be an option anyone could supply to the CLI?

micropipenv install --default-index-url https://my-index.com

Or at least document this environment variable in the README file so it is easier for users to find it. Thank you!

@op1st-prow op1st-prow bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 12, 2023
@djcass44
Copy link
Contributor Author

@fridex thanks for the quick response!

I've added some documentation to the README to explain how to use the environment variable. I think it would be great idea to add it to the CLI however it would be a much more involved change than a simple environment variable. If it's okay I'd prefer to merge this to get the functionality through

@fridex
Copy link
Collaborator

fridex commented Sep 12, 2023

Thank you, let's see what maintainers will say :)

@fridex fridex removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 12, 2023
@goern
Copy link
Member

goern commented Oct 31, 2023

@frenzymadness wdyt?

@frenzymadness
Copy link
Collaborator

I like this change and I'm open to merging and releasing it. However, it'd be nice to have some tests for it. Do you think you can add some?

improved handling of whitespace
@op1st-prow op1st-prow bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 8, 2023
@djcass44
Copy link
Contributor Author

djcass44 commented Nov 8, 2023

@frenzymadness done! I've also improved the handling of whitespace

Copy link
Collaborator

@frenzymadness frenzymadness 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! Some comments were provided but the contribution is good and will be merged soon.

micropipenv.py Outdated Show resolved Hide resolved
tests/test_micropipenv.py Outdated Show resolved Hide resolved
@djcass44
Copy link
Contributor Author

djcass44 commented Nov 9, 2023

@frenzymadness thanks for the feedback! I believe I've addressed it all

@frenzymadness
Copy link
Collaborator

I fixed a code a little bit to improve readability and to make mypy and pydocstyle tests pass. For some reason, I'm not able to push it to your fork (probably because you opened this PR from the master branch, but I'm not sure).

Could you please check #290 where all your commits and my changes are squashed together and ready to be merged?

@frenzymadness frenzymadness marked this pull request as draft November 20, 2023 10:57
@op1st-prow op1st-prow bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants