install as a pip package

This commit is contained in:
dries.k
2022-03-21 18:58:59 +01:00
parent 311f40643e
commit 8186121508
9 changed files with 121 additions and 17 deletions

1
.gitignore vendored
View File

@@ -1,6 +1,7 @@
.idea
.vscode
__pycache__
*.egg-info
build
dist
inno-output

3
MANIFEST.in Normal file
View File

@@ -0,0 +1,3 @@
include README.md version.txt
include gotifytray/gui/images/*.png
include gotifytray/gui/images/*.svg

View File

@@ -34,9 +34,26 @@ $ pip install -r requirements.txt
### Run from source
```
$ python entry_point.py
$ python -m gotify_tray
```
### Create and install a pip package
- Create the pip package:
```
$ python -m build
```
- Install the pip package:
```
$ pip install dist/gotify_tray-0.1.3-py3-none-any.whl
```
- Launch:
```
$ gotify-tray
```
### Create a pyinstaller executable
```
@@ -45,6 +62,13 @@ $ pyinstaller gotify-tray.spec
```
An executable is created at `dist/gotify-tray/`.
### Inno setup (Windows)
Create an installer for windows with inno setup from pyinstaller output:
```
$ iscc gotify-tray.iss
```
### Create a deb package
@@ -56,15 +80,6 @@ $ make build
$ sudo make install
```
### (Inno setup (Windows))
Create an installer for windows with inno setup:
```
$ iscc gotify-tray.iss
```
## Images
Windows 10 | KDE
@@ -75,7 +90,7 @@ Windows 10 | KDE
## Requirements
- python 3.9
- python >=3.9
- PyQt6
- requests
- websocket-client

View File

@@ -1,5 +0,0 @@
from gotify_tray import start_gui
if __name__ == "__main__":
start_gui()

View File

@@ -2,7 +2,7 @@
block_cipher = None
a = Analysis(['entry_point.py'],
a = Analysis(['gotify_tray/__main__.py'],
pathex=[os.getcwd()],
binaries=[],
datas=[('gotify_tray/gui/images', 'gotify_tray/gui/images')],

3
gotify_tray/__main__.py Normal file
View File

@@ -0,0 +1,3 @@
from gotify_tray.gui import start_gui
start_gui()

View File

View File

87
setup.py Normal file
View File

@@ -0,0 +1,87 @@
import io
import os
from setuptools import find_packages, setup
# Package meta-data.
NAME = 'gotify-tray'
DESCRIPTION = 'A tray notification application for receiving messages from a Gotify server.'
URL = 'https://github.com/seird/gotify-tray'
EMAIL = "k.dries@protonmail.com"
REQUIRES_PYTHON = '>=3.9.0'
with open("version.txt", "r") as f:
VERSION = f.read()
# What packages are required for this module to be executed?
REQUIRED = [
'requests', 'PyQt6', 'websocket-client'
]
# What packages are optional?
EXTRAS = {
# 'socks5 proxy': ['pysocks'],
}
# The rest you shouldn't have to touch too much :)
# ------------------------------------------------
# Except, perhaps the License and Trove Classifiers!
# If you do change the License, remember to change the Trove Classifier for that!
here = os.path.abspath(os.path.dirname(__file__))
# Import the README and use it as the long-description.
# Note: this will only work if 'README.md' is present in your MANIFEST.in file!
try:
with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = '\n' + f.read()
except FileNotFoundError:
long_description = DESCRIPTION
# Load the package's __version__.py module as a dictionary.
about = {}
if not VERSION:
project_slug = NAME.lower().replace("-", "_").replace(" ", "_")
with open(os.path.join(here, project_slug, '__version__.py')) as f:
exec(f.read(), about)
else:
about['__version__'] = VERSION
# Where the magic happens:
setup(
name=NAME,
version=about['__version__'],
description=DESCRIPTION,
long_description=long_description,
long_description_content_type='text/markdown',
author=EMAIL,
author_email=EMAIL,
python_requires=REQUIRES_PYTHON,
url=URL,
# packages=find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"]),
# If your package is a single module, use this instead of 'packages':
packages=find_packages(),
package_data={
'gotify_tray.gui.images': ['*.svg', '*.png']
},
data_files = [
],
entry_points={
'console_scripts': ['gotify-tray=gotify_tray:start_gui'],
},
install_requires=REQUIRED,
extras_require=EXTRAS,
include_package_data=True,
license='GPLv3',
classifiers=[
# Trove classifiers
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10'
]
)