Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: thombashi/tcolorpy
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.1.3
Choose a base ref
...
head repository: thombashi/tcolorpy
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.1.4
Choose a head ref
  • 15 commits
  • 7 files changed
  • 1 contributor

Commits on Sep 16, 2023

  1. Apply auto formatter

    thombashi committed Sep 16, 2023
    Copy the full SHA
    20bc767 View commit details
  2. Bump pypy version of CI

    thombashi committed Sep 16, 2023
    Copy the full SHA
    284af73 View commit details
  3. Add build-package job to CI

    thombashi committed Sep 16, 2023
    Copy the full SHA
    f15fb2c View commit details
  4. Add lint job to CI

    thombashi committed Sep 16, 2023
    Copy the full SHA
    9ff032f View commit details
  5. Copy the full SHA
    c31a027 View commit details
  6. Copy the full SHA
    e196e3f View commit details
  7. Update test_requirements

    thombashi committed Sep 16, 2023
    Copy the full SHA
    c3f85e1 View commit details
  8. Modify release target

    thombashi committed Sep 16, 2023
    Copy the full SHA
    0e60a70 View commit details
  9. Copy the full SHA
    bb808eb View commit details
  10. Copy the full SHA
    1cd8cca View commit details
  11. Update [build-system]

    thombashi committed Sep 16, 2023
    Copy the full SHA
    aefce6c View commit details
  12. Apply auto formatter

    thombashi committed Sep 16, 2023
    Copy the full SHA
    b22cf0b View commit details
  13. Update tool.mypy

    thombashi committed Sep 16, 2023
    Copy the full SHA
    5e4aef2 View commit details
  14. Improve type annotations

    thombashi committed Sep 16, 2023
    Copy the full SHA
    a1863b6 View commit details
  15. Bump version

    thombashi committed Sep 16, 2023
    Copy the full SHA
    b4bb8e3 View commit details
Showing with 78 additions and 35 deletions.
  1. +33 −2 .github/workflows/tests.yml
  2. +1 −1 Makefile
  3. +28 −20 pyproject.toml
  4. +2 −2 requirements/test_requirements.txt
  5. +1 −1 tcolorpy/__version__.py
  6. +11 −5 tcolorpy/_truecolor.py
  7. +2 −4 tox.ini
35 changes: 33 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -3,17 +3,48 @@ name: Tests
on: [push, pull_request]

jobs:
build-package:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref_name }}-build
cancel-in-progress: true
timeout-minutes: 20
container:
image: ghcr.io/thombashi/python-ci:3.11

steps:
- uses: actions/checkout@v4

- run: make build

lint:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-lint
cancel-in-progress: true
timeout-minutes: 20
container:
image: ghcr.io/thombashi/python-ci:3.11

steps:
- uses: actions/checkout@v4

- run: make check

unit-test:
runs-on: ${{ matrix.os }}
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-ut-${{ matrix.os }}-${{ matrix.python-version }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11','pypy-3.8']
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "pypy-3.10"]
os: [ubuntu-latest, macos-latest, windows-latest]
timeout-minutes: 20

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ fmt:

.PHONY: release
release:
@cd $(PKG_BUILD_DIR) && $(PYTHON) setup.py release --sign
@cd $(PKG_BUILD_DIR) && $(PYTHON) setup.py release --sign --verbose
@$(MAKE) clean

.PHONY: setup
48 changes: 28 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=61.0"]

[tool.black]
line-length = 100
exclude = '''
/(
\.eggs
@@ -18,55 +18,63 @@ exclude = '''
)/
| docs/conf.py
'''
line-length = 100
target-version = ['py37', 'py38', 'py39', 'py310', 'py311']

[tool.coverage.run]
source = ['tcolorpy']
branch = true
source = ['tcolorpy']

[tool.coverage.report]
show_missing = true
precision = 1
exclude_lines = [
'except ImportError',
'raise NotImplementedError',
'pass',
'ABCmeta',
'abstractmethod',
'abstractproperty',
'abstractclassmethod',
'warnings.warn',
'except ImportError',
'raise NotImplementedError',
'pass',
'ABCmeta',
'abstractmethod',
'abstractproperty',
'abstractclassmethod',
'warnings.warn',
]
precision = 1
show_missing = true

[tool.isort]
include_trailing_comma = true
known_third_party = [
'pytest',
'pytest',
]
include_trailing_comma = true
line_length = 100
lines_after_imports = 2
multi_line_output = 3
skip_glob = [
'*/.eggs/*',
'*/.pytype/*',
'*/.tox/*',
'*/.eggs/*',
'*/.pytype/*',
'*/.tox/*',
]

[tool.mypy]
ignore_missing_imports = true
python_version = 3.7

pretty = true

check_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
no_implicit_optional = true
show_error_codes = true
show_error_context = true
warn_redundant_casts = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true

[tool.pytest.ini_options]
testpaths = [
"test",
"test",
]

md_report = true
md_report_verbose = 0
md_report_color = "auto"
md_report_verbose = 0
4 changes: 2 additions & 2 deletions requirements/test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pytest
pytest-md-report>=0.1
pytest>=6.0.1
pytest-md-report>=0.4.1
2 changes: 1 addition & 1 deletion tcolorpy/__version__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__author__ = "Tsuyoshi Hombashi"
__copyright__ = f"Copyright 2020, {__author__}"
__license__ = "MIT License"
__version__ = "0.1.3"
__version__ = "0.1.4"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
16 changes: 11 additions & 5 deletions tcolorpy/_truecolor.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
from collections import namedtuple
from colorsys import rgb_to_hsv
from enum import Enum
from typing import List, Optional, Sequence, Tuple, Type, Union, cast # noqa
from typing import Any, List, Optional, Sequence, Tuple, Type, Union, cast # noqa

from ._const import CSI, RESET, AnsiBGColor, AnsiFGColor, AnsiStyle

@@ -68,7 +68,10 @@ def __init__(self, color: Union["Color", str, RGBTuple]) -> None:
self.__name = color.name # type: ignore
self.red, self.green, self.blue = color.red, color.green, color.blue # type: ignore

def __eq__(self, other) -> bool:
def __eq__(self, other: Any) -> bool:
if not isinstance(other, Color):
return False

if self.name and other.name:
return self.name == other.name
elif self.name or other.name:
@@ -79,7 +82,10 @@ def __eq__(self, other) -> bool:

return False

def __ne__(self, other) -> bool:
def __ne__(self, other: Any) -> bool:
if not isinstance(other, Color):
return True

return not self.__eq__(other)

def __repr__(self) -> str:
@@ -131,13 +137,13 @@ def hsv(self) -> HSV:
def calc_scaler(self) -> int:
return self.red + self.green + self.blue

def calc_complementary(self):
def calc_complementary(self) -> "Color":
rgb = (self.red, self.green, self.blue)
n = max(rgb) + min(rgb)
return Color((n - self.red, n - self.green, n - self.blue))


def _normalize_enum(value, enum_class: Type[Enum]):
def _normalize_enum(value: Any, enum_class: Type[Enum]) -> Any:
if isinstance(value, enum_class):
return value

6 changes: 2 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -15,12 +15,11 @@ commands =

[testenv:build]
deps =
build>=0.10
twine
wheel
commands =
python setup.py sdist bdist_wheel
python -m build
twine check dist/*.whl dist/*.tar.gz
python setup.py clean --all

[testenv:clean]
skip_install = true
@@ -56,6 +55,5 @@ deps =
mypy>=1
pylama>=8.4.1
commands =
python setup.py check
mypy tcolorpy setup.py
pylama