Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] - Update packaging #74

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

![Lint workflow](https://github.com/MarvinKweyu/ColorDetect/actions/workflows/lint.yml/badge.svg?branch=master)
[![PyPI version](https://badge.fury.io/py/ColorDetect.svg)](https://pypi.org/project/ColorDetect/)
[![Python](https://img.shields.io/badge/python-3.6%7C3.7%7C3.8%7C3.9-green)](https://pypi.org/project/ColorDetect/)
[![CircleCI](https://circleci.com/gh/MarvinKweyu/ColorDetect.svg?style=svg)](https://circleci.com/gh/MarvinKweyu/ColorDetect)
[![Python](https://img.shields.io/badge/python->=3.6-green)](https://pypi.org/project/ColorDetect/)
![Package tests](https://github.com/MarvinKweyu/ColorDetect/actions/workflows/package-tests.yml/badge.svg?branch=master)
[![Downloads](https://pepy.tech/badge/colordetect)](https://pypi.org/project/ColorDetect/)
[![Documentation Status](https://readthedocs.org/projects/colordetect/badge/?version=master)](https://colordetect.readthedocs.io/en/master/)

Expand Down
Empty file removed __init__.py
Empty file.
3 changes: 0 additions & 3 deletions colordetect/__init__.py

This file was deleted.

9 changes: 8 additions & 1 deletion docs/colshare.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ Depending on how many colors you have or how many dominant colors you want to na

::

>>> from colordetect import col_share

from src.colordetect import col_share
>>> all_colors = my_video.get_video_frames()
>>> top_colors = col_share.sort_order(object_description=all_colors,key_count=5)
{'[0.0, 0.0, 0.0]': 68.83, '[5.0, 7.0, 24.0]': 22.48, '[5.0, 8.0, 24.0]': 22.22, '[4.0, 7.0, 24.0]': 21.7, '[6.0, 9.0, 26.0]': 19.11}

The sort gets the top 5 colors, by default, from all the colors obtained from all the frames present. This may be adjusted to suit your needs.
A reverse of the same may be obtained by passing the
>>> all_colors = my_video.get_video_frames()
>>> top_colors = col_share.sort_order(object_description=all_colors,key_count=5)
{'[0.0, 0.0, 0.0]': 68.83, '[5.0, 7.0, 24.0]': 22.48, '[5.0, 8.0, 24.0]': 22.22, '[4.0, 7.0, 24.0]': 21.7, '[6.0, 9.0, 26.0]': 19.11}
Expand Down
40 changes: 40 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[build-system]
requires = ["setuptools>=61.0.0"]
build-backend = "setuptools.build_meta"

[project]
name = "ColorDetect"
dynamic = ["version"]
description = "Detect and recognize colors in images or video"
readme = "README.md"
authors = [
{ name = "Marvin Kweyu", email = "[email protected]" }
]
license = { file = "LICENSE" }
classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
]
keywords = ["ColorDetect", "color recognition","images", "video"]
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"
]
requires-python = ">=3.6"
[tool.setuptools]
tests = [
"tests/",
"*tests\\",
]

[project.optional-dependencies]
build = ["build", "twine"]
dev = ["black", "flake8","bumpver", "isort", "mypy", "pytest"]

[project.urls]
repository = "https://github.com/MarvinKweyu/ColorDetect"
documentation = "https://colordetect.readthedocs.io"
6 changes: 6 additions & 0 deletions src/colordetect/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

from color_detect import ColorDetect
from video_color_detect import VideoColor
from . import col_share

__all__ = ['ColorDetect', 'VideoColor', 'col_share']
2 changes: 1 addition & 1 deletion colordetect/col_share.py → src/colordetect/col_share.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Usage:


>>> from colordetect import col_share
>>> from src.colordetect import col_share
# show a progress bar for a process
>>> col_share.progress_bar("<current_process_position>", "<total_process_length>", "<process_description>")
# sort a dictionary by value to required length or in specific order
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
>>> colors = user_video.get_video_frames(frame_color_count=7)
>>> colors
# alternatively shorten the dictionary to get a specific number of sorted colors from the whole lot
>>> from colordetect import col_share
>>> from src.colordetect import col_share
>>> top_colors = col_share.sort_order(object_description=colors, key_count=8)
"""

Expand Down
2 changes: 1 addition & 1 deletion tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import matplotlib.colors as mcolors

from ..colordetect import ColorDetect
from src.colordetect import ColorDetect


def test_existence_of_image_vid_path(image, video):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import cv2
import pytest

from ..colordetect import ColorDetect, VideoColor, col_share
from src.colordetect import ColorDetect, VideoColor, col_share


def test_image_vid_parsed_to_class(image, video):
Expand Down
Loading