Skip to content

FANPR-2 - Addressing installation issue with Windows #8

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

Merged
merged 2 commits into from
Mar 19, 2024
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
5 changes: 1 addition & 4 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest, raspberrypi]
os: [ubuntu-latest]
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
exclude:
- os: windows-latest
python-version: "3.11"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/merge_macos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: main-macos

on:
pull_request:
branches:
- main
types:
- closed

jobs:
if_merged:
name: Run unit tests on different python versions and check build
if: github.event.pull_request.merged == true
strategy:
fail-fast: false
matrix:
os: [macos-latest]
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[dev]
- name: Lint with flake8
uses: py-actions/flake8@v2
with:
max-line-length: "120"
- name: Test with pytest
run: pytest --exitfirst --verbose --failed-first
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Checking build
run: twine check dist/*
39 changes: 39 additions & 0 deletions .github/workflows/merge_raspbian.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: main-raspbian

on:
pull_request:
branches:
- main
types:
- closed

jobs:
if_merged:
name: Run unit tests on different python versions and check build
if: github.event.pull_request.merged == true
strategy:
fail-fast: false
matrix:
os: [raspberrypi]
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[dev]
- name: Lint with flake8
uses: py-actions/flake8@v2
with:
max-line-length: "120"
- name: Test with pytest
run: pytest --exitfirst --verbose --failed-first
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Checking build
run: twine check dist/*
39 changes: 39 additions & 0 deletions .github/workflows/merge_windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: main-windows

on:
pull_request:
branches:
- main
types:
- closed

jobs:
if_merged:
name: Run unit tests on different python versions and check build
if: github.event.pull_request.merged == true
strategy:
fail-fast: false
matrix:
os: [windows-latest]
python-version: [ "3.8", "3.9", "3.10" ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[dev]
- name: Lint with flake8
uses: py-actions/flake8@v2
with:
max-line-length: "120"
- name: Test with pytest
run: pytest --exitfirst --verbose --failed-first
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Checking build
run: twine check dist/*
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<img src="misc/logo.jpg" alt="FastANPR logo" style="width:100%;">

[![Build Status](https://github.com/arvindrajan92/fastanpr/actions/workflows/merge.yaml/badge.svg)](https://github.com/arvindrajan92/fastanpr/actions)
[![Build Status](https://github.com/arvindrajan92/fastanpr/actions/workflows/merge_macos.yaml/badge.svg)](https://github.com/arvindrajan92/fastanpr/actions)
[![Build Status](https://github.com/arvindrajan92/fastanpr/actions/workflows/merge_raspbian.yaml/badge.svg)](https://github.com/arvindrajan92/fastanpr/actions)
[![Build Status](https://github.com/arvindrajan92/fastanpr/actions/workflows/merge_windows.yaml/badge.svg)](https://github.com/arvindrajan92/fastanpr/actions)
[![Build Status](https://github.com/arvindrajan92/fastanpr/actions/workflows/push.yaml/badge.svg)](https://github.com/arvindrajan92/fastanpr/actions)
[![Build Status](https://github.com/arvindrajan92/fastanpr/actions/workflows/publish.yaml/badge.svg)](https://github.com/arvindrajan92/fastanpr/actions)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/arvindrajan92/fastanpr)](https://github.com/arvindrajan92/fastanpr/releases)
Expand All @@ -13,9 +16,15 @@ A fast *automatic number-plate recognition* (ANPR) library. This package employs
![Example outputs](misc/sample.png)

## Installation
You can install the package using pip:
```bash
pip install fastanpr
```
### Requirements
- Windows:
- Python >=3.9, <3.11
- Ubuntu, macOS, Raspbian:
- Python >=3.9, <3.12

## Usage
```python
Expand Down
14 changes: 11 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os
import sys
import subprocess
from setuptools import setup, find_packages

# Getting build version
try:
VERSION = (
subprocess.run(["git", "describe", "--tags"], stdout=subprocess.PIPE)
Expand All @@ -25,7 +27,13 @@
with open("fastanpr/version.py", "r", encoding="utf-8") as fh:
VERSION = fh.read().strip().lstrip("__version__ = \"").rstrip("\"")

DESCRIPTION = 'A fast automatic number-plate recognition (ANPR) library'
# Set Python version requirements based on the operating system
if sys.platform.startswith('win'):
PYTHON_REQUIRES = '>=3.8, <3.11'
else:
PYTHON_REQUIRES = '>=3.8, <3.12'

# Getting long description from README
with open("README.md", "r") as fh:
LONG_DESCRIPTION = fh.read()

Expand All @@ -34,14 +42,14 @@
version=VERSION,
author="arvindrajan92 (Arvind Rajan)",
author_email="<[email protected]>",
description=DESCRIPTION,
description='A fast automatic number-plate recognition (ANPR) library',
long_description_content_type="text/markdown",
long_description=LONG_DESCRIPTION,
packages=find_packages(),
package_data={'': ['*.pt'], 'fastanpr': ['*.pt']},
include_package_data=True,
install_requires=['ultralytics>=8.1.26', 'paddlepaddle>=2.6.0', 'paddleocr>=2.7.0.3'],
python_requires='>=3.8',
python_requires=PYTHON_REQUIRES,
extras_require={
'dev': ['pytest', 'pytest-asyncio', 'twine', 'python-Levenshtein', 'setuptools', 'wheel', 'twine', 'flake8']
},
Expand Down
1 change: 0 additions & 1 deletion tests/test_fastanpr.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import cv2
import time
import pytest
import Levenshtein
import numpy as np
Expand Down
Loading