Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[py-tx] Migrate setup.py to pyproject.toml for modern packaging #1746

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/python-threatexchange-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python3 -m pip install -e .[all]
python3 -m pip install -e .[dev]
Dcallies marked this conversation as resolved.
Show resolved Hide resolved
- name: Check code format
run: |
black --check .
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[test]"
python3 -m pip install -e .[dev,extensions]
- name: Test with pytest
run: |
py.test
77 changes: 77 additions & 0 deletions python-threatexchange/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
[build-system]
requires = ["hatchling", "hatch-fancy-pypi-readme"]
build-backend = "hatchling.build"

[project]
name = "threatexchange"
dynamic = ["version"]
description = "DESCRIPTION.rst"
readme = "README.md"
license = { text = "BSD" }
authors = [
{ name = "Facebook", email = "[email protected]" },
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3.8",
]
keywords = ["facebook", "threatexchange", "ncmec", "stopncii", "pdq"]
requires-python = ">=3.8"
dependencies = [
"python-Levenshtein",
"requests",
"urllib3", # For allow_methods
"python-dateutil",
"types-python-dateutil",
"dacite",
"Pillow", # pdq
"pdqhash", # pdq
"faiss-cpu", # faiss
"numpy", # faiss
"packaging", # fix ModuleNotFoundError in faiss/loader.py
]
urls = {Homepage = "https://www.github.com/facebook/ThreatExchange"}

[project.optional-dependencies]
extensions = [
"vpdq",
"py-tlsh",
"pdfminer.six",
"pytesseract",
Dcallies marked this conversation as resolved.
Show resolved Hide resolved
]
dev = [
"pytest",
"black",
"mypy",
"types-python-dateutil",
"types-requests",
]
package = ["wheel"]

[project.scripts]
threatexchange = "threatexchange.cli.main:main"
tx = "threatexchange.cli.main:main"

[tool.hatch.version]
path = "version.txt"
pattern = "^(?P<version>\\d+\\.\\d+\\.\\d+)$"

[tool.hatch.build.targets.wheel]
packages = ["threatexchange"]
include = ["threatexchange/py.typed"]
exclude = ["tests*"]

[tool.hatch.build.targets.sdist]
exclude = [
"tests*",
]

[tool.hatch.metadata]
allow-direct-references = true

[tool.black]
line-length = 88
target-version = ["py38"]
include = '\.pyi?$'
79 changes: 0 additions & 79 deletions python-threatexchange/setup.py

This file was deleted.

Loading