diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f210dca8..e67a56fc 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,10 +9,6 @@ updates: directory: "/" schedule: interval: "weekly" - ignore: - - dependency-name: "pytest" - # Until Python 2 is ripped out - versions: ["5.x", "6.x", "7.x"] - package-ecosystem: "github-actions" directory: "/" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index a91c5d0f..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Publish -on: - push: - tags: - - 'v*' - -jobs: - package: - name: Package - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.9'] - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - - name: Install - run: | - python -m pip install --upgrade pip - pip install -e .[tests] - - - name: Unit Tests - run: pytest -v -s gtts/ - env: - TEST_LANGS: all - - - name: Install Tools - run: pip install --upgrade setuptools wheel twine - - - name: Package (wheel) - run: python setup.py bdist_wheel - - - name: Package (sdist) - if: matrix.python-version == '3.x' - run: python setup.py sdist - - - name: Publish - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.pypi_token }} - run: twine upload dist/* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..a119a39a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,50 @@ +name: Release + +on: + push: + branches: + - main + +jobs: + release-please: + runs-on: ubuntu-latest + + steps: + - name: Release Please + uses: google-github-actions/release-please-action@v3 + id: release + with: + release-type: python + package-name: gTTS + + # Only do the rest (package build/push) if a release was created + - name: Checkout + if: ${{ steps.release.outputs.release_created }} + uses: actions/checkout@v3 + - name: Setup Python + if: ${{ steps.release.outputs.release_created }} + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Install build dependencies + if: ${{ steps.release.outputs.release_created }} + run: | + pip install --upgrade pip + pip install build + - name: Build package + if: ${{ steps.release.outputs.release_created }} + run: python -m build + - name: Publish package + if: ${{ steps.release.outputs.release_created }} + uses: pypa/gh-action-pypi-publish@37f50c210e3d2f9450da2cd423303d6a14a6e29f + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} + +# References: +# * Release Please: +# https://github.com/googleapis/release-please +# * Release Please (GitHub Action) +# https://github.com/google-github-actions/release-please-action +# * Conventional Commits: +# https://www.conventionalcommits.org/ \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 91dc1262..b8e4dbad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,11 +1,9 @@ name: Tests + on: - push: - tags-ignore: - - 'v*' pull_request: branches: - - master + - main jobs: test: @@ -15,25 +13,26 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['2.x', 3.6, 3.7, 3.8, 3.9] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] os: [ubuntu-latest, macOS-latest, windows-latest] steps: - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 + - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install run: | python -m pip install --upgrade pip - pip install -e .[tests] + pip install .[tests] - name: Unit Tests - run: pytest -v -s gtts/ --cov=gtts --cov-config=setup.cfg --cov-report=xml + run: pytest -v --cov=gtts --cov-report=xml env: - TEST_LANGS: all + # TODO: Test all langs on release branch + TEST_LANGS: en - name: Upload Coverage Report uses: codecov/codecov-action@v3.1.0 diff --git a/.mypy.ini b/.mypy.ini deleted file mode 100644 index 976ba029..00000000 --- a/.mypy.ini +++ /dev/null @@ -1,2 +0,0 @@ -[mypy] -ignore_missing_imports = True diff --git a/.readthedocs.yml b/.readthedocs.yml index 2ef2db6c..a94e857f 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,9 +1,7 @@ -# Build PDF as extra -formats: - - pdf - +version: 2 python: - version: 3.7 - pip_install: true - extra_requirements: - - docs + install: + - method: pip + path: . + extra_requirements: + - docs \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 944cfd3a..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,5 +0,0 @@ -include README.md -include CHANGELOG.rst -include CONTRIBUTING.rst -include LICENSE -include pytest.ini diff --git a/news/.gitignore b/news/.gitignore deleted file mode 100644 index f935021a..00000000 --- a/news/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!.gitignore diff --git a/pyproject.toml b/pyproject.toml index 419c9c24..2613cffd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,89 @@ +[project] +name = "gTTS" +description = "gTTS (Google Text-to-Speech), a Python library and CLI tool to interface with Google Translate text-to-speech API" +authors = [{name = "Pierre Nicolas Durette", email = "pndurette@gmail.com"}] +requires-python = ">=3.7" +readme = "README.md" +license = {text = "MIT"} +keywords = [ + "gtts", + "text to speech", + "Google Translate", + "TTS", +] +classifiers = [ + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: MacOS", + "Operating System :: Unix", + "Operating System :: POSIX", + "Operating System :: POSIX :: Linux", + "Operating System :: Microsoft :: Windows", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Software Development :: Libraries", + "Topic :: Multimedia :: Sound/Audio :: Speech", +] +dependencies = [ + "requests ~= 2.28.0", + "click ~= 8.1.3", + "six ~= 1.16.0" +] +dynamic = ["version"] + +[project.optional-dependencies] +tests = [ + "pytest ~= 7.1.3", + "pytest-cov", + "testfixtures", + "mock" +] +docs = [ + "sphinx", + "sphinx-autobuild", + "sphinx_rtd_theme", + "sphinx-click" +] + +[project.scripts] +gtts-cli = "gtts.cli:tts_cli" + +[project.urls] +homepage = "https://github.com/pndurette/gTTS" +documentation = "https://gtts.readthedocs.io" +repository = "https://github.com/pndurette/gTTS" +changelog = "https://github.com/pndurette/gTTS/blob/main/CHANGELOG.rst" + +[tool.setuptools.dynamic] +version = {attr = "gtts.version.__version__"} + +[tool.setuptools.packages.find] +#where = ["src"] # list of folders that contain the packages (["."] by default) +#include = ["my_package*"] # package names should match these glob patterns (["*"] by default) +#exclude = ["my_package.tests*"] # exclude packages matching these glob patterns (empty by default) +namespaces = false # to disable scanning PEP 420 namespaces (true by default) + +[tool.coverage.run] +omit = [ + "gtts/tests/*", + "gtts/tokenizer/tests/*", +] + +[tool.coverage.report] +exclude_lines = [ + "pragma: no cover", + "def __repr__", + "log.debug", + "log.warning", +] + +[tool.pytest.ini_options] +markers = ["net: marks tests that call use the net (using the URL endpoint, deselect with '-m \"not net\"')"] + [build-system] -requires = ["setuptools", "wheel"] - -[tool.towncrier] -package = "gtts" -filename = "CHANGELOG.rst" -directory = "news/" -underlines = ["-", "~", "_"] -title_format = "{version} ({project_date})" -issue_format = "`#{issue} `_" +requires = ["setuptools>=61", "wheel"] +build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 16556429..00000000 --- a/pytest.ini +++ /dev/null @@ -1,5 +0,0 @@ -[pytest] -maxversion = 4.6.11 - -markers = - net: marks tests that call use the net (using the URL endpoint, deselect with '-m "not net"') diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index c0d7c5bb..00000000 --- a/setup.cfg +++ /dev/null @@ -1,78 +0,0 @@ -[metadata] -name = gTTS -description = gTTS (Google Text-to-Speech), a Python library and CLI tool to interface with Google Translate text-to-speech API -author = Pierre Nicolas Durette -author_email = pndurette@gmail.com -url = https://github.com/pndurette/gTTS -license = MIT -keywords = - gtts - text to speech - Google Translate - TTS -classifiers = - Environment :: Console - Intended Audience :: Developers - License :: OSI Approved :: MIT License - Operating System :: MacOS - Operating System :: Unix - Operating System :: POSIX - Operating System :: POSIX :: Linux - Operating System :: Microsoft :: Windows - Programming Language :: Python :: 2.7 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Topic :: Software Development :: Libraries - Topic :: Multimedia :: Sound/Audio :: Speech -license_file = LICENSE -long_description = file: README.md -long_description_content_type = text/markdown - -[options] -python_requires = >= 2.7 -include_package_data = True -packages = find: -install_requires = - six - click - requests - -[options.extras_require] -tests = - pytest == 4.6.11 - pytest-cov - flake8 - testfixtures - mock - six -docs = - sphinx - sphinx-autobuild - sphinx_rtd_theme - sphinx-click - towncrier - -[options.entry_points] -console_scripts = - gtts-cli = gtts.cli:tts_cli - -[flake8] -max-line-length = 132 -exclude = .git,__pycache__,.eggs/,doc/,docs/,build/,dist/,archive/ -ignore = W605, W503, W504 - -[coverage:run] -cover_pylib = false -omit = - */site-packages/* - gtts/tests/* - gtts/tokenizer/tests/* - -[coverage:report] -exclude_lines = - pragma: no cover - def __repr__ - log.debug - log.warning diff --git a/setup.py b/setup.py deleted file mode 100644 index fc2f61fa..00000000 --- a/setup.py +++ /dev/null @@ -1,13 +0,0 @@ -from setuptools import setup -from codecs import open -import site - -# PEP517 -site.ENABLE_USER_SITE = True - -exec(open('gtts/version.py').read()) - -setup( - version=__version__, # type: ignore # noqa: F821 - test_suite='gtts.tests', -)