Skip to content

Commit 37ca70d

Browse files
authored
v3.0.3 (#134)
* feat: dynamically retrieve package version from metadata with fallback to hardcoded string * refactor: remove redundant global declarations and update development dependencies * version 3.0.3 * test: implement comprehensive test suite and Docker-based cross-version CI pipeline * chore: add --verbose flag to twine upload command in deploy target
1 parent 73439fb commit 37ca70d

17 files changed

Lines changed: 208 additions & 19 deletions

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.git
2+
venv
3+
.venv
4+
__pycache__
5+
*.pyc
6+
.pytest_cache
7+
*.egg-info
8+
build
9+
dist
10+
.mypy_cache

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ deploy.sh
133133

134134
pylint.txt
135135
.gitpod.yml
136-
tests/
137-
tests/
136+
138137

139138
*.mp3
140139
cache.sqlite

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ dist: clean
3333
${PYTHON} setup.py sdist bdist_wheel
3434

3535
deploy: dist
36-
twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
36+
twine upload --repository-url https://upload.pypi.org/legacy/ dist/* --verbose
3737

3838
test-deploy: dist
3939
@echo "Sending to testpypi server......."

docker/Dockerfile.test

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Multi-Python CI image: build with --build-arg PYTHON_VERSION=3.11
2+
ARG PYTHON_VERSION=3.11
3+
FROM python:${PYTHON_VERSION}-slim-bookworm
4+
5+
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
6+
PYTHONDONTWRITEBYTECODE=1 \
7+
PYTHONUNBUFFERED=1
8+
9+
WORKDIR /app
10+
11+
# Some dependencies may need a compiler when wheels are missing
12+
RUN apt-get update \
13+
&& apt-get install -y --no-install-recommends gcc make \
14+
&& rm -rf /var/lib/apt/lists/*
15+
16+
COPY requirements.txt requirements-dev.txt setup.py README.md Makefile configure.py features.conf ./
17+
COPY radioactive ./radioactive
18+
19+
RUN pip install --upgrade pip setuptools wheel \
20+
&& pip install -r requirements.txt -r requirements-dev.txt \
21+
&& pip install -e .
22+
23+
COPY pytest.ini ./
24+
COPY tests ./tests
25+
26+
CMD ["pytest", "-v", "tests/"]

pytest.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[pytest]
2+
testpaths = tests
3+
python_files = test_*.py
4+
addopts = -ra

radioactive/__main__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,6 @@ def main():
479479

480480

481481
def signal_handler(sig, frame):
482-
global ffplay
483-
global player
484482
log.debug("You pressed Ctrl+C!")
485483
log.debug("Stopping the radio")
486484
if ffplay and ffplay.is_playing:

radioactive/app.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
"""
2-
Version of the current program, (in development mode
3-
it needs to be updated in every release)
4-
and to check if an updated version available for the app or not
2+
Version of the current program, (in development mode
3+
it needs to be updated in every release)
4+
and to check if an updated version available for the app or not
55
"""
66

77
import json
8+
import sys
9+
10+
if sys.version_info >= (3, 8):
11+
from importlib import metadata
12+
else:
13+
import importlib_metadata as metadata
814

915

1016
class App:
1117
def __init__(self):
12-
self.__VERSION__ = "3.0.2" # change this on every update #
18+
try:
19+
self.__VERSION__ = metadata.version("radio-active")
20+
except metadata.PackageNotFoundError:
21+
self.__VERSION__ = "3.0.3" # change this on every update #
1322
self.pypi_api = "https://pypi.org/pypi/radio-active/json"
1423
self.remote_version = ""
1524

radioactive/handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
This handler solely depends on pyradios module to communicate with our remote API
2+
This handler solely depends on pyradios module to communicate with our remote API
33
"""
44

55
import datetime

radioactive/last_station.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
""" This module saves the current playing station information to a hidden file,
2-
and loads the data when no arguments are provide """
1+
"""This module saves the current playing station information to a hidden file,
2+
and loads the data when no arguments are provide"""
33

44
import json
5-
import os.path
65

76
from zenlog import log
87

radioactive/ui.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ def handle_history_table(history) -> None:
111111
def handle_show_station_info() -> None:
112112
"""Show important information regarding the current station."""
113113
# pylint: disable=global-statement
114-
global global_current_station_info
115114
custom_info = {}
116115
try:
117116
custom_info["name"] = global_current_station_info.get("name")
@@ -150,5 +149,4 @@ def set_global_station_info(info: dict) -> None:
150149

151150
def get_global_station_info() -> dict:
152151
"""Helper to get global station info."""
153-
global global_current_station_info
154152
return global_current_station_info

0 commit comments

Comments
 (0)