Skip to content

Commit

Permalink
migrate setup.py to pyproject.toml (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
deronnax committed Aug 24, 2023
1 parent 68477c5 commit c458e14
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 93 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ matrix:
env: TOXENV=py310
- python: "3.11"
env: TOXENV=py311
- python: pypy3.7-7.3.5
- python: pypy3.7-7.3.9
dist: xenial
env: TOXENV=pypy3
- env: TOXENV=codestyle
Expand Down
101 changes: 101 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
[project]
name = "tldextract"
authors = [{name = "John Kurkowski", email = "john.kurkowski@gmail.com"}]
license = {text = "BSD-3-Clause"}
description = "Accurately separates a URL's subdomain, domain, and public suffix, using the Public Suffix List (PSL). By default, this includes the public ICANN TLDs and their exceptions. You can optionally support the Public Suffix List's private domains as well."
keywords = [
"tld",
"domain",
"subdomain",
"url",
"parse",
"extract",
"urlparse",
"urlsplit",
"public",
"suffix",
"list",
"publicsuffix",
"publicsuffixlist",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Topic :: Utilities",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
requires-python = ">=3.7"
dependencies = [
"idna",
"requests>=2.1.0",
"requests-file>=1.4",
"filelock>=3.0.8",
]
dynamic = ["version"]

[project.readme]
text = """
`tldextract` accurately separates a URL's subdomain, domain, and public suffix.
It does this via the Public Suffix List (PSL).
>>> import tldextract
>>> tldextract.extract('http://forums.news.cnn.com/')
ExtractResult(subdomain='forums.news', domain='cnn', suffix='com')
>>> tldextract.extract('http://forums.bbc.co.uk/') # United Kingdom
ExtractResult(subdomain='forums', domain='bbc', suffix='co.uk')
>>> tldextract.extract('http://www.worldbank.org.kg/') # Kyrgyzstan
ExtractResult(subdomain='www', domain='worldbank', suffix='org.kg')
`ExtractResult` is a namedtuple, so it's simple to access the parts you want.
>>> ext = tldextract.extract('http://forums.bbc.co.uk')
>>> (ext.subdomain, ext.domain, ext.suffix)
('forums', 'bbc', 'co.uk')
>>> # rejoin subdomain and domain
>>> '.'.join(ext[:2])
'forums.bbc'
>>> # a common alias
>>> ext.registered_domain
'bbc.co.uk'
By default, this package supports the public ICANN TLDs and their exceptions.
You can optionally support the Public Suffix List's private domains as well."""
content-type = "text/markdown"

[project.urls]
Homepage = "https://github.com/john-kurkowski/tldextract"

[project.scripts]
tldextract = "tldextract.cli:main"

[build-system]
requires = [
"setuptools>=61.2",
"setuptools_scm[toml]>=6.2",
]
build-backend = "setuptools.build_meta"

[tool.setuptools]
packages = ["tldextract"]
include-package-data = true
license-files = ["LICENSE"]

[tool.setuptools_scm]
write_to = "tldextract/_version.py"

[tool.setuptools.dynamic]
version = {attr = "setuptools_scm.get_version"}

[tool.mypy]
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_calls = true

[[tool.mypy.overrides]]
module = ["tldextract.*"]
disallow_untyped_defs = true

[tool.pylint.master]
disable = "fixme"
no-docstring-rgx = "(^_|test_.*)"
16 changes: 0 additions & 16 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
[metadata]
license_file = LICENSE

[mypy]
check_untyped_defs = True
disallow_incomplete_defs = True
disallow_untyped_calls = True

[mypy-tldextract.*]
disallow_untyped_defs = True

[pycodestyle]
# E203 - whitespace before; disagrees with PEP8 https://github.com/psf/black/issues/354#issuecomment-397684838
# E501 - line too long
# W503 - line break before binary operator; disagrees with PEP8 https://github.com/psf/black/issues/52
ignore = E203, E501, W503

[pylint.master]
disable =
fixme
no-docstring-rgx = (^_|test_.*)
76 changes: 0 additions & 76 deletions setup.py

This file was deleted.

0 comments on commit c458e14

Please sign in to comment.