Skip to content

Refactor utils #1390

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

Merged
merged 1 commit into from
Mar 14, 2021
Merged

Refactor utils #1390

merged 1 commit into from
Mar 14, 2021

Conversation

abhiabhi94
Copy link
Contributor

  • move regex compilation to the top of the module to enable caching.

closes #1381

- move regex compilation to the top of the module to enable caching.
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 10, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @abhiabhi94!

It looks like this is your first PR to kubernetes-client/python 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-client/python has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot requested review from roycaihw and yliaog March 10, 2021 03:06
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 10, 2021
@yliaog
Copy link
Contributor

yliaog commented Mar 10, 2021

thanks for the pr

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 10, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhiabhi94, yliaog

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

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 10, 2021
@abhiabhi94
Copy link
Contributor Author

abhiabhi94 commented Mar 11, 2021

Hey @yliaog, inside the script update-pycodestyle, we try to reorder the imports using isort by using isort -y

for SOURCE in $SOURCES; do
isort -y $SOURCE
done

The argument -y has been deprecate for isort versions >=5 and is applied by default.

For older versions:

$ pip freeze -l | grep -i isort
isort==4.3.21

$ isort --help | grep -Ee '\-y'
             [-w LINE_LENGTH] [-wl WRAP_LENGTH] [-ws] [-y] [--unsafe]
  -y, --apply           Tells isort to apply changes recursively without

Newer version:

$ pip freeze -l | grep -i isort
isort==5.7.0
$ isort --help | grep -Ee '\-y' 
$

I think this has not been caught because as far as I can see, the environment the tox environment update-pycodestyle is not being run in travis. Is this expected behavior?

Also, if we want to a consistent style as mentioned in the contributing notes, maybe we can automate this by using a pre-commit hook that runs this particular script?

@yliaog
Copy link
Contributor

yliaog commented Mar 14, 2021

closing to trigger CI
/close

@k8s-ci-robot
Copy link
Contributor

@yliaog: Closed this PR.

In response to this:

closing to trigger CI
/close

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.

@yliaog
Copy link
Contributor

yliaog commented Mar 14, 2021

/reopen

@k8s-ci-robot
Copy link
Contributor

@yliaog: Reopened this PR.

In response to this:

/reopen

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.

@k8s-ci-robot k8s-ci-robot reopened this Mar 14, 2021
@k8s-ci-robot k8s-ci-robot merged commit bf63f59 into kubernetes-client:master Mar 14, 2021
@yliaog
Copy link
Contributor

yliaog commented Mar 14, 2021

update-pycodestyle is used here (https://github.com/kubernetes-client/python/blob/master/.travis.yml#L28), i agree it should be applied consistently for other versions.

@abhiabhi94
Copy link
Contributor Author

abhiabhi94 commented Mar 15, 2021

Regarding the pycodestyle, if you agree to maybe should I setup a pre-commit hook that would run this script before the commit to help automate this process(for the developer), or provide feedback before the commit(in case there are inconsistencies)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move regular expression compilation to the top of the module in create_from_yaml
3 participants