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

chore: Linting, auto-formatting & type checking for KFP SDK #4219

Closed
alexlatchford opened this issue Jul 15, 2020 · 12 comments
Closed

chore: Linting, auto-formatting & type checking for KFP SDK #4219

alexlatchford opened this issue Jul 15, 2020 · 12 comments
Assignees
Labels
area/engprod lifecycle/frozen status/triaged Whether the issue has been explicitly triaged

Comments

@alexlatchford
Copy link
Contributor

alexlatchford commented Jul 15, 2020

As a part of some work I did this week (see #4218) to clean up the SDK docs I noticed how variable the codebase standards for the Python SDK are. Looks like are some docs in the contribution guide that suggest a style, see here, and these choices seem perfectly reasonable to me.

My question is do we think it's worthwhile trying to enforce these standards? And, if so how do we want to migrate the existing code to use this?

I'm happy to volunteer to do the grunt work to make this happen but really I'd want agreement and buy-in as typically this would cause huge merge conflicts with any work in flight if we decided to do this.

@alexlatchford
Copy link
Contributor Author

As with anything like this it requires a cost/benefit analysis, likely this is a well known problem to all but here's my best shot anyway.

Costs

  • Ongoing burden on contributors to adhere to best practices, this may be particularly cumbersome if a decision is made to enable static analysis.
  • Temporary burden on contributors whose work is in progress when we expose stylistic constraints.
  • Cost to new contributors to learn how to use toolset.

Benefits

  • Auto-formatters don't always play nice with linters but for the most part if we can make the two pieces work together we can reduce pull request code churn by assuring we all play by the same rules.
  • Reduce ongoing code maintenance to offloading formatting tasks to IDEs (ie. vscode and/or pycharm both could integrate easily with yapf).
  • Static analysis can find some bugs, but mostly it will drastically improve API documentation by enforcing type adherence.

To go a little deeper my interest in contributing to Kubeflow is around how to make it easily accessible to Data Scientists without strong engineering fundamentals. Obviously this is a large goal but the barrier at the moment has not been a lack of functionality but rather the confusing nature of the model of KFP SDK concepts and cohesive documentation.

@Bobgy
Copy link
Contributor

Bobgy commented Jul 16, 2020

@numerology @Ark-kun I think you mentioned yapf can format only changed code, but I was unable to reproduce that feature on VSCode, everytime I try to format a file it just formats everything.

In the end, I'm unable to apply the new format when I make changes to python files.

@Bobgy
Copy link
Contributor

Bobgy commented Jul 16, 2020

Some previous discussion: #4002 (comment)

@Bobgy
Copy link
Contributor

Bobgy commented Jul 16, 2020

For frontend code we enforced code style similar to the tradeoffs you described #2406, I was able to push a conclusion for all existing PRs and rush the code format enforcement without much interruption to others.

I couldn't figure out how to do formatting for python right now, so I hope there's either some guidance or we can enforce the format.

@Bobgy
Copy link
Contributor

Bobgy commented Jul 16, 2020

Of course, thanks @alexlatchford for driving these. Really appreciate your contribution!

@Bobgy Bobgy added area/engprod status/triaged Whether the issue has been explicitly triaged labels Jul 16, 2020
@alexlatchford
Copy link
Contributor Author

Some previous discussion: #4002 (comment)

Thanks for sharing this, looks like I need to convince @Ark-kun then that this a pain worth going through. In general I think I'm on same page as you mention here, #4002 (comment), where this will have a period of short-term pain but on the whole will be worthwhile moving forward.

Really a goal of this was to add more type hints to help drive nicer SDK docs and I think that me contributing in that area is likely to be uncontroversial so long as we don't enable static type checking so maybe that's how I can start this work as we resolve the discussion in one direction or another 😄 Thanks for the guidance!

@stale
Copy link

stale bot commented Oct 15, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the lifecycle/stale The issue / pull request is stale, any activities remove this label. label Oct 15, 2020
@stale
Copy link

stale bot commented Oct 22, 2020

This issue has been automatically closed because it has not had recent activity. Please comment "/reopen" to reopen it.

@stale stale bot closed this as completed Oct 22, 2020
@Bobgy
Copy link
Contributor

Bobgy commented Oct 22, 2020

/reopen
/Lifecycle frozen

@k8s-ci-robot k8s-ci-robot reopened this Oct 22, 2020
@k8s-ci-robot
Copy link
Contributor

@Bobgy: Reopened this issue.

In response to this:

/reopen
/Lifecycle frozen

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 added lifecycle/frozen and removed lifecycle/stale The issue / pull request is stale, any activities remove this label. labels Oct 22, 2020
@rimolive
Copy link
Member

Closing this issue. No activity for more than a year.

/close

Copy link

@rimolive: Closing this issue.

In response to this:

Closing this issue. No activity for more than a year.

/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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/engprod lifecycle/frozen status/triaged Whether the issue has been explicitly triaged
Projects
Status: Closed
Development

No branches or pull requests

4 participants