From ca88e4e49dc03207f0261b855e251ac169f5ea2c Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Thu, 10 Nov 2022 15:17:14 +0300 Subject: [PATCH 1/5] Move the metadata from `setup.py` into `setup.cfg`. Added `pyproject.toml`. Removed `setup.py` - it is no longer needed. Got rid of tests erroroneously finding their way into the wheel. --- .github/workflows/python-publish.yml | 4 +-- pyproject.toml | 3 ++ setup.cfg | 34 ++++++++++++++++++ setup.py | 52 ---------------------------- 4 files changed, 39 insertions(+), 54 deletions(-) create mode 100644 pyproject.toml create mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 9e3a349..ebe5035 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -21,11 +21,11 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine + pip install --upgrade setuptools wheel build twine - name: Build and publish env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python setup.py sdist bdist_wheel + python -m build -nwsx . twine upload dist/* diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..db27d56 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools>=42.2.0"] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..02d89b6 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,34 @@ +[metadata] +name = markdownify +version = 0.11.6 +author = Matthew Tretter +author_email = m@tthewwithanm.com +description = Convert HTML to markdown. +url = http://github.com/matthewwithanm/python-markdownify +download_url = http://github.com/matthewwithanm/python-markdownify/tarball/master +long_description = file: README.rst +classifiers = + Environment :: Web Environment + Framework :: Django + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Operating System :: OS Independent + Programming Language :: Python :: 2.5 + Programming Language :: Python :: 2.6 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Topic :: Utilities + +[options] +packages = find: +zip_safe = False +install_requires = beautifulsoup4>=4.9,<5; six>=1.15,<2 +include_package_data = True + +[options.packages.find] +include = markdownify, markdownify.* + +[options.entry_points] +console_scripts = markdownify = markdownify.main:main diff --git a/setup.py b/setup.py deleted file mode 100644 index 807ff23..0000000 --- a/setup.py +++ /dev/null @@ -1,52 +0,0 @@ -#/usr/bin/env python -import codecs -import os -from setuptools import setup, find_packages - - -read = lambda filepath: codecs.open(filepath, 'r', 'utf-8').read() - -pkgmeta = { - '__title__': 'markdownify', - '__author__': 'Matthew Tretter', - '__version__': '0.11.6', -} - -read = lambda filepath: codecs.open(filepath, 'r', 'utf-8').read() - -setup( - name='markdownify', - description='Convert HTML to markdown.', - long_description=read(os.path.join(os.path.dirname(__file__), 'README.rst')), - version=pkgmeta['__version__'], - author=pkgmeta['__author__'], - author_email='m@tthewwithanm.com', - url='http://github.com/matthewwithanm/python-markdownify', - download_url='http://github.com/matthewwithanm/python-markdownify/tarball/master', - packages=find_packages(), - zip_safe=False, - include_package_data=True, - install_requires=[ - 'beautifulsoup4>=4.9,<5', - 'six>=1.15,<2', - ], - classifiers=[ - 'Environment :: Web Environment', - 'Framework :: Django', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 2.5', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Topic :: Utilities' - ], - entry_points={ - 'console_scripts': [ - 'markdownify = markdownify.main:main' - ] - } -) From deba8b5e54a78c56d1f71044d4d5a761e504af36 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Thu, 10 Nov 2022 15:26:57 +0300 Subject: [PATCH 2/5] Started populating version automatically from git tags using `setuptools_scm`. --- .github/workflows/python-publish.yml | 2 +- pyproject.toml | 4 +++- setup.cfg | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index ebe5035..c337bab 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -21,7 +21,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install --upgrade setuptools wheel build twine + pip install --upgrade setuptools setuptools_scm wheel build twine - name: Build and publish env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} diff --git a/pyproject.toml b/pyproject.toml index db27d56..411bae8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,5 @@ [build-system] -requires = ["setuptools>=42.2.0"] +requires = ["setuptools>=42.2.0", "setuptools_scm[toml]>=3.4.3"] build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] diff --git a/setup.cfg b/setup.cfg index 02d89b6..ebace18 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,5 @@ [metadata] name = markdownify -version = 0.11.6 author = Matthew Tretter author_email = m@tthewwithanm.com description = Convert HTML to markdown. From 67100595aebe6edba9c328bfae6b719fa6a49f97 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Thu, 10 Nov 2022 15:29:25 +0300 Subject: [PATCH 3/5] Migrated the metadata into `PEP 621`-compliant `pyproject.toml`, got rid of `setup.cfg`. --- pyproject.toml | 42 +++++++++++++++++++++++++++++++++++++++++- setup.cfg | 33 --------------------------------- 2 files changed, 41 insertions(+), 34 deletions(-) delete mode 100644 setup.cfg diff --git a/pyproject.toml b/pyproject.toml index 411bae8..736a702 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,45 @@ [build-system] -requires = ["setuptools>=42.2.0", "setuptools_scm[toml]>=3.4.3"] +requires = ["setuptools>=61.2", "setuptools_scm[toml]>=3.4.3"] build-backend = "setuptools.build_meta" +[project] +name = "markdownify" +authors = [{name = "Matthew Tretter", email = "m@tthewwithanm.com"}] +description = "Convert HTML to markdown." +readme = "README.rst" +classifiers = [ + "Environment :: Web Environment", + "Framework :: Django", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 2.5", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Topic :: Utilities", +] +dependencies = [ + "beautifulsoup4>=4.9,<5", + "six>=1.15,<2" +] +dynamic = ["version"] + +[project.urls] +Homepage = "http://github.com/matthewwithanm/python-markdownify" +Download = "http://github.com/matthewwithanm/python-markdownify/tarball/master" + +[project.scripts] +markdownify = "markdownify.main:main" + +[tool.setuptools] +zip-safe = false +include-package-data = true + +[tool.setuptools.packages.find] +include = ["markdownify", "markdownify.*"] +namespaces = false + [tool.setuptools_scm] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index ebace18..0000000 --- a/setup.cfg +++ /dev/null @@ -1,33 +0,0 @@ -[metadata] -name = markdownify -author = Matthew Tretter -author_email = m@tthewwithanm.com -description = Convert HTML to markdown. -url = http://github.com/matthewwithanm/python-markdownify -download_url = http://github.com/matthewwithanm/python-markdownify/tarball/master -long_description = file: README.rst -classifiers = - Environment :: Web Environment - Framework :: Django - Intended Audience :: Developers - License :: OSI Approved :: MIT License - Operating System :: OS Independent - Programming Language :: Python :: 2.5 - Programming Language :: Python :: 2.6 - Programming Language :: Python :: 2.7 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Topic :: Utilities - -[options] -packages = find: -zip_safe = False -install_requires = beautifulsoup4>=4.9,<5; six>=1.15,<2 -include_package_data = True - -[options.packages.find] -include = markdownify, markdownify.* - -[options.entry_points] -console_scripts = markdownify = markdownify.main:main From e2ace9d63302dbc0e9b3c7fb1cc2ee5c5e82c301 Mon Sep 17 00:00:00 2001 From: AlexVonB Date: Sun, 14 Jul 2024 22:10:01 +0200 Subject: [PATCH 4/5] test build in develop and pull requests --- .github/workflows/python-app.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index eb64947..481ade5 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -23,7 +23,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install tox + pip install --upgrade setuptools setuptools_scm wheel build tox - name: Lint and test run: | tox + - name: Build + run: | + python -m build -nwsx . From 4c23c0655fcd811c5e1bfc7fe4a69bc70b5ccc3b Mon Sep 17 00:00:00 2001 From: AlexVonB Date: Sun, 14 Jul 2024 22:34:30 +0200 Subject: [PATCH 5/5] use static version instead of dynamic git tag info --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 736a702..69dd27e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "markdownify" +version = "0.13.0" authors = [{name = "Matthew Tretter", email = "m@tthewwithanm.com"}] description = "Convert HTML to markdown." readme = "README.rst" @@ -25,7 +26,6 @@ dependencies = [ "beautifulsoup4>=4.9,<5", "six>=1.15,<2" ] -dynamic = ["version"] [project.urls] Homepage = "http://github.com/matthewwithanm/python-markdownify"