From 041aa121234936f4f7c225e92c43d622769c12e3 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 14 Jul 2022 11:58:10 +0200 Subject: Add pypi workflow --- .github/workflows/main.yml | 5 ++-- .github/workflows/pypi.yml | 64 ++++++++++++++++++++++++++++++++++++++++++++++ defusedxml/expatreader.py | 2 +- setup.py | 2 ++ tox.ini | 2 +- 5 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/pypi.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1791bb8..f575328 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,9 +24,10 @@ jobs: - "3.8" - "3.9" - "3.10" + - "3.11-dev" steps: - - uses: "actions/checkout@v2" - - uses: "actions/setup-python@v2" + - uses: "actions/checkout@v3" + - uses: "actions/setup-python@v4" with: python-version: "${{ matrix.python-version }}" - name: "Update pip" diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..296e64b --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,64 @@ +--- +name: Build and upload to PyPI + +permissions: + contents: read + +on: + workflow_dispatch: + inputs: + tag: + description: tag to build + required: true + type: string + testpypi: + description: upload to Test PyPI + type: boolean + default: false + pypi: + description: upload to PyPI + type: boolean + default: false + push: + branches: + - master + - main + - v*.x + pull_request: + branches: + - master + - main + - v*.x + +jobs: + pypi: + name: Build and upload to PyPI + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: ${{ github.event.inputs.tag || github.ref }} + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: "Update pip" + run: python -m pip install --upgrade pip setuptools wheel + - name: "Install 'build' and 'twine'" + run: python -m pip install --upgrade build twine + - name: "Run 'build'" + run: "python -m build" + - name: "Run twine check" + run: "python -m twine check dist/*" + - name: Publish distribution to Test PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + if: github.event.inputs.testpypi == true + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.PYPI_API_TOKEN }} + if: github.event.inputs.pypi == true diff --git a/defusedxml/expatreader.py b/defusedxml/expatreader.py index 9d36dc3..6b17559 100644 --- a/defusedxml/expatreader.py +++ b/defusedxml/expatreader.py @@ -20,7 +20,7 @@ class DefusedExpatParser(_ExpatParser): def __init__( self, namespaceHandling=0, - bufsize=2 ** 16 - 20, + bufsize=2**16 - 20, forbid_dtd=False, forbid_entities=True, forbid_external=True, diff --git a/setup.py b/setup.py index 7636ab4..acd8b31 100644 --- a/setup.py +++ b/setup.py @@ -45,6 +45,7 @@ setup( license="PSFL", description="XML bomb protection for Python stdlib modules", long_description="\n".join(long_description), + long_description_content_type="text/x-rst", classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", @@ -57,6 +58,7 @@ setup( "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Text Processing :: Markup :: XML", ], python_requires=">=3.6", diff --git a/tox.ini b/tox.ini index 0ba7964..e0b775d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py36,py37,py38,py39,py310,black,pep8py3,doc +envlist = py36,py37,py38,py39,py310,py311,black,pep8py3,doc skip_missing_interpreters = true [testenv] -- cgit v1.2.1