From 38e69309ea4137ba92a4fd255e14d55bf5a7f571 Mon Sep 17 00:00:00 2001 From: Myst <1592048+LeMyst@users.noreply.github.com> Date: Sun, 17 Jan 2021 23:38:49 +0100 Subject: [PATCH] Improve setup and use PEP517 (#84) * Improve setup and use PEP517 * Create quick-pep517-test.yml * Update quick-pep517-test.yml * Remove test & fix typo * Create test-use-pypa-build.yml * Update test-use-pypa-build.yml * Move from pep517.build to pypa/build https://github.com/pypa/pep517/issues/91 * Update setup.cfg * Update setup.cfg Co-authored-by: Myst <1592048+Mystou@users.noreply.github.com> --- .github/workflows/publish-to-pypi.yml | 15 +++++---- pyproject.toml | 6 ++++ setup.cfg | 38 +++++++++++++++++++++ setup.py | 48 ++------------------------- 4 files changed, 55 insertions(+), 52 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index ba0230bf..836ce517 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -14,25 +14,28 @@ jobs: uses: actions/setup-python@v2 with: python-version: 3.9 - - name: Install wheel + - name: Install pypa/build run: >- python -m pip install - wheel + build --user - name: Build a binary wheel and a source tarball run: >- - python - setup.py - sdist - bdist_wheel + python -m + build + --sdist + --wheel + . - name: Publish distribution 📦 to Test PyPI uses: pypa/gh-action-pypi-publish@master with: + user: __token__ password: ${{ secrets.test_pypi_password }} repository_url: https://test.pypi.org/legacy/ - name: Publish distribution 📦 to PyPI if: startsWith(github.ref, 'refs/tags') uses: pypa/gh-action-pypi-publish@master with: + user: __token__ password: ${{ secrets.pypi_password }} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..fa2a8b22 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = [ + "setuptools >= 40.9.0", + "wheel" +] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg index ed1700c6..b32921cc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,41 @@ [metadata] +name = wikibaseintegrator +version = 0.10.0.dev0 +author = Myst and WikidataIntegrator authors +license = MIT +license-file = LICENSE.txt +description = Python package for reading from and writing to a Wikibase instance +keywords = wikibase, wikidata, mediawiki, sparql +home-page = https://github.com/LeMyst/WikibaseIntegrator +project_urls = + Bug Tracker = https://github.com/LeMyst/WikibaseIntegrator/issues long_description = file: README.md long_description_content_type = text/markdown +platform = any +classifiers = + Programming Language :: Python + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Development Status :: 4 - Beta + Operating System :: POSIX + Operating System :: MacOS :: MacOS X + Operating System :: Microsoft :: Windows + Intended Audience :: Science/Research + Intended Audience :: Information Technology + Intended Audience :: Developers + Topic :: Utilities + Topic :: Software Development :: Libraries :: Python Modules + +[options] +packages = wikibaseintegrator +install_requires = + simplejson + requests + pandas + mwoauth + backoff +python_requires = >=3.7, <3.10 + +[options.extras_require] +dev = pytest diff --git a/setup.py b/setup.py index 200bdce5..b908cbe5 100644 --- a/setup.py +++ b/setup.py @@ -1,47 +1,3 @@ -from setuptools import setup +import setuptools -VERSION = "0.10.0.dev0" - -with open("README.md", "r", encoding="utf-8") as fh: - long_description = fh.read() - -setup( - name='wikibaseintegrator', - version=VERSION, - author='Myst and WikidataIntegrator authors', - description='Python package for reading from and writing to a Wikibase instance', - long_description=long_description, - long_description_content_type="text/markdown", - license='MIT', - keywords='Wikibase', - url='https://github.com/LeMyst/WikibaseIntegrator', - packages=['wikibaseintegrator'], - python_requires='>=3.7', - classifiers=[ - "Programming Language :: Python", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Development Status :: 4 - Beta", - "Operating System :: POSIX", - "Operating System :: MacOS :: MacOS X", - "Operating System :: Microsoft :: Windows", - "Intended Audience :: Science/Research", - "Intended Audience :: Information Technology", - "Intended Audience :: Developers", - "Topic :: Utilities", - "Topic :: Software Development :: Libraries :: Python Modules" - ], - install_requires=[ - 'simplejson', - 'requests', - 'pandas', - 'mwoauth', - 'backoff' - ], - extras_require={ - 'dev': [ - 'pytest' - ] - } -) +setuptools.setup()