diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 17c9251..8a753e8 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -55,7 +55,7 @@ jobs: - name: Install dependencies run: | - pip install --requirement requirements.txt --upgrade --quiet --find-links https://download.pytorch.org/whl/cpu/torch_stable.html + pip install -e '.[dev]' pip install --requirement tests/requirements.txt --quiet python --version pip --version diff --git a/README.md b/README.md index 5b8d2e9..5b63999 100644 --- a/README.md +++ b/README.md @@ -176,12 +176,12 @@ python3 -m venv toxic-env source toxic-env/bin/activate # install project - pip install -e detoxify -cd detoxify -# for training -pip install -r requirements.txt +# or for training +pip install -e 'detoxify[dev]' + +cd detoxify ``` diff --git a/pyproject.toml b/pyproject.toml index a3163f7..816e6e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,38 @@ -[build-system] -requires = [ - "setuptools", - "wheel", +[project] +name = "detoxify" +version = "0.5.2" +description = "A python library for detecting toxic comments" +readme = "README.md" +authors = [ + {name = "Unitary", email = "laura@unitary.ai"}, +] +classifiers = [ + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", +] +requires-python = ">=3.9,<3.12" +dependencies = [ + "sentencepiece >= 0.1.94", + "torch < 2.2", + "transformers >= 3", +] + +[tool.setuptools] +packages = ["detoxify"] + +[project.urls] +Homepage = "https://github.com/unitaryai/detoxify" + +[project.optional-dependencies] +dev = [ + "datasets >= 1.0.2", + "pandas >= 1.1.2", + "pytest", + "pytorch-lightning<2.0.0,>1.5.0", + "scikit-learn >= 0.23.2", + "tqdm", + "pre-commit", ] [tool.black] @@ -16,3 +47,25 @@ known_first_party = [ skip_glob = [] profile = "black" line_length = 120 + +[tool.pytest.ini_options] +norecursedirs = [ + ".git", + "dist", + "build", +] +addopts = [ + "--strict-markers", + "--doctest-modules", + "--durations=0", + "--color=yes", +] +filterwarnings = [ + "ignore:.*deprecated alias.*:DeprecationWarning:tensorboard.*tensorflow_stub*:", + "ignore:.*deprecated alias.*:DeprecationWarning:tensorboard.*tensor_util*:", + "ignore:.*deprecated alias.*:DeprecationWarning:pyarrow.*pandas_compat*:", +] + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index ca40571..0000000 --- a/requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -pytorch-lightning > 1.5.0, < 2.0.0 -torch >= 1.10.0 -transformers == 4.39.0 -kaggle >= 1.5.8 -pandas >= 1.1.2 -scikit-learn >= 0.23.2 -datasets >= 1.0.2 -tqdm >= 4.41.0 -sentencepiece >= 0.1.94 diff --git a/setup.cfg b/setup.cfg index c4ab78a..f52c280 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,24 +1,3 @@ -[tool:pytest] -norecursedirs = - .git - dist - build -addopts = - --strict-markers - --doctest-modules - --durations=0 - --color=yes -# Silence numpy builtin type alias warnigns in third party libs -# https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations -filterwarnings = ignore:.*deprecated alias.*:DeprecationWarning:tensorboard.*tensorflow_stub*: - ignore:.*deprecated alias.*:DeprecationWarning:tensorboard.*tensor_util*: - ignore:.*deprecated alias.*:DeprecationWarning:pyarrow.*pandas_compat*: - -[coverage:report] -exclude_lines = - pragma: no-cover - pass - [flake8] max-line-length = 120 exclude = .tox,*.egg,build,temp @@ -41,16 +20,3 @@ ignore = F841, # Invalid escape sequence 'x' W605 - -# setup.cfg or tox.ini -[check-manifest] -ignore = - *.yml - .github - .github/* - -[metadata] -license_file = LICENSE -description-file = README.md -# long_description = file:README.md -# long_description_content_type = text/markdown diff --git a/setup.py b/setup.py deleted file mode 100644 index 157bbcc..0000000 --- a/setup.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python - -from setuptools import find_packages, setup - -with open("README.md") as fh: - long_description = fh.read() - -setup( - name="detoxify", - version="0.5.2", - description="A python library for detecting toxic comments", - long_description=long_description, - long_description_content_type="text/markdown", - author="Unitary", - author_email="laura@unitary.ai", - url="https://github.com/unitaryai/detoxify", - install_requires=[ - "transformers", - "torch >= 1.7.0", - "sentencepiece >= 0.1.94", - ], - packages=find_packages(include=["detoxify"], exclude=["tests", "src"]), - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: Apache Software License", - "Operating System :: OS Independent", - ], - python_requires=">=3.7", -)