Skip to content

Commit

Permalink
Migrate legacy setup.py to pyproject.toml (#108)
Browse files Browse the repository at this point in the history
* Migrate legacy setup.py to pyproject.toml

* Prune setup.cfg

Moves the pytest config from setup.cfg to pyproject.toml

Removes some sections that didn't seem necessary or duplicate
metadata in pyproject.toml (resolves "Usage of dash-separated
'description-file' will not be supported in future" build warning)

Keeps only the flake8 config that doesn't support pyproject.toml: PyCQA/flake8#234

* Add just the detoxify package to the build

* Move sentencepiece to main deps
  • Loading branch information
jamt9000 authored May 16, 2024
1 parent 4d78038 commit 091e64b
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

```

Expand Down
61 changes: 57 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]"},
]
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]
Expand All @@ -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"
9 changes: 0 additions & 9 deletions requirements.txt

This file was deleted.

34 changes: 0 additions & 34 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
29 changes: 0 additions & 29 deletions setup.py

This file was deleted.

0 comments on commit 091e64b

Please sign in to comment.