Merge pull request #106 from dmunozv04/publish-pypi

Publish on pypi
This commit is contained in:
David
2023-11-29 12:06:40 +01:00
committed by GitHub
22 changed files with 87 additions and 61 deletions

37
.github/workflows/release_pypi.yml vendored Normal file
View File

@@ -0,0 +1,37 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Upload Python Package
on:
release:
types: [published]
permissions:
contents: read
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build wheel
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1

View File

@@ -2,17 +2,18 @@
FROM python:3.11-alpine
ENV PIP_NO_CACHE_DIR=off iSPBTV_docker=True TERM=xterm-256color COLORTERM=truecolor
ENV PIP_NO_CACHE_DIR=off iSPBTV_docker=True iSPBTV_data_dir=data TERM=xterm-256color COLORTERM=truecolor
COPY requirements.txt .
RUN pip install --upgrade pip wheel && \
pip install -r requirements.txt
COPY requirements.txt .
WORKDIR /app
COPY . .
RUN python -m compileall
COPY src .
ENTRYPOINT ["python3", "-u", "main.py"]

View File

@@ -1,7 +0,0 @@
from iSponsorBlockTV import helpers
import sys
import os
if getattr(sys, "frozen", False):
os.environ["SSL_CERT_FILE"] = os.path.join(sys._MEIPASS, "lib", "cert.pem")
helpers.app_start()

View File

@@ -1,47 +0,0 @@
# -*- mode: python ; coding: utf-8 -*-
from PyInstaller.utils.hooks import exec_statement
cert_datas = exec_statement("""
import ssl
print(ssl.get_default_verify_paths().cafile)""").strip().split()
cert_datas = [(f, 'lib') for f in cert_datas]
block_cipher = None
options = [ ('u', None, 'OPTION') ]
a = Analysis(['main-macos.py'],
pathex=[],
binaries=[],
datas=cert_datas,
hiddenimports=['certifi'],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
options,
name='iSponsorBlockTV-macos',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None)

30
pyproject.toml Normal file
View File

@@ -0,0 +1,30 @@
[project]
name = "iSponsorBlockTV"
version = "2.0.3"
authors = [
{"name" = "dmunozv04"}
]
description = "SponsorBlock client for all YouTube TV clients"
readme = "README.md"
requires-python = ">=3.7"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
"Topic :: Home Automation"
]
dynamic = ["dependencies"]
[tool.hatch.metadata.hooks.requirements_txt]
files = ["requirements.txt"]
[project.urls]
"Homepage" = "https://github.com/dmunozv04/iSponsorBlockTV"
"Bug Tracker" = "https://github.com/dmunozv04/iSponsorBlockTV/issues"
[project.scripts]
"iSponsorBlockTV" = "iSponsorBlockTV.__main__:main"
[build-system]
requires = ["hatchling", "hatch-requirements-txt"]
build-backend = "hatchling.build"

View File

@@ -1,4 +1,5 @@
aiohttp==3.9.0
appdirs==1.4.4
argparse==1.4.0
async-cache==1.1.1
pyytlounge==1.6.3
@@ -6,5 +7,4 @@ rich==13.6.0
ssdp==1.3.0
textual==0.40.0
textual-slider==0.1.1
xmltodict==0.13.0
xmltodict==0.13.0

View File

@@ -0,0 +1,8 @@
from . import helpers
def main():
helpers.app_start()
if __name__ == "__main__":
main()

View File

@@ -5,6 +5,8 @@ import os
import sys
import time
from appdirs import user_data_dir
from . import config_setup, main, setup_wizard
@@ -102,8 +104,10 @@ class Config:
def app_start():
#If env has a data dir use that, otherwise use the default
default_data_dir = os.getenv("iSPBTV_data_dir") or user_data_dir("iSponsorBlockTV", "dmunozv04")
parser = argparse.ArgumentParser(description="iSponsorblockTV")
parser.add_argument("--data-dir", "-d", default="data", help="data directory")
parser.add_argument("--data-dir", "-d", default=default_data_dir, help="data directory")
parser.add_argument("--setup", "-s", action="store_true", help="setup the program graphically")
parser.add_argument("--setup-cli", "-sc", action="store_true", help="setup the program in the command line")
parser.add_argument("--debug", action="store_true", help="debug mode")

View File

@@ -146,4 +146,4 @@ def main(config, debug):
print("Keyboard interrupt detected, cancelling tasks and exiting...")
loop.run_until_complete(finish(devices))
finally:
loop.run_until_complete(web_session.close())
loop.run_until_complete(web_session.close())