From 89db71aabf2efd5e4c90d424d6e967d23526bd7b Mon Sep 17 00:00:00 2001 From: Ruslan Baikulov Date: Thu, 25 Jan 2024 01:34:17 +0300 Subject: [PATCH] chore: Use pyproject.toml chore: Set min version of Python 3.8 and PyTorch 2.0.0 chore: Remove setup.py and setup.cfg --- Dockerfile | 21 ++++------- MANIFEST.in | 2 -- docs/requirements.txt | 2 -- examples/requirements.txt | 3 -- pyproject.toml | 76 +++++++++++++++++++++++++++++++++++++++ requirements.txt | 1 - setup.cfg | 9 ----- setup.py | 55 ---------------------------- tests/requirements.txt | 4 --- 9 files changed, 83 insertions(+), 90 deletions(-) delete mode 100644 MANIFEST.in delete mode 100644 docs/requirements.txt delete mode 100644 examples/requirements.txt create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100644 setup.cfg delete mode 100644 setup.py delete mode 100644 tests/requirements.txt diff --git a/Dockerfile b/Dockerfile index 26909ba..5383377 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,11 @@ FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04 ENV LANG C.UTF-8 ENV DEBIAN_FRONTEND noninteractive +ENV DEB_PYTHON_INSTALL_LAYOUT=deb_system ENV NVIDIA_DRIVER_CAPABILITIES video,compute,utility +ENV PYTHONPATH $PYTHONPATH:/workdir + +WORKDIR /workdir RUN apt-get update && \ apt-get -y install \ @@ -21,17 +25,6 @@ RUN pip3 install --no-cache-dir \ torchvision==0.16.2 \ torchaudio==2.1.2 -# Docs requirements -COPY ./docs/requirements.txt /docs_requirements.txt -RUN pip3 install --no-cache-dir -r /docs_requirements.txt - -# Tests requirements -COPY ./tests/requirements.txt /tests_requirements.txt -RUN pip3 install --no-cache-dir -r /tests_requirements.txt - -# Examples requirements -COPY ./examples/requirements.txt /examples_requirements.txt -RUN pip3 install --no-cache-dir -r /examples_requirements.txt - -ENV PYTHONPATH $PYTHONPATH:/workdir -WORKDIR /workdir +# Install requirements +COPY ./ ./ +RUN pip3 install -e .[tests,docs,examples] diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index a7da3fc..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -include requirements.txt -include LICENSE diff --git a/docs/requirements.txt b/docs/requirements.txt deleted file mode 100644 index 577d772..0000000 --- a/docs/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -sphinx==7.2.6 -pydata-sphinx-theme==0.15.2 diff --git a/examples/requirements.txt b/examples/requirements.txt deleted file mode 100644 index fea06f1..0000000 --- a/examples/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -torchvision==0.16.2 -notebook==7.0.7 -timm==0.9.12 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..8274c1d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,76 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "pytorch-argus" +description = "Argus is a lightweight library for training neural networks in PyTorch." +authors = [ + { name = "Ruslan Baikulov", email = "ruslan1123@gmail.com" }, +] +readme = "README.md" +license = { file = "LICENSE" } +requires-python = ">=3.8" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "License :: OSI Approved :: MIT License", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + "Topic :: Software Development", + "Topic :: Software Development :: Libraries", + "Topic :: Software Development :: Libraries :: Python Modules", +] +dependencies = ["torch>=2.0.0"] +dynamic = ["version"] + +[project.optional-dependencies] +tests = [ + "pytest==7.4.4", + "pytest-cov==4.1.0", + "mypy==1.8.0", + "ruff==0.1.14", +] +docs = [ + "sphinx==7.2.6", + "pydata-sphinx-theme==0.15.2", +] +examples = [ + "torchvision==0.16.2", + "notebook==7.0.7", + "timm==0.9.12", +] + +[project.urls] +Repository = "https://github.com/lRomul/argus" +Documentation = "https://pytorch-argus.readthedocs.io/" + +[tool.setuptools.dynamic] +version = { attr = "argus.__version__" } + +[tool.setuptools.packages.find] +where = ["."] +include = ["argus"] + +[tool.ruff] +line-length = 89 +select = [ + "E", # pycodestyle errors + "W", # pycodestyle warnings + "F", # pyflakes +] + +[tool.ruff.per-file-ignores] +"__init__.py" = ["F401"] + +[tool.pytest] +minversion = 6.0 +addopts = "--cov=argus" +testpaths = "tests" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 5e73e53..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -torch>=1.1.0 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 612f893..0000000 --- a/setup.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[flake8] -max-line-length = 89 -exclude = .git,__pycache__,docs/source/conf.py,build,dist -per-file-ignores = __init__.py:F401 - -[tool:pytest] -minversion = 6.0 -addopts = --cov=argus -testpaths = tests diff --git a/setup.py b/setup.py deleted file mode 100644 index 31924c0..0000000 --- a/setup.py +++ /dev/null @@ -1,55 +0,0 @@ -import os -import io -import re -from setuptools import setup, find_packages - - -def read(*names, **kwargs): - with io.open(os.path.join(os.path.dirname(__file__), *names), - encoding=kwargs.get("encoding", "utf8")) as fp: - return fp.read() - - -def find_version(*file_paths): - version_file = read(*file_paths) - version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", - version_file, re.M) - if version_match: - return version_match.group(1) - raise RuntimeError("Unable to find version string.") - - -setup( - name='pytorch-argus', - version=find_version('argus', '__init__.py'), - author='Ruslan Baikulov', - author_email='ruslan1123@gmail.com', - url='https://github.com/lRomul/argus', - description='Argus is a lightweight library for ' - 'training neural networks in PyTorch.', - long_description=read('README.md'), - long_description_content_type='text/markdown', - license='MIT', - packages=find_packages(exclude=("tests", "tests.*",)), - zip_safe=True, - python_requires='>=3.6', - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'License :: OSI Approved :: MIT License', - 'Intended Audience :: Developers', - 'Intended Audience :: Science/Research', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Topic :: Scientific/Engineering', - 'Topic :: Scientific/Engineering :: Artificial Intelligence', - 'Topic :: Software Development', - 'Topic :: Software Development :: Libraries', - 'Topic :: Software Development :: Libraries :: Python Modules', - ], - install_requires=read('requirements.txt').split(), -) diff --git a/tests/requirements.txt b/tests/requirements.txt deleted file mode 100644 index 6d7dbf8..0000000 --- a/tests/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -pytest==7.4.4 -pytest-cov==4.1.0 -mypy==1.8.0 -flake8==7.0.0