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

Format code with Black and isort #411

Closed
wants to merge 9 commits into from
Closed

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Oct 22, 2019

Fixes #401

  • Format code with Black

  • Add some Black-compatible config to .flake8

    • E203, W503 are not compatible with PEP 8, skip them
    • line lengths match Black's default
  • sort imports with isort

    • Move isort config to the new central pyproject.toml, add new config to place nicely with Black
  • Fix Flake8 errors

  • Remove some Python 2 code: __cmp__ and cmp

  • Add Black/isort checks to tox and the CI

To autofix code locally:

pip install -U black isort
black .
isort -y

(I'll do pre-commit in another PR.)

@codecov
Copy link

codecov bot commented Oct 22, 2019

Codecov Report

Merging #411 into master will increase coverage by <.01%.
The diff coverage is 93.73%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #411      +/-   ##
==========================================
+ Coverage   88.16%   88.16%   +<.01%     
==========================================
  Files          24       24              
  Lines        2382     2383       +1     
==========================================
+ Hits         2100     2101       +1     
  Misses        282      282
Impacted Files Coverage Δ
src/tablib/formats/_csv.py 100% <100%> (ø) ⬆️
src/tablib/packages/dbfpy/dbfnew.py 97.61% <100%> (ø) ⬆️
src/tablib/formats/_html.py 100% <100%> (ø) ⬆️
src/tablib/packages/dbfpy/header.py 83.67% <100%> (ø) ⬆️
src/tablib/formats/_tsv.py 100% <100%> (ø) ⬆️
src/tablib/formats/_json.py 96.87% <100%> (ø) ⬆️
tests/test_tablib_dbfpy_packages_utils.py 100% <100%> (ø) ⬆️
src/tablib/formats/_xls.py 73.07% <100%> (ø) ⬆️
src/tablib/__init__.py 66.66% <100%> (ø) ⬆️
src/tablib/formats/_yaml.py 100% <100%> (ø) ⬆️
... and 14 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1f000f2...2830bdf. Read the comment docs.

@claudep
Copy link
Contributor

claudep commented Oct 22, 2019

Thanks, but this will break (again) my PR #395. Do you think you would be able to review it before pushing this one?

@hugovk
Copy link
Member Author

hugovk commented Oct 22, 2019

Sure, let's get #395 in before this. I'm not too familiar with the internals of Tablib and would rather stick to more general things like testing, so would rather someone else reviewed it. I've left a comment on the PR's issue 👍

@claudep
Copy link
Contributor

claudep commented Oct 22, 2019

I still pushed the isort part as it is less invasive that black.

@claudep
Copy link
Contributor

claudep commented Oct 22, 2019

Any idea why current master fails with isort? (cannot reproduce locally)

@hugovk
Copy link
Member Author

hugovk commented Oct 22, 2019

Probably because it's missing the isort config changes in pyproject.toml, specifically:

known_third_party = ["MarkupPy", "odf", "openpyxl", "pkg_resources", "setuptools", "tablib", "xlrd", "xlwt", "yaml"]

I suggest always making a PR and only committing directly to master for very minor changes. (In fact, we could disable committing directly to master in the repo settings.)

@claudep
Copy link
Contributor

claudep commented Oct 22, 2019

Thanks for the tip and sorry for not using a PR for this change.

@hugovk
Copy link
Member Author

hugovk commented Oct 22, 2019

You're welcome, and no problem :)

@hugovk
Copy link
Member Author

hugovk commented Nov 10, 2019

Closing, will send new PRs.

First Black, then another for Flake8. Will be easier to review separately.

@hugovk hugovk closed this Nov 10, 2019
@hugovk hugovk deleted the run-black branch November 10, 2019 19:08
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.

Consider enforcing flake8, black and isort
2 participants