diff --git a/README.md b/README.md index bf61505d..3ec4c502 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ for a Python package. - Allows package slug (use `_` instead of `-`) - Licenses supported: MIT, BSD 3 Clause, ISC License, Apache Software License 2.0, and GPL 3 - Documentation engines: mkdocs, sphinx, jupyter-boook - - Test library: pytest, hypothesis - - Auto format code tool: blue and black + - Test library: pytest, hypothesis + - Auto format code tool: black - Initial integration with git - Support to conda (as base environment) and poetry as packaging and dependency management - Support to pre-commit diff --git a/docs/guide.md b/docs/guide.md index a3dbd653..6a486556 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -54,7 +54,6 @@ the following way: ```python > [ ] bandit [ ] black - [ ] blue [ ] conda [ ] coverage [ ] flake8 @@ -485,7 +484,7 @@ of coding standards, such as PEP 8 guidelines. It helps us ensure consistency in our code, saves time by automating the formatting process, reduces errors by enforcing coding standards, and facilitates collaboration by making it easier for multiple developers to work on the same code base. In the options of -SciCookie, you will find two choices: *Black* and *Blue*. +SciCookie, you will find: *Black*. - [**Black**](https://black.readthedocs.io): It is a popular code formatter tool for Python that automatically formats code to conform to PEP 8 guidelines. It @@ -497,22 +496,12 @@ standards. You can read the [*black documentation*](https://black.readthedocs.io) if you want to know more about it. -- [**Blue**](https://blue.readthedocs.io/en/latest/): is a slightly less - rigid code formatter than *black*, it contains only a few improvements - that the maintainers have considered. It is hoped that in time it can - be merged with the *black* project. Some differences between *blue* - and *black*: *blue* defaults to single-quoted strings for everything - except docstrings and triple-quoted strings (TQS). *blue* defaults to - 79-character line lengths, preserving whitespace before the pad for - right-justified comments. It also supports multiple configuration - files: `pyproject.toml`, `setup.cfg`, `tox.ini` and `.blue`. - -If you select both *Blue* and *Black* libraries in the TUI (Terminal User -Interface), you will see the following message: "The libs Blue and Black were -selected, but you need to choose just one of them." and the template generation +If you select *Black* libraries in the TUI (Terminal User +Interface), you will see the following message: "The libs Black were +selected." and the template generation process will be stopped. -Using code formatters such as *Black* or *Blue* in your project helps ensure +Using code formatters such as *Black* in your project helps ensure consistent and readable code, making it easier to maintain and collaborate on. ### Code security vulnerabilities @@ -705,7 +694,7 @@ It is a code quality control tool that runs automatically before commits are made to a version control repository. When a commit is made, pre-commit executes the configured hooks. If you select the pre-commit option offered by SciCookie, we have configured the following hooks for -you: *end-of-file-fixer*, *blue*, *black*, *flake8*, *ruff*, *isort*, +you: *end-of-file-fixer*, *black*, *flake8*, *ruff*, *isort*, *mypy*, *shellcheck*, *bandit*, *pydocstyle*, *vulture* and *mccabe* (will be available in your project according to the tools you have selected in TUI). diff --git a/src/scicookie/cookiecutter.json b/src/scicookie/cookiecutter.json index 3600c277..0d88ffb1 100644 --- a/src/scicookie/cookiecutter.json +++ b/src/scicookie/cookiecutter.json @@ -57,7 +57,6 @@ ], "use_bandit": "no", "use_black": "yes", - "use_blue": "no", "use_conda": "yes", "use_makim": "yes", "use_make": "no", diff --git a/src/scicookie/hooks/post_gen_project.py b/src/scicookie/hooks/post_gen_project.py index 6921336c..80c474e2 100644 --- a/src/scicookie/hooks/post_gen_project.py +++ b/src/scicookie/hooks/post_gen_project.py @@ -28,7 +28,6 @@ PACKAGE_PATH = PROJECT_DIRECTORY / "{{ cookiecutter.package_slug}}" USE_BLACK = {{ cookiecutter.use_black == "yes" }} -USE_BLUE = {{ cookiecutter.use_blue == "yes" }} USE_BANDIT = {{ cookiecutter.use_bandit == "yes" }} USE_CONTAINERS = {{ cookiecutter.use_containers in ['Docker', 'Podman'] }} USE_CLI = {{ cookiecutter.command_line_interface != "None" }} @@ -258,14 +257,6 @@ def http2ssh(url): return url.replace("/", ":", 1) -def validation(): - if USE_BLUE and USE_BLACK: - raise Exception( - "The libs Blue and Black were selected, but you need to choose " - "just one of them." - ) - - def prepare_git() -> None: git_https_origin = http2ssh("{{cookiecutter.git_https_origin}}") git_https_upstream = http2ssh("{{cookiecutter.git_https_upstream}}") @@ -359,7 +350,6 @@ def clean_up_mypy(): def post_gen(): - validation() # keep this one first, because it changes the package folder clean_up_project_layout() diff --git a/src/scicookie/profiles/base.yaml b/src/scicookie/profiles/base.yaml index 135ce9cc..fa5fbd8e 100644 --- a/src/scicookie/profiles/base.yaml +++ b/src/scicookie/profiles/base.yaml @@ -136,7 +136,6 @@ use_tools: choices: - bandit - black - - blue - conda - coverage - flake8 diff --git a/src/scicookie/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/src/scicookie/{{cookiecutter.project_slug}}/.pre-commit-config.yaml index eacceb66..a3b62195 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/.pre-commit-config.yaml +++ b/src/scicookie/{{cookiecutter.project_slug}}/.pre-commit-config.yaml @@ -21,15 +21,6 @@ repos: language: system pass_filenames: no {# keep this comment #} -{%- if cookiecutter.use_blue == "yes" %} - - id: blue - name: blue - entry: blue - language: system - pass_filenames: true - types: - - python -{% endif -%} {%- if cookiecutter.use_black == "yes" %} - id: black name: black diff --git a/src/scicookie/{{cookiecutter.project_slug}}/.releaserc.json b/src/scicookie/{{cookiecutter.project_slug}}/.releaserc.json index abfe2459..52ddfaae 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/.releaserc.json +++ b/src/scicookie/{{cookiecutter.project_slug}}/.releaserc.json @@ -1,5 +1,3 @@ -{%- if cookiecutter.use_blue -%} - {%- set QUOTE = "'" -%} {%- elif cookiecutter.use_black -%} {%- set QUOTE = '\\"' -%} {%- else -%} diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/base-pyproject.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/base-pyproject.toml index c3d47267..dc86d3b1 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/base-pyproject.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/base-pyproject.toml @@ -11,16 +11,6 @@ testpaths = [ ] {% endif %} -{%- if cookiecutter.use_blue == "yes" %} -[tool.blue] -line-length = 79 -target-version = ["py38"] -force-exclude = '''(?x)( - docs/* - | .*\\.egg-info -)''' # TOML's single-quoted strings do not require escaping backslashes -{% endif %} - {%- if cookiecutter.use_black == "yes" %} [tool.black] line-length = 79 diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/flit-pyproject.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/flit-pyproject.toml index 7511a2f5..2baf1b35 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/flit-pyproject.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/flit-pyproject.toml @@ -62,9 +62,6 @@ dependencies = [ {%- if cookiecutter.use_coverage == "yes" -%} "coverage >= 7.2.7", {% endif %} -{%- if cookiecutter.use_blue == "yes" -%} - "blue >= 0.9.1", -{% endif %} {%- if cookiecutter.use_black == "yes" -%} "black >= 23.3.0", {% endif %} diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/hatch-pyproject.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/hatch-pyproject.toml index 973b7252..a48dfa6f 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/hatch-pyproject.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/hatch-pyproject.toml @@ -52,9 +52,6 @@ dependencies = [ {%- if cookiecutter.use_coverage == "yes" -%} "coverage >= 7.2.7", {% endif %} -{%- if cookiecutter.use_blue == "yes" -%} - "blue >= 0.9.1", -{% endif %} {%- if cookiecutter.use_black == "yes" -%} "black >= 23.3.0", {% endif %} diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/maturin-pyproject.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/maturin-pyproject.toml index 902fc073..fb7d8198 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/maturin-pyproject.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/maturin-pyproject.toml @@ -62,9 +62,6 @@ dependencies = [ {%- if cookiecutter.use_coverage == "yes" -%} "coverage>=7.2.7", {% endif %} -{%- if cookiecutter.use_blue == "yes" -%} - "blue>=0.9.1", -{% endif %} {%- if cookiecutter.use_black == "yes" -%} "black>=23.3.0", {% endif %} diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/mesonpy-pyproject.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/mesonpy-pyproject.toml index a79c0fb8..10e63ea2 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/mesonpy-pyproject.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/mesonpy-pyproject.toml @@ -62,9 +62,6 @@ dependencies = [ {%- if cookiecutter.use_coverage == "yes" -%} "coverage>=7.2.7", {% endif %} -{%- if cookiecutter.use_blue == "yes" -%} - "blue>=0.9.1", -{% endif %} {%- if cookiecutter.use_black == "yes" -%} "black>=23.3.0", {% endif %} diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/pdm-pyproject.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/pdm-pyproject.toml index 3ab1e47b..d3b7bab6 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/pdm-pyproject.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/pdm-pyproject.toml @@ -62,9 +62,6 @@ dependencies = [ {%- if cookiecutter.use_coverage == "yes" -%} "coverage>=7.2.7", {% endif %} -{%- if cookiecutter.use_blue == "yes" -%} - "blue>=0.9.1", -{% endif %} {%- if cookiecutter.use_black == "yes" -%} "black>=23.3.0", {% endif %} diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/poetry-pyproject.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/poetry-pyproject.toml index 50eab49a..59b64598 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/poetry-pyproject.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/poetry-pyproject.toml @@ -45,9 +45,6 @@ hypothesis = "^6.0" {%- if cookiecutter.use_coverage == "yes" -%} coverage = "^7.2.7" {% endif %} -{%- if cookiecutter.use_blue == "yes" -%} -blue = "^0.9.1" -{% endif %} {%- if cookiecutter.use_black == "yes" -%} black = "^23.3.0" {% endif %} diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/pybind11-pyproject.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/pybind11-pyproject.toml index bf87e0fe..9382b419 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/pybind11-pyproject.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/pybind11-pyproject.toml @@ -53,9 +53,6 @@ dependencies = [ {%- if cookiecutter.use_coverage == "yes" -%} "coverage >= 7.2.7,<8", {% endif %} -{%- if cookiecutter.use_blue == "yes" -%} - "blue >= 0.9.1,<1", -{% endif %} {%- if cookiecutter.use_black == "yes" -%} "black >= 23.3.0,<24", {% endif %} diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/scikit-build-core-pyproject.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/scikit-build-core-pyproject.toml index f3ac5276..c69ebda0 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/scikit-build-core-pyproject.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/scikit-build-core-pyproject.toml @@ -61,9 +61,6 @@ dependencies = [ {%- if cookiecutter.use_coverage == "yes" -%} "coverage >= 7.2.7", {% endif %} -{%- if cookiecutter.use_blue == "yes" -%} - "blue >= 0.9.1", -{% endif %} {%- if cookiecutter.use_black == "yes" -%} "black >= 23.3.0", {% endif %} diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/setuptools-pyproject.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/setuptools-pyproject.toml index b236b91a..01a1014d 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/setuptools-pyproject.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/setuptools-pyproject.toml @@ -45,9 +45,6 @@ dependencies = [ {%- if cookiecutter.use_coverage == "yes" -%} "coverage >= 7.2.7", {% endif %} -{%- if cookiecutter.use_blue == "yes" -%} - "blue >= 0.9.1", -{% endif %} {%- if cookiecutter.use_black == "yes" -%} "black >= 23.3.0", {% endif %} diff --git a/src/scicookie/{{cookiecutter.project_slug}}/{{cookiecutter.package_slug}}/__init__.py b/src/scicookie/{{cookiecutter.project_slug}}/{{cookiecutter.package_slug}}/__init__.py index 810e51c6..83048e7d 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/{{cookiecutter.package_slug}}/__init__.py +++ b/src/scicookie/{{cookiecutter.project_slug}}/{{cookiecutter.package_slug}}/__init__.py @@ -2,8 +2,6 @@ {%- if cookiecutter.use_mypy == "yes" %} # mypy: disable-error-code="attr-defined" {%- endif %} -{%- if cookiecutter.use_blue == "yes" %} - {%- set QUOTE = "'" -%} {%- elif cookiecutter.use_black == "yes" %} {%- set QUOTE = '"' -%} {%- else %} diff --git a/src/scicookie/{{cookiecutter.project_slug}}/{{cookiecutter.package_slug}}/__main__.py b/src/scicookie/{{cookiecutter.project_slug}}/{{cookiecutter.package_slug}}/__main__.py index 6ab378b6..f8960b17 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/{{cookiecutter.package_slug}}/__main__.py +++ b/src/scicookie/{{cookiecutter.project_slug}}/{{cookiecutter.package_slug}}/__main__.py @@ -6,9 +6,8 @@ - https://docs.python.org/2/using/cmdline.html#cmdoption-m - https://docs.python.org/3/using/cmdline.html#cmdoption-m """ -{%- if cookiecutter.use_blue == "yes" %} - {%- set QUOTE = "'" -%} -{%- elif cookiecutter.use_black == "yes" %} + +{%- if cookiecutter.use_black == "yes" %} {%- set QUOTE = '"' -%} {%- else %} {%- set QUOTE = "'" -%} diff --git a/tests/smoke/auto-format-tools.sh b/tests/smoke/auto-format-tools.sh index 522f3fc8..ef32e459 100755 --- a/tests/smoke/auto-format-tools.sh +++ b/tests/smoke/auto-format-tools.sh @@ -2,5 +2,5 @@ SMOKE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -. ${SMOKE_DIR}/base.sh "use_black=yes use_blue=no" -. ${SMOKE_DIR}/base.sh "use_black=no use_blue=yes" +. ${SMOKE_DIR}/base.sh "use_black=yes" +. ${SMOKE_DIR}/base.sh "use_black=no"