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

UPD: change configuration project #363

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

thibaultcordier
Copy link
Collaborator

Description

This configures the pre-commit functionnality: when you prepare a commit, it will automatically run default pre-commit checks and run black and flake8 checks.

Fixes #(issue)

Type of change

  • Configuration files
  • pre-commit => change code style

Checklist

  • I have read the contributing guidelines
  • I have updated the HISTORY.rst and AUTHORS.rst files
  • Linting passes successfully : make lint
  • Typing passes successfully : make type-check
  • Unit tests pass successfully : make tests
  • Coverage is 100% : make coverage
  • Documentation builds successfully : make doc

@thibaultcordier thibaultcordier added enhancement New feature or request developers Proposed by developers. labels Sep 22, 2023
@thibaultcordier thibaultcordier self-assigned this Sep 22, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 22, 2023

@thibaultcordier thibaultcordier marked this pull request as ready for review September 22, 2023 10:02
@thibaultcordier
Copy link
Collaborator Author

thibaultcordier commented Sep 22, 2023

If it looks ok to you, then I merge. What tracks so you can see the real additions :

To cut a long story short, these modifications automate code formatting during commits, reduce testing during push/pull_request, import only the packages needed according to dev/ci/doc and reduce mapie dependencies to the minimum. The rest of the changes are just formatting with the black package.

.flake8 Outdated Show resolved Hide resolved
- sphinx=4.3.2
- sphinx-gallery=0.10.1
- sphinx_rtd_theme=1.0.0
- typing_extensions=4.0.1
- pandas
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove the versions ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because there's no incompatibility with the latest version of pandas so far. so there's no reason to constrain the version

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still feel like we should force a version. We don't want the doc not building for a version problem. (we can perform version updates every now and then?)


zeros_scores_proba_last = (y_pred_proba_last <= EPSILON)
zeros_scores_proba_last = y_pred_proba_last <= EPSILON
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is easier to understand with the '()'

).filled(fill_value=np.inf),
axis=1
), axis=1
np.min(np.ma.masked_less(y_pred_proba, EPSILON).filled(fill_value=np.inf), axis=1),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An example where I think it's less readable after black : here you have 4 numpy functions in 3 lines (expand_dims, min, masked_less, filled), quite hard to understand

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, I should have added pre-commit first, then thought about black.

Copy link
Collaborator

@LacombeLouis LacombeLouis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally a very clean, good update. Thank you @thibaultcordier.
I think black has some disadvantages, but mainly, it will help clean up the code more than it will make it less readable.

I do wonder whether we should perform the linting before black or not. Please checkout comment.

.github/PULL_REQUEST_TEMPLATE.md Show resolved Hide resolved
- sphinx=4.3.2
- sphinx-gallery=0.10.1
- sphinx_rtd_theme=1.0.0
- typing_extensions=4.0.1
- pandas
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still feel like we should force a version. We don't want the doc not building for a version problem. (we can perform version updates every now and then?)

np.random.multivariate_normal(center, cov, n_samples)
for center, cov in zip(centers, covs)
]
[np.random.multivariate_normal(center, cov, n_samples) for center, cov in zip(centers, covs)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is very code reading friendly. Is this black?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is black

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, sometimes, black is really not friendly. 😆

@@ -1,7 +1,10 @@
codecov
flake8
flake8==4.0.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[question]
What is the usage of the requirements files when we have environment ones?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows the user to choose whether to install with pip or conda.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developers Proposed by developers. enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants