Skip to content

Commit 78da3ab

Browse files
authored
Updated build code (#38)
1 parent 1624105 commit 78da3ab

File tree

4 files changed

+88
-77
lines changed

4 files changed

+88
-77
lines changed

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ repos:
5353
# hooks:
5454
# - id: markdownlint
5555
- repo: https://github.com/tox-dev/pyproject-fmt
56-
rev: "2.3.1"
56+
rev: "2.4.3"
5757
hooks:
5858
- id: pyproject-fmt
5959
additional_dependencies: ["tomli"]
6060
- repo: https://github.com/astral-sh/ruff-pre-commit
6161
# Ruff version.
62-
rev: v0.6.9
62+
rev: v0.7.0
6363
hooks:
6464
# Run the linter.
6565
- id: ruff

albucore/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.0.17"
1+
__version__ = "0.0.18"
22

33
from .decorators import *
44
from .functions import *

pyproject.toml

+64-16
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,50 @@
1-
# NOTE: you have to use single-quoted strings in TOML for regular expressions.
2-
# It's the equivalent of r-strings in Python. Multiline strings are treated as
3-
# verbose regular expressions by Black. Use [ ] to denote a significant space
4-
# character.
5-
61
[build-system]
72
build-backend = "setuptools.build_meta"
8-
requires = [ "setuptools", "wheel" ]
3+
4+
requires = [ "setuptools>=45", "wheel" ]
5+
6+
[project]
7+
name = "albucore"
8+
description = "High-performance image processing functions for deep learning and computer vision."
9+
readme = "README.md"
10+
keywords = [ "deep learning", "image processing" ]
11+
license = { file = "LICENSE" }
12+
authors = [ { name = "Vladimir I. Iglovikov" } ]
13+
requires-python = ">=3.9"
14+
15+
classifiers = [
16+
"Development Status :: 5 - Production/Stable",
17+
"Intended Audience :: Developers",
18+
"Intended Audience :: Science/Research",
19+
"License :: OSI Approved :: MIT License",
20+
"Operating System :: OS Independent",
21+
"Programming Language :: Python",
22+
"Programming Language :: Python :: 3 :: Only",
23+
"Programming Language :: Python :: 3.9",
24+
"Programming Language :: Python :: 3.10",
25+
"Programming Language :: Python :: 3.11",
26+
"Programming Language :: Python :: 3.12",
27+
"Programming Language :: Python :: 3.13",
28+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
29+
"Topic :: Scientific/Engineering :: Image Processing",
30+
"Topic :: Software Development :: Libraries",
31+
"Topic :: Software Development :: Libraries :: Python Modules",
32+
"Typing :: Typed",
33+
]
34+
dynamic = [ "dependencies", "version" ]
35+
36+
[tool.setuptools]
37+
packages = { find = { include = [
38+
"albucore*",
39+
], exclude = [
40+
"tests",
41+
"benchmark",
42+
] } }
43+
44+
package-data = { albumentations = [ "*.txt", "*.md" ] }
45+
46+
[tool.setuptools.exclude-package-data]
47+
"*" = [ "tests*", "tools*", "benchmark*", "conda.recipe*" ]
948

1049
[tool.ruff]
1150
# Exclude a variety of commonly ignored directories.
@@ -36,6 +75,7 @@ exclude = [
3675
".vscode",
3776
"__pypackages__",
3877
"_build",
78+
"benchmark",
3979
"buck-out",
4080
"build",
4181
"dist",
@@ -56,31 +96,38 @@ format.line-ending = "auto"
5696
format.skip-magic-trailing-comma = false
5797
# Like Black, automatically detect the appropriate line ending.
5898
lint.select = [ "ALL" ]
59-
# Like Black, use double quotes for strings.
6099
lint.ignore = [
61100
"ANN101",
101+
"ANN102",
102+
"ANN204",
62103
"ANN401",
63-
"B023",
64-
"BLE001",
65-
"C901",
66-
"COM812",
104+
"ARG001",
105+
"ARG002",
106+
"B008",
107+
"B027",
67108
"D100",
68109
"D101",
69110
"D102",
70111
"D103",
71112
"D104",
72113
"D105",
114+
"D106",
73115
"D107",
74-
"E402",
116+
"D205",
117+
"D415",
75118
"EM101",
76119
"EM102",
77120
"F403",
78121
"FBT001",
79122
"FBT002",
80-
"PD901",
81-
"PERF203",
123+
"FBT003",
124+
"G004",
82125
"PLR0913",
83-
"T201",
126+
"PTH123",
127+
"S311",
128+
"TCH001",
129+
"TCH002",
130+
"TCH003",
84131
"TRY003",
85132
]
86133

@@ -91,10 +138,11 @@ lint.fixable = [ "ALL" ]
91138
lint.unfixable = [ ]
92139
# Allow unused variables when underscore-prefixed.
93140
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
141+
# Like Black, use double quotes for strings.
94142
lint.pydocstyle.convention = "google"
95143

96144
[tool.mypy]
97-
python_version = "3.8"
145+
python_version = "3.9"
98146
ignore_missing_imports = true
99147
follow_imports = "silent"
100148
warn_redundant_casts = true

setup.py

+21-58
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import re
2-
from pathlib import Path
32
from typing import List, Tuple
3+
import os
44

55
from pkg_resources import DistributionNotFound, get_distribution
6-
from setuptools import find_packages, setup
6+
from setuptools import setup, find_packages
77

88
INSTALL_REQUIRES = [
9-
"numpy>=1.24",
9+
"numpy>=1.24.4",
1010
"typing-extensions>=4.9.0; python_version<'3.10'",
11-
"stringzilla==3.10.4"
11+
"stringzilla==3.10.4",
12+
1213
]
1314

1415
MIN_OPENCV_VERSION = "4.9.0.80"
@@ -20,73 +21,35 @@
2021
),
2122
]
2223

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)
3032
raise RuntimeError("Unable to find version string.")
3133

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-
3734
def choose_requirement(mains: Tuple[str, ...], secondary: str) -> str:
35+
chosen = secondary
3836
for main in mains:
3937
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
4542
except DistributionNotFound:
46-
continue
47-
return secondary
48-
43+
pass
44+
return chosen
4945

5046
def get_install_requirements(install_requires: List[str], choose_install_requires: List[Tuple[Tuple[str, ...], str]]) -> List[str]:
5147
for mains, secondary in choose_install_requires:
5248
install_requires.append(choose_requirement(mains, secondary))
5349
return install_requires
5450

5551
setup(
56-
name="albucore",
5752
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*']),
6654
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
9255
)

0 commit comments

Comments
 (0)