Skip to content

Commit

Permalink
Use colour checks configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Jan 13, 2025
1 parent f48234a commit 9e989e8
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 114 deletions.
27 changes: 25 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
# Common Files
*.egg-info
*.pyc
*.pyo
.DS_Store
.idea
.coverage*
uv.lock

# Common Directories
.fleet/
.idea/
.ipynb_checkpoints/
.python-version
.vs/
.vscode/
.sandbox/
build/
dist/
docs/_build/
docs/generated/
node_modules/
references/

__pycache__

# Project Directories
site/
poetry.lock
20 changes: 9 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.5.0"
rev: "v5.0.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
exclude: config-aces-reference.ocio.yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
Expand All @@ -15,33 +16,30 @@ repos:
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
args: ["--ignore-words-list=buil"]
- repo: https://github.com/ikamensh/flynt
rev: "1.0.1"
hooks:
- id: flynt
args: [--verbose]
args: ["--ignore-words-list=buil,socio-economic"]
- repo: https://github.com/PyCQA/isort
rev: "5.13.2"
hooks:
- id: isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.14"
rev: "v0.8.2"
hooks:
- id: ruff-format
- id: ruff
args: [--fix]
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
rev: 1.19.1
hooks:
- id: blacken-docs
language_version: python3.10
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
exclude: config-aces-reference.ocio.yaml
- repo: https://github.com/pre-commit/pygrep-hooks
rev: "v1.10.0"
hooks:
Expand Down
161 changes: 64 additions & 97 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
[tool.poetry]
[project]
name = "awesome-colour"
version = "1.0.0"
description = "Curated list of awesome colour science resources"
license = "CC0"
authors = ["Colour Developers <[email protected]>"]
maintainers = ["Colour Developers <[email protected]>"]
repository = "https://github.com/colour-science/awesome-colour"
homepage = "http://awesome-colour.org/"
readme = "readme.md"
requires-python = ">=3.10,<3.14"
authors = [
{ name = "Colour Developers", email = "[email protected]" },
]
maintainers = [
{ name = "Colour Developers", email = "[email protected]" }
]
license = { text = "CC0" }
keywords = [
"awesome",
"awesome-list",
Expand All @@ -27,20 +31,24 @@ keywords = [
"datasets"
]

[tool.poetry.dependencies]
python = ">= 3.10, < 3.14"
mkdocs = "*"
"mkdocs-material" = "*"
dependencies = [
"mkdocs",
"mkdocs-material",
]

[tool.poetry.group.dev.dependencies]
invoke = "*"
pre-commit = "*"
[project.urls]
Homepage = "http://awesome-colour.org/"
Repository = "https://github.com/colour-science/awesome-colour"

[tool.codespell]
ignore-words-list = 'buil'
[tool.uv]
package = true
dev-dependencies = [
"invoke",
"pre-commit",
]

[tool.flynt]
line_length = 999
[tool.codespell]
ignore-words-list = "buil,socio-economic"

[tool.isort]
ensure_newline_before_comments = true
Expand All @@ -56,92 +64,55 @@ reportMissingImports = false
reportMissingModuleSource = false
reportUnboundVariable = false
reportUnnecessaryCast = true
reportUnnecessaryTypeIgnorComment = true
reportUnnecessaryTypeIgnoreComment = true
reportUnsupportedDunderAll = false
reportUnusedExpression = false

[tool.pytest.ini_options]
addopts = "-n auto --dist=loadscope --durations=5"
addopts = "--durations=5"

[tool.ruff]
target-version = "py310"
line-length = 88
select = [
"A", # flake8-builtins
"ARG", # flake8-unused-arguments
# "ANN", # flake8-annotations
"B", # flake8-bugbear
# "BLE", # flake8-blind-except
"C4", # flake8-comprehensions
# "C90", # mccabe
# "COM", # flake8-commas
"DTZ", # flake8-datetimez
"D", # pydocstyle
"E", # pydocstyle
# "ERA", # eradicate
# "EM", # flake8-errmsg
"EXE", # flake8-executable
"F", # flake8
# "FBT", # flake8-boolean-trap
"G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
"INP", # flake8-no-pep420
"ISC", # flake8-implicit-str-concat
"N", # pep8-naming
# "PD", # pandas-vet
"PIE", # flake8-pie
"PGH", # pygrep-hooks
"PL", # pylint
# "PT", # flake8-pytest-style
# "PTH", # flake8-use-pathlib [Enable] "Q", # flake8-quotes
"RET", # flake8-return
"RUF", # Ruff
"S", # flake8-bandit
"SIM", # flake8-simplify
"T10", # flake8-debugger
"T20", # flake8-print
# "TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"UP", # pyupgrade
"W", # pydocstyle
"YTT", # flake8-2020
]
select = ["ALL"]
ignore = [
"B008",
"B905",
"D104",
"D200",
"D202",
"D205",
"D301",
"D400",
"I001",
"N801",
"N802",
"N803",
"N806",
"N813",
"N815",
"N816",
"PGH003",
"PIE804",
"PLE0605",
"PLR0911",
"PLR0912",
"PLR0913",
"PLR0915",
"PLR2004",
"RET504",
"RET505",
"RET506",
"RET507",
"RET508",
"TRY003",
"TRY300",
"C", # Pylint - Convention
"C90", # mccabe
"COM", # flake8-commas
"ERA", # eradicate
"FBT", # flake8-boolean-trap
"FIX", # flake8-fixme
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib [Enable]
"TD", # flake8-todos
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
"D200", # One-line docstring should fit on one line
"D202", # No blank lines allowed after function docstring
"D205", # 1 blank line required between summary line and description
"D301", # Use `r"""` if any backslashes in a docstring
"D400", # First line should end with a period
"I001", # Import block is un-sorted or un-formatted
"N801", # Class name `.*` should use CapWords convention
"N802", # Function name `.*` should be lowercase
"N803", # Argument name `.*` should be lowercase
"N806", # Variable `.*` in function should be lowercase
"N813", # Camelcase `.*` imported as lowercase `.*`
"N815", # Variable `.*` in class scope should not be mixedCase
"N816", # Variable `.*` in global scope should not be mixedCase
"NPY002", # Replace legacy `np.random.random` call with `np.random.Generator`
"PGH003", # Use specific rule codes when ignoring type issues
"PLR0912", # Too many branches
"PLR0913", # Too many arguments in function definition
"PLR0915", # Too many statements
"PLR2004", # Magic value used in comparison, consider replacing `.*` with a constant variable
"PYI036", # Star-args in `.*` should be annotated with `object`
"PYI051", # `Literal[".*"]` is redundant in a union with `str`
"PYI056", # Calling `.append()` on `__all__` may not be supported by all type checkers (use `+=` instead)
"RUF022", # [*] `__all__` is not sorted
"TRY003", # Avoid specifying long messages outside the exception class
"UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)`
]
fixable = ["B", "C", "E", "F", "PIE", "RUF", "SIM", "UP", "W"]
typing-modules = ["colour.hints"]

[tool.ruff.pydocstyle]
convention = "numpy"
Expand All @@ -151,7 +122,3 @@ convention = "numpy"

[tool.ruff.format]
docstring-code-format = true

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
17 changes: 13 additions & 4 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
==============
"""

from __future__ import annotations

import typing

if typing.TYPE_CHECKING:
from invoke.context import Context

from invoke import task

__author__ = "Colour Developers"
Expand All @@ -20,7 +27,7 @@


@task
def precommit(ctx):
def precommit(ctx: Context) -> None:
"""
Run the "pre-commit" hooks on the codebase.
Expand All @@ -35,7 +42,7 @@ def precommit(ctx):


@task(precommit)
def build(ctx):
def build(ctx: Context) -> None:
"""
Build the project.
Expand All @@ -51,7 +58,7 @@ def build(ctx):


@task(build)
def release(ctx):
def release(ctx: Context) -> None:
"""
Release the project to *Github Pages*.
Expand All @@ -65,6 +72,8 @@ def release(ctx):

output = ctx.run("git status")
if "nothing to commit, working tree clean" not in output.stdout:
raise RuntimeError("Working tree is not clean, please commit your changes!")
exception = "Working tree is not clean, please commit your changes!"

raise RuntimeError(exception)

ctx.run("mkdocs gh-deploy")

0 comments on commit 9e989e8

Please sign in to comment.