From 0f1f3a9b799b08dada172046e4ccb390a7912555 Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Wed, 19 Jul 2023 11:24:55 +0200 Subject: [PATCH] migrate to pyproject.toml --- pyproject.toml | 107 +++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 93 ------------------------------------------ setup.py | 7 ---- 3 files changed, 107 insertions(+), 100 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..0a6f1ad7 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,107 @@ +[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.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" + +[tool.pylint.master] +disable = "fixme" +no-docstring-rgx = "(^_|test_.*)" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index e0721977..00000000 --- a/setup.cfg +++ /dev/null @@ -1,93 +0,0 @@ -[metadata] -name = tldextract -author = John Kurkowski -author_email = john.kurkowski@gmail.com -license = BSD-3-Clause -license_file = LICENSE -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 -url = https://github.com/john-kurkowski/tldextract -long_description = `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. - -long_description_content_type = text/markdown -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 - -[options] -packages = tldextract -setup_requires = setuptools_scm -install_requires = - idna - requests>=2.1.0 - requests-file>=1.4 - filelock>=3.0.8 -include_package_data = True -python_requires = >=3.7 - -[options.entry_points] -console_scripts = tldextract = tldextract.cli:main - -[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_.*) diff --git a/setup.py b/setup.py deleted file mode 100644 index 66a83731..00000000 --- a/setup.py +++ /dev/null @@ -1,7 +0,0 @@ -from setuptools import setup - -setup( - use_scm_version={ - "write_to": "tldextract/_version.py", - }, -)