From cdb1732ad2f5079dfaa6735808fdd28204bebe1c Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Thu, 10 Nov 2022 13:54:29 +0300 Subject: [PATCH 1/5] Added `pyproject.toml` according to `PEP 517`. --- docs/usage.md | 4 ++-- pyproject.toml | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 pyproject.toml diff --git a/docs/usage.md b/docs/usage.md index 2a5b78c..f5305b3 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -22,8 +22,8 @@ Clone the repository from https://github.com/Alir3z4/html2text ``` $ git clone --depth 1 https://github.com/Alir3z4/html2text.git -$ python setup.py build -$ python setup.py install +$ python -m build -nwx +$ python -m pip install --upgrade ./dist/*.whl ``` diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b464d1d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools>=42.2"] +build-backend = "setuptools.build_meta" From d2019a6a4a6bb1e206a9a5b7707afb2b90ee6c95 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Thu, 10 Nov 2022 14:00:41 +0300 Subject: [PATCH 2/5] Removed `setup.py` - it is no longer needed. --- setup.py | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 setup.py diff --git a/setup.py b/setup.py deleted file mode 100644 index 6068493..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() From b33e73cfc2353f70c5a9738c0019dd6dfa55f9bb Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Thu, 10 Nov 2022 13:57:23 +0300 Subject: [PATCH 3/5] Started using `setuptools_scm` for a better version number containing git commit hash. --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b464d1d..899e056 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,5 @@ [build-system] -requires = ["setuptools>=42.2"] +requires = ["setuptools>=42.2", "setuptools_scm[toml]>=3.4.3"] build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] From ebd94fae0581df47f6c643865ae25adf1433be35 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Thu, 10 Nov 2022 14:10:35 +0300 Subject: [PATCH 4/5] Started using `setuptools_scm` for fetching version automatically from git tags. --- .gitignore | 2 ++ docs/usage.md | 2 +- html2text/__init__.py | 4 +--- pyproject.toml | 1 + setup.cfg | 1 - 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 047a2c1..f5b7f4d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +/html2text/_version.py + *.py[co] *.bak build diff --git a/docs/usage.md b/docs/usage.md index f5305b3..f22b56c 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -21,7 +21,7 @@ $ pip install html2text Clone the repository from https://github.com/Alir3z4/html2text ``` -$ git clone --depth 1 https://github.com/Alir3z4/html2text.git +$ git clone --depth 50 https://github.com/Alir3z4/html2text.git $ python -m build -nwx $ python -m pip install --upgrade ./dist/*.whl ``` diff --git a/html2text/__init__.py b/html2text/__init__.py index c59ae16..e9dc74f 100644 --- a/html2text/__init__.py +++ b/html2text/__init__.py @@ -9,6 +9,7 @@ from typing import Dict, List, Optional, Tuple, Union from . import config +from ._version import __version_tuple__ as __version__ from .elements import AnchorElement, ListElement from .typing import OutCallback from .utils import ( @@ -27,9 +28,6 @@ unifiable_n, ) -__version__ = (2020, 1, 16) - - # TODO: # Support decoded entities with UNIFIABLE. diff --git a/pyproject.toml b/pyproject.toml index 899e056..5c61825 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,3 +3,4 @@ requires = ["setuptools>=42.2", "setuptools_scm[toml]>=3.4.3"] build-backend = "setuptools.build_meta" [tool.setuptools_scm] +write_to = "html2text/_version.py" diff --git a/setup.cfg b/setup.cfg index 6ba62eb..fb10c46 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,5 @@ [metadata] name = html2text -version = attr: html2text.__version__ description = Turn HTML into equivalent Markdown-structured text. long_description = file: README.md long_description_content_type = text/markdown From 5dfa9a5aa9dc4801487e0356ae003cc8dd4a0c59 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Thu, 10 Nov 2022 14:17:08 +0300 Subject: [PATCH 5/5] Migrated the metadata into `PEP 621`-compliant `pyproject.toml`. --- pyproject.toml | 52 +++++++++++++++++++++++++++++++++++++++++++++++++- setup.cfg | 50 ------------------------------------------------ 2 files changed, 51 insertions(+), 51 deletions(-) delete mode 100644 setup.cfg diff --git a/pyproject.toml b/pyproject.toml index 5c61825..8a813b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,56 @@ [build-system] -requires = ["setuptools>=42.2", "setuptools_scm[toml]>=3.4.3"] +requires = ["setuptools>=61.2", "setuptools_scm[toml]>=3.4.3"] build-backend = "setuptools.build_meta" +[project] +name = "html2text" +description = "Turn HTML into equivalent Markdown-structured text." +readme = "README.md" +authors = [{name = "Aaron Swartz", email = "me@aaronsw.com"}] +maintainers = [{name = "Alireza Savand", email = "alireza.savand@gmail.com"}] +license = {text = "GNU GPL 3"} +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: GNU General Public License (GPL)", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", +] +urls = {Homepage = "https://github.com/Alir3z4/html2text/"} +requires-python = ">=3.5" +dynamic = ["version"] + +[project.scripts] +html2text = "html2text.cli:main" + +[tool.setuptools] +zip-safe = false +packages = ["html2text"] +platforms = ["OS Independent"] +include-package-data = false + +[tool.setuptools.package-data] +html2text = ["py.typed"] + [tool.setuptools_scm] write_to = "html2text/_version.py" + +[tool.flake8] # you will need Flake8-pyproject +max_line_length = "88" +extend-ignore = "E203" + +[tool.isort] +profile = "black" +combine_as_imports = true + +[tool.mypy] +python_version = "3.5" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index fb10c46..0000000 --- a/setup.cfg +++ /dev/null @@ -1,50 +0,0 @@ -[metadata] -name = html2text -description = Turn HTML into equivalent Markdown-structured text. -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/Alir3z4/html2text/ -author = Aaron Swartz -author_email = me@aaronsw.com -maintainer = Alireza Savand -maintainer_email = alireza.savand@gmail.com -license = GNU GPL 3 -classifiers = - Development Status :: 5 - Production/Stable - Intended Audience :: Developers - License :: OSI Approved :: GNU General Public License (GPL) - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.5 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: Implementation :: CPython - Programming Language :: Python :: Implementation :: PyPy -platform = OS Independent - -[options] -zip_safe = False -packages = html2text -python_requires = >=3.5 - -[options.entry_points] -console_scripts = - html2text = html2text.cli:main - -[options.package_data] -html2text = py.typed - -[flake8] -max_line_length = 88 -extend-ignore = E203 - -[isort] -combine_as_imports = True -profile = black - -[mypy] -python_version = 3.5