Skip to content

Commit

Permalink
Replace black with ruff in the contributing guides
Browse files Browse the repository at this point in the history
  • Loading branch information
Armavica committed Oct 16, 2024
1 parent acb54e3 commit a97f313
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 11 deletions.
3 changes: 1 addition & 2 deletions CORE_TEAM_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,7 @@ resources such as:
[NumPy documentation guide](https://numpy.org/devdocs/dev/howto-docs.html#documentation-style)
for docstring conventions.
- [`pre-commit`](https://pre-commit.com) hooks for autoformatting.
- [`black`](https://github.com/psf/black) autoformatting.
- [`flake8`](https://github.com/PyCQA/flake8) linting.
- [`ruff`](https://github.com/astral-sh/ruff) autoformatting and linting.
- [python-xarray](https://stackoverflow.com/questions/tagged/python-xarray) on Stack Overflow.
- [@xarray_dev](https://twitter.com/xarray_dev) on Twitter.
- [xarray-dev](https://discord.gg/bsSGdwBn) discord community (normally only used for remote synchronous chat during sprints).
Expand Down
1 change: 0 additions & 1 deletion ci/min_deps_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

CHANNELS = ["conda-forge", "defaults"]
IGNORE_DEPS = {
"black",
"coveralls",
"flake8",
"hypothesis",
Expand Down
1 change: 0 additions & 1 deletion ci/requirements/all-but-dask.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ channels:
- conda-forge
- nodefaults
dependencies:
- black
- aiobotocore
- array-api-strict
- boto3
Expand Down
8 changes: 2 additions & 6 deletions doc/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -549,11 +549,7 @@ Code Formatting

xarray uses several tools to ensure a consistent code format throughout the project:

- `Black <https://black.readthedocs.io/en/stable/>`_ for standardized
code formatting,
- `blackdoc <https://blackdoc.readthedocs.io/en/stable/>`_ for
standardized code formatting in documentation,
- `ruff <https://github.com/charliermarsh/ruff/>`_ for code quality checks and standardized order in imports
- `ruff <https://github.com/astral-sh/ruff>`_ for formatting, code quality checks and standardized order in imports
- `absolufy-imports <https://github.com/MarcoGorelli/absolufy-imports>`_ for absolute instead of relative imports from different files,
- `mypy <http://mypy-lang.org/>`_ for static type checking on `type hints
<https://docs.python.org/3/library/typing.html>`_.
Expand Down Expand Up @@ -1069,7 +1065,7 @@ PR checklist
- Test the code using `Pytest <http://doc.pytest.org/en/latest/>`_. Running all tests (type ``pytest`` in the root directory) takes a while, so feel free to only run the tests you think are needed based on your PR (example: ``pytest xarray/tests/test_dataarray.py``). CI will catch any failing tests.
- By default, the upstream dev CI is disabled on pull request and push events. You can override this behavior per commit by adding a ``[test-upstream]`` tag to the first line of the commit message. For documentation-only commits, you can skip the CI per commit by adding a ``[skip-ci]`` tag to the first line of the commit message.
- **Properly format your code** and verify that it passes the formatting guidelines set by `Black <https://black.readthedocs.io/en/stable/>`_ and `Flake8 <http://flake8.pycqa.org/en/latest/>`_. See `"Code formatting" <https://docs.xarray.dev/en/stablcontributing.html#code-formatting>`_. You can use `pre-commit <https://pre-commit.com/>`_ to run these automatically on each commit.
- **Properly format your code** and verify that it passes the formatting guidelines set by `ruff <https://github.com/astral-sh/ruff>`_. See `"Code formatting" <https://docs.xarray.dev/en/stablcontributing.html#code-formatting>`_. You can use `pre-commit <https://pre-commit.com/>`_ to run these automatically on each commit.
- Run ``pre-commit run --all-files`` in the root directory. This may modify some files. Confirm and commit any formatting changes.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ extend-exclude = [

[tool.ruff.lint]
# E402: module level import not at top of file
# E501: line too long - let black worry about that
# E501: line too long - let the formatter worry about that
# E731: do not assign a lambda expression, use a def
extend-safe-fixes = [
"TID252", # absolute imports
Expand Down

0 comments on commit a97f313

Please sign in to comment.