From 988713c556918f36d4f8cf89cd5a631937ee1d33 Mon Sep 17 00:00:00 2001 From: Adrien Barbaresi Date: Mon, 17 Jun 2024 15:57:44 +0200 Subject: [PATCH] maintenance: update setup and add pyproject.toml file (#59) * add pyproject.toml setup file * scrap 3.6 and update workflow * further transfers from setup.py to pyproject.toml * adapt descriptors --- pyproject.toml | 83 ++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 85 -------------------------------------------------- 2 files changed, 83 insertions(+), 85 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..03dc84e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,83 @@ +# https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "courlan" +description = "Clean, filter and sample URLs to optimize data collection – includes spam, content type and language filters." +readme = "README.md" +license = { text = "Apache 2.0" } +dynamic = ["version"] +requires-python = ">=3.8" +authors = [ + {name = "Adrien Barbaresi", email = "barbaresi@bbaw.de"} +] +keywords=[ + "cleaner", + "crawler", + "uri", + "url-parsing", + "url-manipulation", + "urls", + "validation", + "webcrawling", +] +classifiers = [ + # As from http://pypi.python.org/pypi?%3Aaction=list_classifiers + 'Development Status :: 5 - Production/Stable', + #'Development Status :: 6 - Mature', + "Environment :: Console", + "Intended Audience :: Developers", + "Intended Audience :: Education", + "Intended Audience :: Information Technology", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: Apache Software License", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Scientific/Engineering :: Information Analysis", + "Topic :: Security", + "Topic :: Text Processing :: Filters", + "Topic :: Text Processing :: Linguistic", + "Typing :: Typed", +] +dependencies = [ + "babel >= 2.11.0", + "tld >= 0.13", + "urllib3 >= 1.26, < 3", +] + +# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html +[tool.setuptools] +packages = ["courlan"] + +# https://packaging.python.org/en/latest/guides/single-sourcing-package-version/ +[tool.setuptools.dynamic] +version = {attr = "courlan.__version__"} + +[project.scripts] +courlan = "courlan.cli:main" + +[project.urls] +"Homepage" = "https://github.com/adbar/courlan" +"Blog" = "https://adrien.barbaresi.eu/blog/" # /tag/courlan.html +"Tracker" = "https://github.com/adbar/courlan/issues" + +# Development extras +[project.optional-dependencies] +dev = [ + "black", + "mypy", + "pytest", + "pytest-cov", +] diff --git a/setup.py b/setup.py index c6e5424..b2d4e90 100644 --- a/setup.py +++ b/setup.py @@ -3,29 +3,11 @@ https://github.com/adbar/courlan """ -import re import sys -from pathlib import Path from setuptools import setup -def get_version(package): - "Return package version as listed in `__version__` in `init.py`" - initfile = Path(package, "__init__.py").read_text(encoding="utf-8") - return re.search("__version__ = ['\"]([^'\"]+)['\"]", initfile)[1] - - -def get_long_description(): - "Return the README" - with open("README.md", "r", encoding="utf-8") as filehandle: - long_description = filehandle.read() - # long_description += "\n\n" - # with open("CHANGELOG.md", encoding="utf8") as f: - # long_description += f.read() - return long_description - - # add argument to compile with mypyc if len(sys.argv) > 1 and sys.argv[1] == "--use-mypyc": sys.argv.pop(1) @@ -51,73 +33,6 @@ def get_long_description(): setup( - name="courlan", - version=get_version("courlan"), - description="Clean, filter and sample URLs to optimize data collection – includes spam, content type and language filters.", - long_description=get_long_description(), - long_description_content_type="text/markdown", - classifiers=[ - # As from http://pypi.python.org/pypi?%3Aaction=list_classifiers - "Development Status :: 5 - Production/Stable", - #'Development Status :: 6 - Mature', - "Environment :: Console", - "Intended Audience :: Developers", - "Intended Audience :: Education", - "Intended Audience :: Information Technology", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: Apache Software License", - "Operating System :: MacOS :: MacOS X", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX :: Linux", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Topic :: Internet :: WWW/HTTP", - "Topic :: Scientific/Engineering :: Information Analysis", - "Topic :: Security", - "Topic :: Text Processing :: Filters", - "Topic :: Text Processing :: Linguistic", - "Typing :: Typed", - ], - keywords=[ - "cleaner", - "crawler", - "uri", - "url-parsing", - "url-manipulation", - "urls", - "validation", - "webcrawling", - ], - url="https://github.com/adbar/courlan", - author="Adrien Barbaresi", - author_email="barbaresi@bbaw.de", - license="Apache-2.0", - packages=["courlan"], - project_urls={ - "Blog": "https://adrien.barbaresi.eu/blog/", # /tag/courlan.html - "Tracker": "https://github.com/adbar/courlan/issues", - }, - # package_data={}, - include_package_data=True, - python_requires=">=3.8", - install_requires=[ - "babel >= 2.11.0", - "tld >= 0.13", - "urllib3 >= 1.26, < 3", - ], - # extras_require=extras, - entry_points={ - "console_scripts": ["courlan=courlan.cli:main"], - }, - # platforms='any', - tests_require=["pytest"], - zip_safe=False, # mypyc or not ext_modules=ext_modules, )