Spaces:
Sleeping
Sleeping
Commit ·
40f508b
1
Parent(s): 3ac14f9
Bump the version
Browse files- .bumpversion.cfg +1 -1
- pyproject.toml +5 -1
- src/deep_barcode_reader/__init__.py +1 -1
- src/deep_barcode_reader/logging.py +1 -1
- src/deep_barcode_reader/main.py +11 -6
- tests/test_deep_barcode_reader.py +1 -1
.bumpversion.cfg
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
[bumpversion]
|
| 2 |
-
current_version = 0.
|
| 3 |
commit = False
|
| 4 |
tag = False
|
| 5 |
|
|
|
|
| 1 |
[bumpversion]
|
| 2 |
+
current_version = 0.2.0
|
| 3 |
commit = False
|
| 4 |
tag = False
|
| 5 |
|
pyproject.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
[tool.poetry]
|
| 2 |
name = "deep_barcode_reader"
|
| 3 |
-
version = "0.
|
| 4 |
description = "It can read different types of barcodes"
|
| 5 |
authors = ["Afshin Dini <Afshin Dini>"]
|
| 6 |
readme = "README.md"
|
|
@@ -38,6 +38,10 @@ branch = true
|
|
| 38 |
[tool.poetry.dependencies]
|
| 39 |
python = "^3.10"
|
| 40 |
click = "^8.1.7"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
|
| 43 |
[tool.poetry.group.dev.dependencies]
|
|
|
|
| 1 |
[tool.poetry]
|
| 2 |
name = "deep_barcode_reader"
|
| 3 |
+
version = "0.2.0"
|
| 4 |
description = "It can read different types of barcodes"
|
| 5 |
authors = ["Afshin Dini <Afshin Dini>"]
|
| 6 |
readme = "README.md"
|
|
|
|
| 38 |
[tool.poetry.dependencies]
|
| 39 |
python = "^3.10"
|
| 40 |
click = "^8.1.7"
|
| 41 |
+
asyncio = "^3.4.3"
|
| 42 |
+
numpy = "^2.2.3"
|
| 43 |
+
opencv-python = "^4.11.0.86"
|
| 44 |
+
pyzbar = "^0.1.9"
|
| 45 |
|
| 46 |
|
| 47 |
[tool.poetry.group.dev.dependencies]
|
src/deep_barcode_reader/__init__.py
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
""" It can read different types of barcodes """
|
| 2 |
|
| 3 |
-
__version__ = "0.
|
|
|
|
| 1 |
""" It can read different types of barcodes """
|
| 2 |
|
| 3 |
+
__version__ = "0.2.0"
|
src/deep_barcode_reader/logging.py
CHANGED
|
@@ -5,7 +5,7 @@ import logging.config
|
|
| 5 |
from typing import Any, Optional
|
| 6 |
|
| 7 |
|
| 8 |
-
def config_logger(loglevel: int
|
| 9 |
"""Initialize a custom logger"""
|
| 10 |
default_logging_config = {
|
| 11 |
"version": 1,
|
|
|
|
| 5 |
from typing import Any, Optional
|
| 6 |
|
| 7 |
|
| 8 |
+
def config_logger(loglevel: int) -> Any:
|
| 9 |
"""Initialize a custom logger"""
|
| 10 |
default_logging_config = {
|
| 11 |
"version": 1,
|
src/deep_barcode_reader/main.py
CHANGED
|
@@ -1,21 +1,24 @@
|
|
| 1 |
"""Run the main code for Deep-Barcode-Reader"""
|
| 2 |
-
|
| 3 |
import logging
|
| 4 |
-
|
| 5 |
import click
|
|
|
|
| 6 |
|
| 7 |
from deep_barcode_reader import __version__
|
| 8 |
from deep_barcode_reader.logging import config_logger
|
| 9 |
-
|
| 10 |
|
| 11 |
logger = logging.getLogger(__name__)
|
| 12 |
|
| 13 |
|
| 14 |
@click.command()
|
| 15 |
@click.version_option(version=__version__)
|
| 16 |
-
@click.option("-l", "--log_path", type=str, help="Path to save log file")
|
| 17 |
@click.option("-v", "--verbose", count=True, help="Shorthand for info/debug/warning/error loglevel (-v/-vv/-vvv/-vvvv)")
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
"""It can read different types of barcodes """
|
| 20 |
if verbose == 1:
|
| 21 |
log_level = 10
|
|
@@ -25,6 +28,8 @@ def deep_barcode_reader_cli(log_path: str, verbose: int) -> None:
|
|
| 25 |
log_level = 30
|
| 26 |
else:
|
| 27 |
log_level = 40
|
| 28 |
-
config_logger(log_level
|
| 29 |
|
| 30 |
click.echo("Run the main code.")
|
|
|
|
|
|
|
|
|
| 1 |
"""Run the main code for Deep-Barcode-Reader"""
|
| 2 |
+
from pathlib import Path
|
| 3 |
import logging
|
| 4 |
+
import asyncio
|
| 5 |
import click
|
| 6 |
+
import cv2
|
| 7 |
|
| 8 |
from deep_barcode_reader import __version__
|
| 9 |
from deep_barcode_reader.logging import config_logger
|
| 10 |
+
from deep_barcode_reader.barcode import BarcodeOpencv, BarcodeQRZbar
|
| 11 |
|
| 12 |
logger = logging.getLogger(__name__)
|
| 13 |
|
| 14 |
|
| 15 |
@click.command()
|
| 16 |
@click.version_option(version=__version__)
|
|
|
|
| 17 |
@click.option("-v", "--verbose", count=True, help="Shorthand for info/debug/warning/error loglevel (-v/-vv/-vvv/-vvvv)")
|
| 18 |
+
@click.option("-s", "--result_path", type=click.Path(), default=Path("output"), help="Path to save the result file.")
|
| 19 |
+
@click.option("-d", "--data_path", required=True, type=click.Path(exists=True), help="Path to data file.")
|
| 20 |
+
@click.option("--model_size", type=click.Choice(["n", "s", "m", "l"], case_sensitive=False), help="Path to data file.")
|
| 21 |
+
def deep_barcode_reader_cli(verbose: int, result_path: Path, data_path: Path, model_size: str) -> None:
|
| 22 |
"""It can read different types of barcodes """
|
| 23 |
if verbose == 1:
|
| 24 |
log_level = 10
|
|
|
|
| 28 |
log_level = 30
|
| 29 |
else:
|
| 30 |
log_level = 40
|
| 31 |
+
config_logger(log_level)
|
| 32 |
|
| 33 |
click.echo("Run the main code.")
|
| 34 |
+
barcode = BarcodeQRZbar()
|
| 35 |
+
_ = asyncio.get_event_loop().run_until_complete(barcode.test_run())
|
tests/test_deep_barcode_reader.py
CHANGED
|
@@ -5,4 +5,4 @@ from deep_barcode_reader import __version__
|
|
| 5 |
|
| 6 |
def test_version() -> None:
|
| 7 |
"""Unit test for checking the version of the code"""
|
| 8 |
-
assert __version__ == "0.
|
|
|
|
| 5 |
|
| 6 |
def test_version() -> None:
|
| 7 |
"""Unit test for checking the version of the code"""
|
| 8 |
+
assert __version__ == "0.2.0"
|