|
1 | 1 | import re
|
2 |
| -from pathlib import Path |
3 | 2 | from typing import List, Tuple
|
| 3 | +import os |
4 | 4 |
|
5 | 5 | from pkg_resources import DistributionNotFound, get_distribution
|
6 |
| -from setuptools import find_packages, setup |
| 6 | +from setuptools import setup, find_packages |
7 | 7 |
|
8 | 8 | INSTALL_REQUIRES = [
|
9 |
| - "numpy>=1.24", |
| 9 | + "numpy>=1.24.4", |
10 | 10 | "typing-extensions>=4.9.0; python_version<'3.10'",
|
11 |
| - "stringzilla==3.10.4" |
| 11 | + "stringzilla==3.10.4", |
| 12 | + |
12 | 13 | ]
|
13 | 14 |
|
14 | 15 | MIN_OPENCV_VERSION = "4.9.0.80"
|
|
20 | 21 | ),
|
21 | 22 | ]
|
22 | 23 |
|
23 |
| -def get_version() -> str: |
24 |
| - current_dir = Path(__file__).parent |
25 |
| - version_file = current_dir / "albucore" / "__init__.py" |
26 |
| - with open(version_file, encoding="utf-8") as f: |
27 |
| - version_match = re.search(r'^__version__ = [\'"]([^\'"]*)[\'"]', f.read(), re.M) |
28 |
| - if version_match: |
29 |
| - return version_match.group(1) |
| 24 | +def get_version(): |
| 25 | + version_file = os.path.join(os.path.dirname(__file__), 'albucore', '__init__.py') |
| 26 | + with open(version_file, 'r') as f: |
| 27 | + version_line = f.read().strip() |
| 28 | + version_regex = r"^__version__ = ['\"]([^'\"]*)['\"]" |
| 29 | + match = re.match(version_regex, version_line, re.M) |
| 30 | + if match: |
| 31 | + return match.group(1) |
30 | 32 | raise RuntimeError("Unable to find version string.")
|
31 | 33 |
|
32 |
| -def get_long_description() -> str: |
33 |
| - base_dir = Path(__file__).parent |
34 |
| - with open(base_dir / "README.md", encoding="utf-8") as f: |
35 |
| - return f.read() |
36 |
| - |
37 | 34 | def choose_requirement(mains: Tuple[str, ...], secondary: str) -> str:
|
| 35 | + chosen = secondary |
38 | 36 | for main in mains:
|
39 | 37 | try:
|
40 |
| - # Extract the package name from the requirement string |
41 |
| - package_name = re.split(r"[!<>=]", main)[0] |
42 |
| - # Check if the package is already installed |
43 |
| - get_distribution(package_name) |
44 |
| - return main |
| 38 | + name = re.split(r"[!<>=]", main)[0] |
| 39 | + get_distribution(name) |
| 40 | + chosen = main |
| 41 | + break |
45 | 42 | except DistributionNotFound:
|
46 |
| - continue |
47 |
| - return secondary |
48 |
| - |
| 43 | + pass |
| 44 | + return chosen |
49 | 45 |
|
50 | 46 | def get_install_requirements(install_requires: List[str], choose_install_requires: List[Tuple[Tuple[str, ...], str]]) -> List[str]:
|
51 | 47 | for mains, secondary in choose_install_requires:
|
52 | 48 | install_requires.append(choose_requirement(mains, secondary))
|
53 | 49 | return install_requires
|
54 | 50 |
|
55 | 51 | setup(
|
56 |
| - name="albucore", |
57 | 52 | version=get_version(),
|
58 |
| - description='A high-performance image processing library designed to optimize and extend the Albumentations library with specialized functions for advanced image transformations. Perfect for developers working in computer vision who require efficient and scalable image augmentation.', |
59 |
| - long_description=get_long_description(), |
60 |
| - long_description_content_type="text/markdown", |
61 |
| - author="Vladimir I. Iglovikov", |
62 |
| - license="MIT", |
63 |
| - url="https://github.com/albumentations-team/albucore", |
64 |
| - packages=find_packages(exclude=["tests", "benchmark", ".github"]), |
65 |
| - python_requires=">=3.8", |
| 53 | + packages=find_packages(exclude=["tests", "benchmark"], include=['albucore*']), |
66 | 54 | install_requires=get_install_requirements(INSTALL_REQUIRES, CHOOSE_INSTALL_REQUIRES),
|
67 |
| - classifiers=[ |
68 |
| - "Development Status :: 4 - Beta", |
69 |
| - "Intended Audience :: Developers", |
70 |
| - "Intended Audience :: Science/Research", |
71 |
| - "License :: OSI Approved :: MIT License", |
72 |
| - "Operating System :: OS Independent", |
73 |
| - "Programming Language :: Python", |
74 |
| - "Programming Language :: Python :: 3", |
75 |
| - "Programming Language :: Python :: 3.9", |
76 |
| - "Programming Language :: Python :: 3.10", |
77 |
| - "Programming Language :: Python :: 3.11", |
78 |
| - "Programming Language :: Python :: 3.12", |
79 |
| - "Programming Language :: Python :: 3.13", |
80 |
| - "Topic :: Software Development :: Libraries", |
81 |
| - "Topic :: Software Development :: Libraries :: Python Modules", |
82 |
| - "Topic :: Scientific/Engineering :: Artificial Intelligence", |
83 |
| - "Topic :: Scientific/Engineering :: Image Processing", |
84 |
| - "Typing :: Typed" |
85 |
| - ], |
86 |
| - keywords=[ |
87 |
| - "Image Processing", "Computer Vision", "Image Augmentation", "Albumentations", "Optimization", "Machine Learning", |
88 |
| - "Deep Learning", "Python Imaging", "Data Augmentation", "Performance", "Efficiency", "High-Performance", |
89 |
| - "CV", "OpenCV", "Automation" |
90 |
| - ], |
91 |
| - zip_safe=False |
92 | 55 | )
|
0 commit comments