From b7a3e7544d7ac5e3ec9351a04bb6c0d013284f02 Mon Sep 17 00:00:00 2001 From: sigma67 Date: Thu, 22 Sep 2022 18:26:12 +0200 Subject: [PATCH] use pyproject.toml for build --- .github/workflows/pythonpublish.yml | 39 ++++++++++++++++------------- .gitignore | 4 ++- MANIFEST.in | 3 --- README.rst | 2 +- pyproject.toml | 37 +++++++++++++++++++++++++++ setup.py | 29 --------------------- 6 files changed, 63 insertions(+), 51 deletions(-) delete mode 100644 MANIFEST.in create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index c05a1de..36855e1 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -2,25 +2,30 @@ name: Upload Python Package on: release: - types: [created] + types: [published] + +permissions: + contents: read jobs: deploy: + runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build - run: | - python setup.py sdist bdist_wheel - - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - password: ${{ secrets.PYPI_PASSWORD }} + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + 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 + - name: Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.gitignore b/.gitignore index d2c22fc..d8ecf8c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,6 @@ docs/build .coverage **/__pycache__/ venv*/ -*.egg-info/ \ No newline at end of file +*.egg-info/ +build +dist diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 438fe27..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,3 +0,0 @@ -include README.md -recursive-include ytmusicapi/locales *.mo -recursive-include ytmusicapi *.py \ No newline at end of file diff --git a/README.rst b/README.rst index 3d9cec0..4c0fc0c 100644 --- a/README.rst +++ b/README.rst @@ -79,7 +79,7 @@ The `tests `_ a Requirements ============== -- Python 3.6 or higher - https://www.python.org +- Python 3.7 or higher - https://www.python.org Setup and Usage =============== diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..0bcc058 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,37 @@ +[project] +name = "ytmusicapi" +description = "Unofficial API for YouTube Music" +requires-python = ">=3.7" +authors=[{name = "sigma67", email= "ytmusicapi@gmail.com"}] +license={file="LICENSE"} +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", +] +dependencies = [ + "requests >= 2.22", +] +dynamic = ["version", "readme"] + +[project.optional-dependencies] +dev = ['pre-commit', 'flake8', 'yapf', 'coverage', 'sphinx', 'sphinx-rtd-theme'] + +[project.urls] +homepage = "https://github.com/sigma67/ytmusicapi" +documentation = "https://ytmusicapi.readthedocs.io" +repository = "https://github.com/sigma67/ytmusicapi" + +[build-system] +requires = ["setuptools>=65", "setuptools_scm[toml]>=7"] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] + +[tool.setuptools.dynamic] +readme = {file = ["README.rst"]} + +[tool.setuptools] +include-package-data=false + +[tool.setuptools.package-data] +"*" = ["**.rst", "**.py", "**.mo"] diff --git a/setup.py b/setup.py deleted file mode 100644 index 6ab222b..0000000 --- a/setup.py +++ /dev/null @@ -1,29 +0,0 @@ -from setuptools import setup, find_packages -import re - -VERSIONFILE = 'ytmusicapi/_version.py' - -version_line = open(VERSIONFILE).read() -version_re = r"^__version__ = ['\"]([^'\"]*)['\"]" -match = re.search(version_re, version_line, re.M) -if match: - version = match.group(1) -else: - raise RuntimeError("Could not find version in '%s'" % VERSIONFILE) - -setup(name='ytmusicapi', - version=version, - description='Unofficial API for YouTube Music', - long_description=(open('README.rst').read()), - url='https://github.com/sigma67/ytmusicapi', - author='sigma67', - author_email='', - license='MIT', - packages=find_packages(), - install_requires=['requests >= 2.22'], - extras_require={ - 'dev': ['pre-commit', 'flake8', 'yapf', 'coverage', 'sphinx', 'sphinx-rtd-theme'] - }, - python_requires=">=3.6", - include_package_data=True, - zip_safe=False)