Skip to content

Commit

Permalink
Udpated building scripts (#1983)
Browse files Browse the repository at this point in the history
* Empty-Commit

* Version boosted to 1.4.18

* Updated version builder

* Correctly handles version

* Cleaned package build
  • Loading branch information
ternaus authored Oct 8, 2024
1 parent 3680ee8 commit 47f9592
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 62 deletions.
1 change: 0 additions & 1 deletion .github/workflows/upload_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ jobs:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
rm -rf tests tools benchmark
python -m build
twine upload dist/*
10 changes: 10 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@ prune docs/_build
global-exclude docs/augs_overview/*/images/*.jpg

global-exclude *.py[co] .DS_Store

# Exclude test, tools, and benchmark directories
prune tests
prune tools
prune benchmark
prune conda.recipe
prune codecov.yaml
prune pre-commit-config.yaml
prune .github
prune requirements-dev.txt
2 changes: 1 addition & 1 deletion albumentations/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.4.17"
__version__ = "1.4.18"
82 changes: 76 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,81 @@
# NOTE: you have to use single-quoted strings in TOML for regular expressions.
# It's the equivalent of r-strings in Python. Multiline strings are treated as
# verbose regular expressions by Black. Use [ ] to denote a significant space
# character.

[build-system]
build-backend = "setuptools.build_meta"
requires = [ "setuptools", "wheel" ]

requires = [ "setuptools>=45", "wheel" ]

[project]
name = "albumentations"
description = "Fast, flexible, and advanced image augmentation library for deep learning and computer vision. Albumentations offers a wide range of transformations for images, masks, bounding boxes, and keypoints, with optimized performance and seamless integration into ML workflows."
readme = "README.md"
keywords = [
"artificial intelligence",
"bounding box",
"computer vision",
"computer vision library",
"data augmentation",
"data preprocessing",
"deep learning",
"fast augmentation",
"image augmentation",
"image classification",
"image processing",
"image transformation",
"instance segmentation",
"keras",
"keypoint detection",
"machine learning",
"object detection",
"pytorch",
"semantic segmentation",
"tensorflow",
]
license = { file = "LICENSE" }
authors = [
{ name = "Vladimir I. Iglovikov" },
{ name = "Mikhail Druzhinin" },
{ name = "Alex Parinov" },
{ name = "Alexander Buslaev" },
{ name = "Eugene Khvedchenya" },
]
requires-python = ">=3.8"

classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Image Processing",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
]
dynamic = [ "dependencies", "version" ]
optional-dependencies.hub = [ "huggingface-hub" ]
optional-dependencies.text = [ "pillow" ]
urls.Homepage = "https://albumentations.ai"

[tool.setuptools]
packages = { find = { include = [
"albumentations*",
], exclude = [
"tests",
"tools",
"benchmark",
] } }

package-data = { albumentations = [ "*.txt", "*.md" ] }

[tool.setuptools.exclude-package-data]
"*" = [ "tests*", "tools*", "benchmark*", "conda.recipe*" ]

[tool.ruff]
# Exclude a variety of commonly ignored directories.
Expand Down
65 changes: 11 additions & 54 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import re
from pathlib import Path
from typing import List, Tuple
import os

from pkg_resources import DistributionNotFound, get_distribution
from setuptools import find_packages, setup
from setuptools import setup, find_packages

INSTALL_REQUIRES = [
"numpy>=1.24.4", "scipy>=1.10.0", "scikit-image>=0.21.0",
Expand All @@ -23,22 +23,16 @@
),
]

def get_version() -> str:
current_dir = Path(__file__).parent
version_file = current_dir / "albumentations" / "_version.py"
if not version_file.is_file():
raise FileNotFoundError(f"Version file not found: {version_file}")
with open(version_file, encoding="utf-8") as f:
version_match = re.search(r'^__version__ = [\'"]([^\'"]*)[\'"]', f.read(), re.M)
if version_match:
return version_match.group(1)
def get_version():
version_file = os.path.join(os.path.dirname(__file__), 'albumentations', '_version.py')
with open(version_file, 'r') as f:
version_line = f.read().strip()
version_regex = r"^__version__ = ['\"]([^'\"]*)['\"]"
match = re.match(version_regex, version_line, re.M)
if match:
return match.group(1)
raise RuntimeError("Unable to find version string.")

def get_long_description() -> str:
base_dir = Path(__file__).parent
with open(base_dir / "README.md", encoding="utf-8") as f:
return f.read()

def choose_requirement(mains: Tuple[str, ...], secondary: str) -> str:
chosen = secondary
for main in mains:
Expand All @@ -57,44 +51,7 @@ def get_install_requirements(install_requires: List[str], choose_install_require
return install_requires

setup(
name="albumentations",
version=get_version(),
description="An efficient library for image augmentation, providing extensive transformations to support machine learning and computer vision tasks.",
long_description=get_long_description(),
long_description_content_type="text/markdown",
author="Vladimir I. Iglovikov, Mikhail Druzhinin, Alex Parinov, Alexander Buslaev, Eugene Khvedchenya",
license="MIT",
url="https://albumentations.ai",
packages=find_packages(exclude=["tests", "tools", "benchmark"]),
python_requires=">=3.8",
packages=find_packages(exclude=["tests", "tools", "benchmark"], include=['albumentations*']),
install_requires=get_install_requirements(INSTALL_REQUIRES, CHOOSE_INSTALL_REQUIRES),
extras_require={
"hub": ["huggingface_hub"],
"text": ["pillow"]
},
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Image Processing",
"Typing :: Typed"
],
keywords=[
"image augmentation", "data augmentation", "computer vision",
"deep learning", "machine learning", "image processing",
"artificial intelligence", "augmentation library",
"image transformation", "vision augmentation"
],
)

0 comments on commit 47f9592

Please sign in to comment.