Use poetry instead of setup.py

This commit is contained in:
Sumner Evans
2020-10-15 00:16:05 -06:00
parent e0b4cfeed1
commit b61acffa0d
8 changed files with 42 additions and 99 deletions

View File

@@ -24,7 +24,7 @@ tasks:
echo "source $(poetry env info -p)/bin/activate" >> ~/.buildenv echo "source $(poetry env info -p)/bin/activate" >> ~/.buildenv
- lint: | - lint: |
python setup.py check -mrs poetry check
black --check . black --check .
flake8 flake8
mypy sublime_music tests/**/*.py mypy sublime_music tests/**/*.py
@@ -36,7 +36,7 @@ tasks:
pytest pytest
- build: | - build: |
python setup.py sdist poetry build
# TODO migrate deploy to sr.ht # TODO migrate deploy to sr.ht
# - deploy-pypi: | # - deploy-pypi: |

1
.envrc
View File

@@ -11,7 +11,6 @@ source .venv/bin/activate
watch_file pyproject.toml watch_file pyproject.toml
watch_file poetry.lock watch_file poetry.lock
watch_file setup.py
watch_file shell.nix watch_file shell.nix
unset PS1 unset PS1

View File

@@ -22,7 +22,7 @@ lint:
before_script: before_script:
- ./cicd/install-project-deps.sh - ./cicd/install-project-deps.sh
script: script:
- poetry run python setup.py check -mrs - poetry check
- poetry run black --check . - poetry run black --check .
- poetry run flake8 - poetry run flake8
- poetry run mypy sublime_music tests/**/*.py - poetry run mypy sublime_music tests/**/*.py
@@ -47,7 +47,7 @@ build:
before_script: before_script:
- ./cicd/install-project-deps.sh - ./cicd/install-project-deps.sh
script: script:
- poetry run python setup.py sdist - poetry build
artifacts: artifacts:
paths: paths:
- dist/* - dist/*

View File

@@ -1,3 +1,12 @@
v0.11.11-devel
==============
**Infrastructure**
* Convert entirely over to ``poetry`` from ``setuptools`` for building.
* Add a custom check to ensure that the version in ``pyproject.toml`` matches
with the other instances of the version.
v0.11.10 v0.11.10
======== ========

View File

@@ -61,9 +61,19 @@ with open(Path("sublime_music/__init__.py")) as f:
if line.startswith("__version__"): if line.startswith("__version__"):
version = eval(line.split()[-1]) version = eval(line.split()[-1])
break break
else: # nobreak
raise AssertionError("No version in sublime_music/__init__.py")
with open(Path("pyproject.toml")) as f:
for line in f:
if line.startswith("version ="):
assert eval(line.split()[-1]) == version, "Version mismatch: pyproject.toml"
break
else: # nobreak
raise AssertionError("No version in pyproject.toml")
with open(Path("CHANGELOG.rst")) as f: with open(Path("CHANGELOG.rst")) as f:
assert f.readline().strip() == f"v{version}", "Version mismatch" assert f.readline().strip() == f"v{version}", "Version mismatch: CHANGELOG"
sys.exit(0 if valid else 1) sys.exit(0 if valid else 1)

View File

@@ -1,28 +1,32 @@
[tool.poetry] [tool.poetry]
name = "sublime_music" name = "sublime_music"
version = "0.11.10" version = "0.11.11-devel"
description = "A native GTK *sonic client." description = "A native GTK *sonic client."
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"
authors = ["Sumner Evans <inquiries@sumnerevans.com>"] authors = ["Sumner Evans <inquiries@sumnerevans.com>"]
readme = "README.rst" readme = "README.rst"
homepage = "https://sublimemusic.app" homepage = "https://sublimemusic.app"
repository = "https://sr.ht/~sumner/sublime-music" repository = "https://gitlab.com/sublime-music/sublime-music"
documentation = "https://sublime-music.gitlab.io/sublime-music/" documentation = "https://sublime-music.gitlab.io/sublime-music"
keywords = ["airsonic", "music", "chromecast", "subsonic"] keywords = ["airsonic", "music", "GTK", "chromecast", "subsonic"]
classifiers = [ classifiers = [
# 3 - Alpha # 3 - Alpha
# 4 - Beta # 4 - Beta
# 5 - Production/Stable # 5 - Production/Stable
"Development Status :: 3 - Alpha", "Development Status :: 4 - Beta",
"Environment :: X11 Applications :: GTK",
"Intended Audience :: End Users/Desktop", "Intended Audience :: End Users/Desktop",
"Operating System :: POSIX", "Operating System :: POSIX",
"Topic :: Multimedia :: Sound/Audio :: Players",
] ]
# TODO exclude = [
exclude = ["tests"] "tests",
"sublime_music/adapters/subsonic/api_specs"
]
[tool.poetry.urls] [tool.poetry.urls]
"Bug Tracker" = "https://todo.sr.ht/~sumner/sublime-music" "Bug Tracker" = "https://gitlab.com/sublime-music/sublime-music/-/issues"
[tool.poetry.scripts] [tool.poetry.scripts]
sublime-music = 'sublime_music.__main__:main' sublime-music = 'sublime_music.__main__:main'
@@ -30,19 +34,19 @@ sublime-music = 'sublime_music.__main__:main'
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.8" python = "^3.8"
bleach = "^3.2.1" bleach = "^3.2.1"
bottle = {version = "^0.12.18", optional = true}
dataclasses-json = "^0.5.2" dataclasses-json = "^0.5.2"
deepdiff = "^5.0.2" deepdiff = "^5.0.2"
fuzzywuzzy = "^0.18.0" fuzzywuzzy = "^0.18.0"
keyring = {version = "^21.4.0", optional = true}
peewee = "^3.13.3" peewee = "^3.13.3"
pychromecast = {version = "^7.3.0", optional = true}
PyGObject = "^3.38.0" PyGObject = "^3.38.0"
python-dateutil = "^2.8.1" python-dateutil = "^2.8.1"
python-Levenshtein = "^0.12.0" python-Levenshtein = "^0.12.0"
python-mpv = "^0.5.2" python-mpv = "^0.5.2"
requests = "^2.24.0" requests = "^2.24.0"
semver = "^2.10.2" semver = "^2.10.2"
bottle = {version = "^0.12.18", optional = true}
keyring = {version = "^21.4.0", optional = true}
pychromecast = {version = "^7.3.0", optional = true}
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
black = "^20.8b1" black = "^20.8b1"
@@ -56,11 +60,11 @@ flake8-pep3101 = "^1.3.0"
flake8-print = "^3.1.4" flake8-print = "^3.1.4"
mypy = "^0.782" mypy = "^0.782"
pytest-cov = "^2.10.1" pytest-cov = "^2.10.1"
termcolor = "^1.1.0"
requirements-parser = "^0.2.0" requirements-parser = "^0.2.0"
rst2html5 = "^1.10.6"
sphinx = "^3.2.1" sphinx = "^3.2.1"
sphinx_rtd_theme = "^0.5.0" sphinx_rtd_theme = "^0.5.0"
rst2html5 = "^1.10.6" termcolor = "^1.1.0"
[tool.poetry.extras] [tool.poetry.extras]
chromecast = ["pychromecast"] chromecast = ["pychromecast"]

View File

@@ -1,79 +0,0 @@
from pathlib import Path
from setuptools import find_packages, setup
here = Path(__file__).parent.resolve()
with open(here.joinpath("README.rst"), encoding="utf-8") as f:
long_description = f.read()
# Find the version
with open(here.joinpath("sublime_music", "__init__.py")) as f:
for line in f:
if line.startswith("__version__"):
version = eval(line.split()[-1])
break
package_data_dirs = [
here.joinpath("sublime_music", "adapters", "icons"),
here.joinpath("sublime_music", "adapters", "images"),
here.joinpath("sublime_music", "adapters", "subsonic", "icons"),
here.joinpath("sublime_music", "dbus", "mpris_specs"),
here.joinpath("sublime_music", "ui", "icons"),
here.joinpath("sublime_music", "ui", "images"),
]
package_data_files = []
for data_dir in package_data_dirs:
for file in data_dir.iterdir():
package_data_files.append(str(file))
setup(
name="sublime_music",
version=version,
url="https://gitlab.com/sublime-music/sublime-music",
description="A native GTK *sonic client.",
long_description=long_description,
author="Sumner Evans",
author_email="inquiries@sumnerevans.com",
license="GPL3",
classifiers=[
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
"Development Status :: 3 - Alpha",
# Indicate who your project is intended for
"Intended Audience :: End Users/Desktop",
"Operating System :: POSIX",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
"Programming Language :: Python :: 3.8",
],
keywords="airsonic subsonic libresonic gonic music",
packages=find_packages(exclude=["tests"]),
package_data={"sublime_music": ["ui/app_styles.css", *package_data_files]},
install_requires=[
"bleach",
"dataclasses-json",
"deepdiff",
"fuzzywuzzy",
'osxmmkeys ; sys_platform=="darwin"',
"peewee",
"PyGObject",
"python-dateutil",
"python-Levenshtein",
"python-mpv",
"requests",
"semver",
],
extras_require={
"keyring": ["keyring"],
"chromecast": ["pychromecast"],
"server": ["bottle"],
},
# To provide executable scripts, use entry points in preference to the
# "scripts" keyword. Entry points provide cross-platform support and
# allow pip to create the appropriate form of executable for the target
# platform.
entry_points={"console_scripts": ["sublime-music=sublime_music.__main__:main"]},
)

View File

@@ -1 +1 @@
__version__ = "0.11.10" __version__ = "0.11.11-devel"