Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install build twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
python -m build
twine upload dist/*
12 changes: 8 additions & 4 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ The source code, located at `the ColorDetect project page <https://github.com/Ma

Setup
-----
This project can be setup with::
This project uses `uv <https://docs.astral.sh/uv/>`_ for dependency management.
Install it via::

python3 -m venv .venv
.venv/bin/activate
pip install -r requirements/requirements-dev.txt
curl -LsSf https://astral.sh/uv/install.sh | sh

Then set up the project::

uv venv
uv pip install -e ".[dev]"
pre-commit install


Expand Down
41 changes: 41 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "ColorDetect"
version = "1.6.3"
authors = [
{name = "Marvin Kweyu", email = "mkweyu1@gmail.com"},
]
description = "Detect and recognize colors in images or video"
readme = "README.md"
license = {text = "MIT"}
requires-python = ">=3.6"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX :: Linux",
]
dependencies = [
"numpy>=1.18.1",
"matplotlib>=3.2.1",
"opencv-python>=4.2.0.32",
"scikit-learn>=0.22.2.post1",
"webcolors>=1.11.1",
]

[project.urls]
Homepage = "https://github.com/MarvinKweyu/ColorDetect"

[project.optional-dependencies]
dev = [
"pytest",
"flake8",
"black",
"isort",
"pre-commit",
]

[tool.setuptools.packages.find]
where = ["."]
31 changes: 0 additions & 31 deletions setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import unicode_literals

import os
from distutils import dir_util
import shutil

import pytest

Expand Down Expand Up @@ -42,6 +42,6 @@ def datadir(tmpdir, request):
test_dir, _ = os.path.splitext(filename)

if os.path.isdir(test_dir):
dir_util.copy_tree(test_dir, bytes(tmpdir))
shutil.copytree(test_dir, str(tmpdir), dirs_exist_ok=True)

return tmpdir
4 changes: 2 additions & 2 deletions tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
test whether text is written to the image
"""

import imghdr
import mimetypes
from pathlib import Path

Expand All @@ -24,7 +23,8 @@ def test_argument_is_image(image):
"""
Ensure that the argument parsed is an image
"""
assert type(imghdr.what(Path(image))) is str
mime_type, _ = mimetypes.guess_type(str(image))
assert mime_type is not None and mime_type.startswith("image/")


def test_video_passed_is_valid_video(video):
Expand Down
2 changes: 0 additions & 2 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
From the developers perspective
"""

import mimetypes
import os
from pathlib import Path

import cv2
import pytest

from ..colordetect import ColorDetect, VideoColor, col_share
Expand Down