From 6db23af50c8fd87f8442be9da085d274709c2e3f Mon Sep 17 00:00:00 2001 From: Sylvain Gugger <35901082+sgugger@users.noreply.github.com> Date: Fri, 7 Apr 2023 15:08:44 -0400 Subject: [PATCH] Revert migration of setup to pyproject.toml (#22658) --- Makefile | 8 +++---- pyproject.toml | 65 -------------------------------------------------- setup.py | 31 +++++++++++++++++++++++- 3 files changed, 34 insertions(+), 70 deletions(-) diff --git a/Makefile b/Makefile index 9e1d197cb64..5e5a11a1fee 100644 --- a/Makefile +++ b/Makefile @@ -47,10 +47,10 @@ repo-consistency: # this target runs checks on all files quality: - black --check $(check_dirs) + black --check $(check_dirs) setup.py python utils/custom_init_isort.py --check_only python utils/sort_auto_mappings.py --check_only - ruff $(check_dirs) + ruff $(check_dirs) setup.py doc-builder style src/transformers docs/source --max_len 119 --check_only --path_to_docs docs/source python utils/check_doc_toc.py @@ -65,8 +65,8 @@ extra_style_checks: # this target runs checks on all files and potentially modifies some of them style: - black $(check_dirs) - ruff $(check_dirs) --fix + black $(check_dirs) setup.py + ruff $(check_dirs) setup.py --fix ${MAKE} autogenerate_code ${MAKE} extra_style_checks diff --git a/pyproject.toml b/pyproject.toml index 7905afac5d6..06a9a8ed129 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,68 +1,3 @@ -# Package ###################################################################### - -[build-system] -requires = ["setuptools"] -build-backend = "setuptools.build_meta" - -[project] -name = "transformers" -description = "State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow" -readme = "README.md" -requires-python = ">= 3.7" -authors = [ - { name = "The Hugging Face team (past and future) with the help of all our contributors (https://github.com/huggingface/transformers/graphs/contributors)", email = "transformers@huggingface.co" }, -] -license = { text = "Apache 2.0 License" } -keywords = [ - "NLP", - "vision", - "speech", - "deep learning", - "transformer", - "pytorch", - "tensorflow", - "jax", - "BERT", - "GPT-2", - "Wav2Vec2", - "ViT", -] -classifiers = [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Intended Audience :: Education", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: Apache Software License", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Topic :: Scientific/Engineering :: Artificial Intelligence", -] -dynamic = ["dependencies", "optional-dependencies", "version"] - -[project.scripts] -transformers-cli = "transformers.commands.transformers_cli:main" - -[project.urls] -Homepage = "https://huggingface.co" -Repository = "https://github.com/huggingface/transformers" -Documentation = "https://huggingface.co/docs/transformers" -"Bug Report" = "https://github.com/huggingface/transformers/issues" - -[tool.setuptools] -include-package-data = true - -[tool.setuptools.packages.find] -where = ["src"] - -[tool.setuptools.package-data] -transformers = ["*.cu", "*.cpp", "*.cuh", "*.h", "*.pyx"] - -# Linter tools ################################################################# - [tool.black] line-length = 119 target-version = ['py37'] diff --git a/setup.py b/setup.py index 1cacc5df2fe..d1cba0dfebf 100644 --- a/setup.py +++ b/setup.py @@ -78,7 +78,7 @@ import re import shutil from pathlib import Path -from setuptools import Command, setup +from setuptools import Command, find_packages, setup # Remove stale transformers.egg-info directory to avoid https://github.com/pypa/pip/issues/5466 @@ -426,7 +426,36 @@ install_requires = [ setup( name="transformers", version="4.28.0.dev0", # expected format is one of x.y.z.dev0, or x.y.z.rc1 or x.y.z (no to dashes, yes to dots) + author="The Hugging Face team (past and future) with the help of all our contributors (https://github.com/huggingface/transformers/graphs/contributors)", + author_email="transformers@huggingface.co", + description="State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow", + long_description=open("README.md", "r", encoding="utf-8").read(), + long_description_content_type="text/markdown", + keywords="NLP vision speech deep learning transformer pytorch tensorflow jax BERT GPT-2 Wav2Vec2 ViT", + license="Apache 2.0 License", + url="https://github.com/huggingface/transformers", + package_dir={"": "src"}, + packages=find_packages("src"), + include_package_data=True, + package_data={"transformers": ["*.cu", "*.cpp", "*.cuh", "*.h", "*.pyx"]}, + zip_safe=False, extras_require=extras, + entry_points={"console_scripts": ["transformers-cli=transformers.commands.transformers_cli:main"]}, + python_requires=">=3.7.0", install_requires=install_requires, + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: Education", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + ], cmdclass={"deps_table_update": DepsTableUpdateCommand}, )