From cef70fb8629ddc9dc38486f2ab89fa1ce46e595a Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Wed, 23 Nov 2022 10:54:15 +0000 Subject: [PATCH 1/3] Switch to using pyproject.toml for build config --- pyproject.toml | 33 ++++++++++++++++++++++++++++++++ setup.py | 51 ++------------------------------------------------ 2 files changed, 35 insertions(+), 49 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9b2f56a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,33 @@ +[build-system] +requires = [ + "setuptools >= 61.0.0", +] +build-backend = "setuptools.build_meta" + +[project] +name = "markdown-include" +description = "A Python-Markdown extension which provides an 'include' function" +readme = "README.md" +requires-python = ">=3.7" +classifiers = [ + "Programming Language :: Python", + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Topic :: Internet :: WWW/HTTP :: Site Management", + "Topic :: Software Development :: Documentation", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Text Processing :: Filters", + "Topic :: Text Processing :: Markup :: HTML", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", +] +keywords = ["Markdown", "typesetting", "include", "plugin", "extension"] +license = {text = "GNU General Public License v3 (GPLv3)"} +authors = [{name = "Chris MacMackin", email = "cmacmackin@gmail.com"}] +urls = {project = "https://github.com/cmacmackin/markdown-include"} +dependencies = [ + "markdown>=3.0", +] +version = "0.7.0" + +[tool.setuptools] +packages = ["markdown_include"] diff --git a/setup.py b/setup.py index adfe3fb..8bf1ba9 100644 --- a/setup.py +++ b/setup.py @@ -1,49 +1,2 @@ -from setuptools import setup, find_packages -from codecs import open # To use a consistent encoding -from os import path - -here = path.abspath(path.dirname(__file__)) - -# Get the long description from the relevant file -with open(path.join(here, 'README.rst'), encoding='utf-8') as f: - long_description = f.read() - -setup( - name = 'markdown-include', - packages = find_packages(), - version = '0.7.0', - description = 'This is an extension to Python-Markdown which provides an "include" function, similar to that found in LaTeX (and also the C pre-processor and Fortran). I originally wrote it for my FORD Fortran auto-documentation generator.', - long_description = long_description, - author = 'Chris MacMackin', - author_email = 'cmacmackin@gmail.com', - url = 'https://github.com/cmacmackin/markdown-include/', - download_url = 'https://github.com/cmacmackin/markdown-include/tarball/v0.7.0', - keywords = ['Markdown', 'typesetting', 'include', 'plugin', 'extension'], - classifiers=[ - # How mature is this project? Common values are - # 3 - Alpha - # 4 - Beta - # 5 - Production/Stable - 'Development Status :: 5 - Production/Stable', - - # Indicate who your project is intended for - 'Intended Audience :: Developers', - 'Topic :: Internet :: WWW/HTTP :: Site Management', - 'Topic :: Software Development :: Documentation', - 'Topic :: Software Development :: Libraries :: Python Modules', - 'Topic :: Text Processing :: Filters', - 'Topic :: Text Processing :: Markup :: HTML', - - # Pick your license as you wish (should match "license" above) - 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', - - # Specify the Python versions you support here. In particular, ensure - # that you indicate whether you support Python 2, Python 3 or both. - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', - ], - install_requires = ['markdown>=3.0'] -) +from setuptools import setup +setup() From cbebfd961371f027808c8517cb4d964c510b3ab8 Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Wed, 23 Nov 2022 11:00:15 +0000 Subject: [PATCH 2/3] CI: Add publishing workflow --- .github/workflows/publish.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..1126e33 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,26 @@ +name: Upload Python Package + +on: + release: + types: [published] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build package + run: python -m build --sdist --wheel + - name: Publish package + uses: pypa/gh-action-pypi-publish@v1 + with: + user: __token__ + password: ${{ secrets.PYPI_DEPLOYMENT_TOKEN }} From 97c5b65a5cdf4b24247b75bf09c1b2d21adf126c Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Wed, 23 Nov 2022 11:04:00 +0000 Subject: [PATCH 3/3] Set version dynamically from git tag --- pyproject.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9b2f56a..c13bb83 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,7 @@ [build-system] requires = [ "setuptools >= 61.0.0", + "setuptools_scm[toml] >= 6.2", ] build-backend = "setuptools.build_meta" @@ -27,7 +28,10 @@ urls = {project = "https://github.com/cmacmackin/markdown-include"} dependencies = [ "markdown>=3.0", ] -version = "0.7.0" +dynamic = ["version"] [tool.setuptools] packages = ["markdown_include"] + +[tool.setuptools.dynamic] +version = { attr = "setuptools_scm.get_version" }