use pyproject.toml for build

This commit is contained in:
sigma67 2022-09-22 18:26:12 +02:00
commit b7a3e7544d
No known key found for this signature in database
GPG key ID: 1545A01D4474BAF0
6 changed files with 63 additions and 51 deletions

View file

@ -2,25 +2,30 @@ name: Upload Python Package
on: on:
release: release:
types: [created] types: [published]
permissions:
contents: read
jobs: jobs:
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v1 uses: actions/setup-python@v3
with: with:
python-version: '3.x' python-version: '3.x'
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install setuptools wheel twine pip install build
- name: Build - name: Build package
run: | run: python -m build
python setup.py sdist bdist_wheel - name: Publish package
- name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
uses: pypa/gh-action-pypi-publish@master with:
with: user: __token__
password: ${{ secrets.PYPI_PASSWORD }} password: ${{ secrets.PYPI_API_TOKEN }}

2
.gitignore vendored
View file

@ -8,3 +8,5 @@ docs/build
**/__pycache__/ **/__pycache__/
venv*/ venv*/
*.egg-info/ *.egg-info/
build
dist

View file

@ -1,3 +0,0 @@
include README.md
recursive-include ytmusicapi/locales *.mo
recursive-include ytmusicapi *.py

View file

@ -79,7 +79,7 @@ The `tests <https://github.com/sigma67/ytmusicapi/blob/master/tests/test.py>`_ a
Requirements Requirements
============== ==============
- Python 3.6 or higher - https://www.python.org - Python 3.7 or higher - https://www.python.org
Setup and Usage Setup and Usage
=============== ===============

37
pyproject.toml Normal file
View file

@ -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"]

View file

@ -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)