-
Notifications
You must be signed in to change notification settings - Fork 19
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
Modernize package infrastructure #172
Conversation
6b00bbc
to
98773cf
Compare
fd944ec
to
e12ee3a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The infrastructure changes looks good to me, I only skimmed over the documentation changes.
tox -e docs
and tox -e format
should be documented somewhere (in Contributing maybe?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going through, all looks generally fine, but I'm worried that the new linting doesn't look as nice. Can we set it up with the same rules as before?
.readthedocs.yaml
Outdated
# Build documentation in the docs/ directory with Sphinx | ||
sphinx: | ||
configuration: docs/source/conf.py | ||
configuration: docs/src/conf.py | ||
|
||
# Optionally build your docs in additional formats such as PDF | ||
formats: | ||
|
||
# Optionally set the version of Python and requirements required to build your docs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is no longer relevant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep.
recursive-include src/skmatter/datasets/data/ * | ||
recursive-include src/skmatter/datasets/descr/ * | ||
|
||
prune tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not include the test files in shipped package via PYPI or conda. We can remove this line and include the tests again... But, if people run the tests they will use the github repo and not the one from a package manager.
docs/Makefile
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file no longer needed? Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tox -e docs
will build the docs in an isolated environment and takes care of the OS specific stuff. So no, we do not need this anymore.
docs/make.bat
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file no longer needed? Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
n_to_select is chosen. Otherwise will stop when the score falls below the | ||
threshold. Stored in :py:attr:`self.score_threshold`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
n_to_select is chosen. Otherwise will stop when the score falls below the | |
threshold. Stored in :py:attr:`self.score_threshold`. | |
n_to_select is chosen. Otherwise will stop when the score falls below the threshold. | |
Stored in :py:attr:`self.score_threshold`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here 88 characters per line.
@@ -84,7 +78,8 @@ class GreedySelector(SelectorMixin, MetaEstimatorMixin, BaseEstimator): | |||
X_selected_ : ndarray, | |||
Matrix containing the selected samples or features, for use in fitting | |||
y_selected_ : ndarray, | |||
In sample selection, the matrix containing the selected targets, for use in fitting | |||
In sample selection, the matrix containing the selected targets, for | |||
use in fitting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are small, unnecessary formatting changes throughout here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why unnecessary? There is a line width of 88 characters. This should be obeyed to please the linter.
"Cannot fit with warm_start=True without having been previously" | ||
" initialized." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
88 characters per line.
The negative loss is returned for easier use in sklearn pipelines, e.g., a | ||
grid search, where methods named 'score' are meant to be maximized. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this render correctly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setup.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this file no longer needed? I'm not seeing how removing it is beneficial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our code is fully compatible with PEP517 and PEP660 🥳. We do not have to do any legacy builds which require a setup.py
file: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
Also removing this file prevents user from doing python setup.py install
which you should not do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the setup.py was also super weird for me the first time I saw it. But, it actually works and is the way one should do it if one can.
Thanks. Black is exactly the same. The only thing which is slightly changed is how isort works. Packages are sorted according to: |
So I get the 88 char/line thing from a code-formatting standpoint, but as a code reader, I find it very frustrating. Industry-standard is 80 -- any arguments for/against doing that instead? |
I would stick with 88 characters. 88 chars/line is the current way of skmatter since we use black as the formatter. It was only not enabled for the docstring and not applied (and still is not) for the documentation pages. We all have widescreen monitors. Additional eight characters per line lead to fewer line breaks and more readable code. Also, I am not sure if 80 is still the industry standard. sklearn uses 88 and even the greatLinus Torvald is saying that the time of 80 chars/line are over. |
Ah, the good ole' Linus' rant.
FWIW I'm all for longer lines.
…On Wed, 29 Mar 2023 at 19:57, Philip Loche ***@***.***> wrote:
I would stick with 88 characters. 88 chars/line is the current way of
skmatter since we use black as the formatter. It was only not enabled for
the docstring and not applied (and still is not) for the documentation
pages. We all have widescreen monitors. Additional eight characters per
line lead to fewer line breaks and more readable code.
Also, I am not sure if 80 is still the industry standard. sklearn uses 88
<https://github.com/scikit-learn/scikit-learn/blob/70c489f1273a5ff877e61750b3a69590bc002b6f/pyproject.toml#L23>
and even the greatLinus Torvald is saying that the time of 80 chars/line
are over <https://lkml.org/lkml/2020/5/29/1038>.
—
Reply to this email directly, view it on GitHub
<#172 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIREZ6FOQPWAEV675PXLJ3W6RZYVANCNFSM6AAAAAAWI5AISM>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I’d advocate for even longer, ~100char!
… On 29 Mar 2023, at 14:29, Michele Ceriotti ***@***.***> wrote:
Ah, the good ole' Linus' rant.
FWIW I'm all for longer lines.
On Wed, 29 Mar 2023 at 19:57, Philip Loche ***@***.***> wrote:
> I would stick with 88 characters. 88 chars/line is the current way of
> skmatter since we use black as the formatter. It was only not enabled for
> the docstring and not applied (and still is not) for the documentation
> pages. We all have widescreen monitors. Additional eight characters per
> line lead to fewer line breaks and more readable code.
>
> Also, I am not sure if 80 is still the industry standard. sklearn uses 88
> <https://github.com/scikit-learn/scikit-learn/blob/70c489f1273a5ff877e61750b3a69590bc002b6f/pyproject.toml#L23>
> and even the greatLinus Torvald is saying that the time of 80 chars/line
> are over <https://lkml.org/lkml/2020/5/29/1038>.
>
> —
> Reply to this email directly, view it on GitHub
> <#172 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAIREZ6FOQPWAEV675PXLJ3W6RZYVANCNFSM6AAAAAAWI5AISM>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
—
Reply to this email directly, view it on GitHub <#172 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ALKVP3WN5MNYNMAY2K2XOWDW6SEQFANCNFSM6AAAAAAWI5AISM>.
You are receiving this because you were mentioned.
|
Okay, since this might be a longer and intensive discussion I suggest we keep the 88 chars/line in within this PR and open an issue about how we handle this in the future. One reason is that I would like to touch more files of the repo but this PR is already huge and complex. |
This PR updates a number of the infrastructure of the package:
tox.ini
file. The latter one is easier to maintain as a huge multi-line string and also consistent with the other projects.skmatter
tosrc/skmatter
docs/source
->docs/src
(same is in other lab-cosmo projects)setup.py
,setup.cfg
into a singlepyproject.toml
filecontributors.txt
isort
andflake8
settings of the other lab-cosmo projectsnumpy
as an explict dependency. The whole package depends onscikit-learn
which depends onnumpy
. I think we do not need to listnumpy
again in the dependencies if we stick with the same version as they do (which we should).