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

configure precommit & ruff #1462

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ Gael Varoquaux <gael.varoquaux@normalesup.org> Gael varoquaux <gael.varoquaux@no
Gael Varoquaux <gael.varoquaux@normalesup.org> GaelVaroquaux <gael.varoquaux@normalesup.org>
Gael Varoquaux <gael.varoquaux@normalesup.org> Gael VAROQUAUX <gv985687@is206780.intra.cea.fr>
Gael Varoquaux <gael.varoquaux@normalesup.org> gvaroquaux <gael.varoquaux@normalesup.org>

27 changes: 27 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
default_language_version:
python: python3

ci:
autofix_prs: true
autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions'
autoupdate_schedule: quarterly
# submodules: true

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-yaml
- id: check-toml
- id: check-case-conflict
- id: check-added-large-files
- id: detect-private-key

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.3.0'
hooks:
- id: ruff
args: ["--fix"]
exclude: "joblib/test/test_func_inspect_special_encoding.py"
1 change: 0 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ python:

sphinx:
fail_on_warning: true

3 changes: 1 addition & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
|PyPi| |Azure| |ReadTheDocs| |Codecov|
|PyPi| |Azure| |ReadTheDocs| |Codecov|

.. |PyPi| image:: https://badge.fury.io/py/joblib.svg
:target: https://badge.fury.io/py/joblib
Expand Down Expand Up @@ -133,4 +133,3 @@ Changes are listed in the CHANGES.rst file. They must be manually updated
but, the following git command may be used to generate the lines::

git log --abbrev-commit --date=short --no-merges --sparse

12 changes: 5 additions & 7 deletions TODO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ Tasks at hand on joblib, in increasing order of difficulty.

* In parallel: need to deal with return arguments that don't pickle.

* Improve test coverage and documentation
* Improve test coverage and documentation

* Store a repr of the arguments for each call in the corresponding
cachedir

* Try to use Mike McKerns's Dill pickling module in Parallel:
Implementation idea:
* Create a new function that is wrapped and takes Dillo pickles as
Implementation idea:
* Create a new function that is wrapped and takes Dillo pickles as
inputs as output, feed this one to multiprocessing
* pickle everything using Dill in the Parallel object.
http://dev.danse.us/trac/pathos/browser/dill
Expand All @@ -26,7 +26,7 @@ Tasks at hand on joblib, in increasing order of difficulty.
return a, b

g = mem.cache(f)
g(c=2)
g(c=2)

/home/varoquau/dev/joblib/joblib/func_inspect.pyc in filter_args(func,
ignore_lst, *args, **kwargs), line 168
Expand All @@ -43,9 +43,7 @@ Tasks at hand on joblib, in increasing order of difficulty.
accept as an input the dictionary of arguments, as returned in
func_inspect, and return a string.

* add a sqlite db for provenance tracking. Store computation time and usage
* add a sqlite db for provenance tracking. Store computation time and usage
timestamps, to be able to do 'garbage-collection-like' cleaning of
unused results, based on a cost function balancing computation cost and
frequency of use.


22 changes: 0 additions & 22 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,6 @@ trigger:
- master

jobs:
- job: linting
displayName: Linting
pool:
vmImage: ubuntu-latest
steps:
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add conda to PATH
- bash: sudo chown -R $USER $CONDA
displayName: Take ownership of conda installation
- bash: conda create --name flake8_env --yes flake8
displayName: Install flake8
- bash: |
if [[ $BUILD_SOURCEVERSIONMESSAGE =~ \[lint\ skip\] ]]; then
# skip linting
echo "Skipping linting"
exit 0
else
source activate flake8_env
flake8
fi
displayName: Run linting

- job: testing
displayName: Testing
strategy:
Expand Down
2 changes: 1 addition & 1 deletion doc/_static/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ div.highlight pre {
div.body table.docutils tr{
background: #ccc; /* fallback if nth-child is not supported */
}
div.body table.docutils tr:nth-child(odd){
div.body table.docutils tr:nth-child(odd){
background: #f8f4ee;
}
div.body table.docutils tr:nth-child(even){
Expand Down
1 change: 0 additions & 1 deletion doc/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ <h3>Mailing list</h3>
</div>
<hr/>
{% endblock %}

2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@

##############################################################################
# Hack to copy the CHANGES.rst file
import shutil
import shutil # noqa: E402
try:
shutil.copyfile('../CHANGES.rst', 'CHANGES.rst')
shutil.copyfile('../README.rst', 'README.rst')
Expand Down
1 change: 0 additions & 1 deletion doc/developing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ Development
.. include:: README.rst

.. include:: CHANGES.rst

3 changes: 0 additions & 3 deletions doc/why.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,3 @@ Design choices
changing the original code

* Only local imports: **embed joblib in your code by copying it**



2 changes: 1 addition & 1 deletion joblib/func_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def get_func_name(func, resolv_alias=True, win_characters=True):
if resolv_alias:
# TODO: Maybe add a warning here?
if hasattr(func, 'func_globals') and name in func.func_globals:
if not func.func_globals[name] is func:
if func.func_globals[name] is not func:
name = '%s-alias' % name
if hasattr(func, '__qualname__') and func.__qualname__ != name:
# Extend the module name in case of nested functions to avoid
Expand Down
4 changes: 1 addition & 3 deletions joblib/numpy_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
from .numpy_pickle_compat import NDArrayWrapper
# For compatibility with old versions of joblib, we need ZNDArrayWrapper
# to be visible in the current namespace.
# Explicitly skipping next line from flake8 as it triggers an F401 warning
# which we don't care.
from .numpy_pickle_compat import ZNDArrayWrapper # noqa
from .numpy_pickle_compat import ZNDArrayWrapper # noqa: F401
from .backports import make_memmap

# Register supported compressors
Expand Down
16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,19 @@ omit = [

[tool.coverage.report]
show_missing = true

[tool.ruff]
# line-length = 120
# Enable Pyflakes `E` and `F` codes by default.
select = [
"E", "W", # see: https://pypi.org/project/pycodestyle
"F", # see: https://pypi.org/project/pyflakes
]
# Exclude a variety of commonly ignored directories.
exclude = [
"joblib/externals/*",
]
ignore-init-module-imports = true

[tool.ruff.per-file-ignores]
"examples/*" = ["E402"]
Borda marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 0 additions & 12 deletions setup.cfg

This file was deleted.