-
Notifications
You must be signed in to change notification settings - Fork 171
Enforce codestyle using pre-commit and some related fixes #191
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
Open
erickisos
wants to merge
6
commits into
nubank:master
Choose a base branch
from
erickisos:code-style
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b6c246c
pre-commit-config to enforce codestyle
39dd7c4
minor improvements
090aa82
Apply suggestions from code review
erickisos 1a331e9
suggestions from code review
erickisos 33d8c28
fix lint and add pre-commit dependency
220191a
Merge branch 'master' into code-style
erickisos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| default_stages: [commit, push] | ||
| repos: | ||
| - repo: https://github.com/pycqa/isort | ||
| rev: 5.10.1 | ||
| hooks: | ||
| - id: isort | ||
| name: isort (python) | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v4.0.1 | ||
| hooks: | ||
| - id: check-added-large-files | ||
| - id: debug-statements | ||
| - id: double-quote-string-fixer | ||
| - id: end-of-file-fixer | ||
| - id: mixed-line-ending | ||
| - id: check-yaml | ||
| - id: requirements-txt-fixer | ||
| - id: mixed-line-ending | ||
| - id: trailing-whitespace | ||
| - repo: https://github.com/pre-commit/mirrors-autopep8 | ||
| rev: "v1.6.0" | ||
| hooks: | ||
| - id: autopep8 | ||
| - repo: https://github.com/pycqa/flake8 | ||
| rev: 3.9.2 | ||
| hooks: | ||
| - id: flake8 | ||
| name: flake8 (python) | ||
| - repo: https://github.com/myint/docformatter | ||
| rev: v1.4 | ||
| hooks: | ||
| - id: docformatter | ||
| args: ["--wrap-descriptions", "0"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| matplotlib>=3.0.2,<4 | ||
| tqdm>=4.32.1,<5 | ||
| scipy>=1.2.1,<2 | ||
| tqdm>=4.32.1,<5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| codecov>=2.0,<3 | ||
| hypothesis>=5.5.4,<7 | ||
| mypy>=0.670,<1 | ||
| pytest>=4.2.1,<7 | ||
| pytest-cov>=2.6.1,<3 | ||
| pytest-xdist>=1.26.1,<3 | ||
| mypy>=0.670,<1 | ||
| codecov>=2.0,<3 | ||
| hypothesis>=5.5.4,<7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,49 +1,53 @@ | ||
| #!/usr/bin/env python | ||
| from os.path import join | ||
|
|
||
| from setuptools import setup, find_packages | ||
| from setuptools import find_packages, setup | ||
|
|
||
| MODULE_NAME = 'fklearn' # package name used to install via pip (as shown in `pip freeze` or `conda list`) | ||
| MODULE_NAME_IMPORT = 'fklearn' # this is how this module is imported in Python (name of the folder inside `src`) | ||
| REPO_NAME = 'fklearn' # repository name | ||
|
|
||
|
|
||
| def requirements_from_pip(filename='requirements.txt'): | ||
| with open(filename, 'r') as pip: | ||
| return [l.strip() for l in pip if not l.startswith('#') and l.strip()] | ||
| with open(filename, 'r') as requirements_file: | ||
| return [ | ||
| req.strip() | ||
| for req in requirements_file | ||
| if not req.startswith('#') and req.strip() | ||
| ] | ||
|
|
||
|
|
||
| core_deps = requirements_from_pip() | ||
| demos_deps = requirements_from_pip("requirements_demos.txt") | ||
| test_deps = requirements_from_pip("requirements_test.txt") | ||
| demos_deps = requirements_from_pip('requirements_demos.txt') | ||
| test_deps = requirements_from_pip('requirements_test.txt') | ||
|
|
||
| tools_deps = requirements_from_pip("requirements_tools.txt") | ||
| tools_deps = requirements_from_pip('requirements_tools.txt') | ||
|
|
||
| lgbm_deps = requirements_from_pip("requirements_lgbm.txt") | ||
| xgboost_deps = requirements_from_pip("requirements_xgboost.txt") | ||
| catboost_deps = requirements_from_pip("requirements_catboost.txt") | ||
| lgbm_deps = requirements_from_pip('requirements_lgbm.txt') | ||
| xgboost_deps = requirements_from_pip('requirements_xgboost.txt') | ||
| catboost_deps = requirements_from_pip('requirements_catboost.txt') | ||
|
|
||
| all_models_deps = lgbm_deps + xgboost_deps + catboost_deps | ||
| all_deps = all_models_deps + tools_deps | ||
| devel_deps = test_deps + all_deps | ||
|
|
||
| setup(name=MODULE_NAME, | ||
| description="Functional machine learning", | ||
| url='https://github.com/nubank/{:s}'.format(REPO_NAME), | ||
| author="Nubank", | ||
| description='Functional machine learning', | ||
| url=f'https://github.com/nubank/{REPO_NAME}', | ||
| author='Nubank', | ||
| package_dir={'': 'src'}, | ||
| packages=find_packages('src'), | ||
| version=(open(join('src', MODULE_NAME, 'resources', 'VERSION')) | ||
| .read().strip()), | ||
| install_requires=core_deps, | ||
| extras_require={"test_deps": test_deps, | ||
| "lgbm": lgbm_deps, | ||
| "xgboost": xgboost_deps, | ||
| "catboost": catboost_deps, | ||
| "tools": tools_deps, | ||
| "devel": devel_deps, | ||
| "all_models": all_models_deps, | ||
| "all": all_deps}, | ||
| extras_require={'test_deps': test_deps, | ||
| 'lgbm': lgbm_deps, | ||
| 'xgboost': xgboost_deps, | ||
| 'catboost': catboost_deps, | ||
| 'tools': tools_deps, | ||
| 'devel': devel_deps, | ||
| 'all_models': all_models_deps, | ||
| 'all': all_deps}, | ||
| include_package_data=True, | ||
| zip_safe=False, | ||
| classifiers=['Programming Language :: Python :: 3.6']) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| from .version import __version__ | ||
| from .version import __version__ # noqa: F401 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.