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 black formater for the code with code-checker on pull #1610

Merged
merged 8 commits into from
Jun 3, 2020

Conversation

kumuji
Copy link
Contributor

@kumuji kumuji commented Apr 26, 2020

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

What does this PR do?

Fixes # (issue).
As discussed in slack, this is a pr for adding black with github actions.

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

@mergify mergify bot requested a review from a team April 26, 2020 10:30
@Borda Borda added discussion In a discussion stage feature Is an improvement or enhancement labels Apr 26, 2020
@Borda Borda added this to the 0.7.5 milestone Apr 26, 2020
@codecov
Copy link

codecov bot commented Apr 26, 2020

Codecov Report

Merging #1610 into master will not change coverage.
The diff coverage is n/a.

@@          Coverage Diff           @@
##           master   #1610   +/-   ##
======================================
  Coverage      86%     86%           
======================================
  Files          75      75           
  Lines        4705    4705           
======================================
  Hits         4064    4064           
  Misses        641     641           

black.toml Outdated Show resolved Hide resolved
requirements.txt Outdated Show resolved Hide resolved
@mergify mergify bot requested a review from a team April 26, 2020 11:36
.github/workflows/code-formating-check.yml Outdated Show resolved Hide resolved
.github/workflows/code-formating-check.yml Outdated Show resolved Hide resolved
.github/workflows/code-formating-check.yml Outdated Show resolved Hide resolved
requirements.txt Outdated Show resolved Hide resolved
black.toml Outdated Show resolved Hide resolved
black.toml Outdated Show resolved Hide resolved
@mergify mergify bot requested a review from a team April 26, 2020 22:47
@nateraw
Copy link
Contributor

nateraw commented Apr 27, 2020

May I point you to the transformers library for inspiration/guidance?

Their setup.cfg configures this with isort and flake8. Additionally, their Makefile provides simple commands for devs to run before pushing up. No confusing precommit hooks in their build pipeline, just checks to see if it matches the desired format.

If your PR doesn't match, you just quickly run the make style command and push the changes back up to get the build to pass the style checks.

@kumuji kumuji marked this pull request as draft April 28, 2020 12:30
@Borda Borda modified the milestones: 0.7.6, 0.8.0, 0.7.7 May 12, 2020
@williamFalcon
Copy link
Contributor

@kumuji @Borda let's get this merged?

@williamFalcon
Copy link
Contributor

@kumuji

Run black --config=black.toml --check .
Error: Could not open file black.toml: Error reading configuration file: [Errno 2] No such file or directory: 'black.toml'
##[error]Process completed with exit code 1.

@williamFalcon williamFalcon changed the title Added black formater for the code with code-checker on pull [WIP] Added black formater for the code with code-checker on pull May 17, 2020
@kumuji
Copy link
Contributor Author

kumuji commented May 17, 2020

I can move it to setup.cfg, now I know how. I will update soon, just a few days

@kumuji kumuji marked this pull request as ready for review May 18, 2020 10:48
@kumuji kumuji changed the title [WIP] Added black formater for the code with code-checker on pull Added black formater for the code with code-checker on pull May 18, 2020
@kumuji kumuji requested review from Borda and removed request for a team May 18, 2020 12:29
@mergify mergify bot requested a review from a team May 18, 2020 12:30
pyproject.toml Outdated Show resolved Hide resolved
.github/workflows/code-formatting-check.yml Outdated Show resolved Hide resolved
@mergify mergify bot requested a review from a team May 18, 2020 22:44
@mergify mergify bot requested a review from a team May 27, 2020 11:38
@Borda Borda added the ready PRs ready to be merged label May 27, 2020
@mergify
Copy link
Contributor

mergify bot commented May 27, 2020

Great job! =)

@mergify
Copy link
Contributor

mergify bot commented May 30, 2020

This pull request is now in conflict... :(

@mergify
Copy link
Contributor

mergify bot commented Jun 2, 2020

This pull request is now in conflict... :(

kumuji and others added 5 commits June 3, 2020 15:35
Added throught black.toml other options are hard so far

No caching for black github action

Moved from black.toml to pyproject.toml

Exclude not only yml but also yaml

Update pyproject.toml

Co-authored-by: Thomas Johansen <thomasjo@gmail.com>

Update .github/workflows/code-formatting-check.yml

mergify

Remove formating check

E231 error ignoring because of black formating

Updated CONTRIBUTING to the master
Black skipping string normalization
setup.cfg Outdated Show resolved Hide resolved
@mergify
Copy link
Contributor

mergify bot commented Jun 3, 2020

Great job! =)

@mergify
Copy link
Contributor

mergify bot commented Jun 3, 2020

Great job! =)

@Borda Borda merged commit fd7814d into Lightning-AI:master Jun 3, 2020
@awaelchli
Copy link
Contributor

so this applies black everytime we merge a PR into master? and will it only affect changed lines or always the whole file someone edits?

@kumuji
Copy link
Contributor Author

kumuji commented Jun 3, 2020

So far it would do nothing.

But later, after black would be applied to the whole repo, you will have to install pre-commit, so it will format the code before you commit:

python -m pip install pre-commit
pre-commit install

Also there is github action such that on every push/pull black would check files. (It is not activated yet)

So, the github action is only checking and will check all files

@Borda
Copy link
Member

Borda commented Jun 3, 2020

so this applies black everytime we merge a PR into master? and will it only affect changed lines or always the whole file someone edits?

The check is commented so it still optional not mandatory...
Just to define common rules if someone is using black =)

@awaelchli
Copy link
Contributor

great! will try it out

justusschock pushed a commit that referenced this pull request Jun 29, 2020
* black

Added throught black.toml other options are hard so far

No caching for black github action

Moved from black.toml to pyproject.toml

Exclude not only yml but also yaml

Update pyproject.toml

Co-authored-by: Thomas Johansen <thomasjo@gmail.com>

Update .github/workflows/code-formatting-check.yml

mergify

Remove formating check

E231 error ignoring because of black formating

Updated CONTRIBUTING to the master

* Update .github/workflows/code-formatting-check.yml

* Bump black to 19.10b0 version

* resolved incorrect merge of CONTRIBUTING,

Black skipping string normalization

* Minor fixes in CONTRIBUTING, two typos

* Update setup.cfg

* chlog

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Jirka <jirka@pytorchlightning.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion In a discussion stage feature Is an improvement or enhancement ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants