From 01616aa314272768cdab317fb2d2fee5eb4beaab Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Thu, 15 Feb 2024 17:39:22 -0800 Subject: [PATCH 1/2] Remove setup.py, replace with pyproject.toml and pdm helpers --- pyproject.toml | 69 +++++++++++++++++++++++++++++++++++++++++--------- setup.cfg | 4 +++ setup.py | 50 ------------------------------------ 3 files changed, 61 insertions(+), 62 deletions(-) delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml index c77e2fea..97f075e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,14 +1,59 @@ -[tool.pytest.ini_options] -markers = [ - "base: marker for model tests using the basic setup", - "cfg: marker for model tests checking the config", - "torchscript: marker for model tests using torchscript", - "features: marker for model tests checking feature extraction", - "fxforward: marker for model tests using torch fx (only forward)", - "fxbackward: marker for model tests using torch fx (only backward)", +[build-system] +requires = ["pdm-backend"] +build-backend = "pdm.backend" + +[project] +name = "timm" +authors = [ + {name = "Ross Wightman", email = "ross@huggingface.co"}, +] +description = "PyTorch Image Models" +readme = "README.md" +requires-python = ">=3.8" +keywords = ["pytorch", "image-classification"] +license = {text = "Apache-2.0"} +classifiers = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Education', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved :: Apache Software License', + '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', + 'Topic :: Scientific/Engineering :: Artificial Intelligence', + 'Topic :: Software Development', + 'Topic :: Software Development :: Libraries', + 'Topic :: Software Development :: Libraries :: Python Modules', +] +dependencies = [ + 'torch', + 'torchvision', + 'pyyaml', + 'huggingface_hub', + 'safetensors', +] +dynamic = ["version"] + +[project.urls] +homepage = "https://github.com/huggingface/pytorch-image-models" +documentation = "https://huggingface.co/docs/timm/en/index" +repository = "https://github.com/huggingface/pytorch-image-models" + +[tool.pdm.dev-dependencies] +test = [ + 'pytest', + 'pytest-timeout', + 'pytest-xdist', + 'pytest-forked', + 'expecttest', ] -[tool.black] -line-length = 120 -target-version = ['py37', 'py38', 'py39', 'py310', 'py311'] -skip-string-normalization = true +[tool.pdm.version] +source = "file" +path = "timm/version.py" + +[tool.pytest.ini_options] +testpaths = ['tests'] \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 6289c6c3..55b106b0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,3 +3,7 @@ conda_name_differences = 'torch:pytorch' channels = pytorch noarch = True + +[metadata] + +url = "https://github.com/huggingface/pytorch-image-models" \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index f5148455..00000000 --- a/setup.py +++ /dev/null @@ -1,50 +0,0 @@ -""" Setup -""" -from setuptools import setup, find_packages -from codecs import open -from os import path - -here = path.abspath(path.dirname(__file__)) - -# Get the long description from the README file -with open(path.join(here, 'README.md'), encoding='utf-8') as f: - long_description = f.read() - -exec(open('timm/version.py').read()) -setup( - name='timm', - version=__version__, - description='PyTorch Image Models', - long_description=long_description, - long_description_content_type='text/markdown', - url='https://github.com/huggingface/pytorch-image-models', - author='Ross Wightman', - author_email='ross@huggingface.co', - classifiers=[ - # How mature is this project? Common values are - # 3 - Alpha - # 4 - Beta - # 5 - Production/Stable - 'Development Status :: 4 - Beta', - 'Intended Audience :: Education', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: Apache Software License', - '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', - ], - - # Note that this is a string of words separated by whitespace, not a list. - keywords='pytorch pretrained models efficientnet mobilenetv3 mnasnet resnet vision transformer vit', - packages=find_packages(exclude=['convert', 'tests', 'results']), - include_package_data=True, - install_requires=['torch >= 1.7', 'torchvision', 'pyyaml', 'huggingface_hub', 'safetensors'], - python_requires='>=3.7', -) - From 35d6eef0dfd0bb49080665bb7355b78fc0ff147f Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Fri, 16 Feb 2024 09:04:00 -0800 Subject: [PATCH 2/2] Version bump, add test markers back to toml --- pyproject.toml | 10 +++++++++- timm/version.py | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 97f075e2..84233615 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,4 +56,12 @@ source = "file" path = "timm/version.py" [tool.pytest.ini_options] -testpaths = ['tests'] \ No newline at end of file +testpaths = ['tests'] +markers = [ + "base: marker for model tests using the basic setup", + "cfg: marker for model tests checking the config", + "torchscript: marker for model tests using torchscript", + "features: marker for model tests checking feature extraction", + "fxforward: marker for model tests using torch fx (only forward)", + "fxbackward: marker for model tests using torch fx (only backward)", +] \ No newline at end of file diff --git a/timm/version.py b/timm/version.py index 350de40f..8a2d2f68 100644 --- a/timm/version.py +++ b/timm/version.py @@ -1 +1 @@ -__version__ = '0.9.15dev0' +__version__ = '0.9.16dev0'