diff --git a/README.md b/README.md index bf61505d..e4fabc8e 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ for a Python package. - 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 + - 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..5dae2bc0 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,7 @@ 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 -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 +689,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 cecef34d..2454a63a 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..4a2550ee 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/.releaserc.json +++ b/src/scicookie/{{cookiecutter.project_slug}}/.releaserc.json @@ -1,6 +1,4 @@ -{%- if cookiecutter.use_blue -%} - {%- set QUOTE = "'" -%} -{%- elif cookiecutter.use_black -%} +{%- if cookiecutter.use_black -%} {%- set QUOTE = '\\"' -%} {%- else -%} {%- set QUOTE = "'" -%} 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 394fb135..16b3d8d0 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 5db11719..69bbfb93 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,<23.10", {% 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 20ab4edb..274a69a3 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,<23.10", {% 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 3e166688..361247ee 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,<23.10", {% 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 379b0b39..7b1ada1f 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,<23.10", {% 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 ec9471c9..ba0b2a59 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,<23.10", {% 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 fd43b7f6..61d00b4f 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,<23.10" {% 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 ba64427d..fbd1ba81 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,<23.10", {% 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 7eb3afef..cadd5901 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,<23.10", {% 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 3a3cab98..a04a641a 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,<23.10", {% 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..df3aeade 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/{{cookiecutter.package_slug}}/__init__.py +++ b/src/scicookie/{{cookiecutter.project_slug}}/{{cookiecutter.package_slug}}/__init__.py @@ -2,9 +2,7 @@ {%- if cookiecutter.use_mypy == "yes" %} # mypy: disable-error-code="attr-defined" {%- endif %} -{%- 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/src/scicookie/{{cookiecutter.project_slug}}/{{cookiecutter.package_slug}}/__main__.py b/src/scicookie/{{cookiecutter.project_slug}}/{{cookiecutter.package_slug}}/__main__.py index 6ab378b6..0bf382ce 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,7 @@ - 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..39430ecf 100755 --- a/tests/smoke/auto-format-tools.sh +++ b/tests/smoke/auto-format-tools.sh @@ -2,5 +2,4 @@ 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"