Skip to content

Commit

Permalink
remove support of blue (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
Naman-Priyadarshi authored Feb 23, 2024
1 parent b31760f commit fa12396
Show file tree
Hide file tree
Showing 20 changed files with 8 additions and 89 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 3 additions & 19 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ the following way:
```python
> [ ] bandit
[ ] black
[ ] blue
[ ] conda
[ ] coverage
[ ] flake8
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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).
Expand Down
1 change: 0 additions & 1 deletion src/scicookie/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
],
"use_bandit": "no",
"use_black": "yes",
"use_blue": "no",
"use_conda": "yes",
"use_makim": "yes",
"use_make": "no",
Expand Down
10 changes: 0 additions & 10 deletions src/scicookie/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
Expand Down Expand Up @@ -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}}")
Expand Down Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion src/scicookie/profiles/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ use_tools:
choices:
- bandit
- black
- blue
- conda
- coverage
- flake8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/scicookie/{{cookiecutter.project_slug}}/.releaserc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{%- if cookiecutter.use_blue -%}
{%- set QUOTE = "'" -%}
{%- elif cookiecutter.use_black -%}
{%- if cookiecutter.use_black -%}
{%- set QUOTE = '\\"' -%}
{%- else -%}
{%- set QUOTE = "'" -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "'" -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "'" -%}
Expand Down
3 changes: 1 addition & 2 deletions tests/smoke/auto-format-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit fa12396

Please sign in to comment.