diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..201c1cf --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: ogarcia diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..28bad63 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,28 @@ +name: Upload Python Package + +on: + release: + types: [created] + +jobs: + deploy: + name: Upload to PyPi + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install build and publish dependencies + run: | + python -m pip install --upgrade pip + pip install build twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python -m build --sdist --no-isolation + twine upload dist/* diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 1085ca8..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,8 +0,0 @@ -# Include the license file -include LICENSE - -# Include the requirements file -include requirements.txt - -# Include the sample config file -include sysdweb.conf diff --git a/README.md b/README.md index 0c6b4f5..d28ca1a 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,7 @@ git clone https://github.com/ogarcia/sysdweb.git virtualenv3 ./sysdweb-venv source ./sysdweb-venv/bin/activate cd sysdweb -pip install -r requirements.txt -python setup.py install +pip install . ``` ### From pypi @@ -45,7 +44,7 @@ Once you have configured sysdweb, simply run. sysdweb ``` -By default sysdweb listen in 10080 port to 127.0.0.1, you can change listen +By default sysdweb listen in 10088 port to 127.0.0.1, you can change listen port and address with `-p` and `-l` or via environment variables. ```sh @@ -113,17 +112,17 @@ file of `` unit. You can specify the number of lines by this way. /api/v1//journal/200 ``` -In the example defined above all valid enpoins are. +In the example defined above all valid endpoints are. ``` -http://127.0.0.1:10080/api/v1/ngx/start -http://127.0.0.1:10080/api/v1/ngx/stop -http://127.0.0.1:10080/api/v1/ngx/restart -http://127.0.0.1:10080/api/v1/ngx/reload -http://127.0.0.1:10080/api/v1/ngx/reloadorrestart -http://127.0.0.1:10080/api/v1/ngx/status -http://127.0.0.1:10080/api/v1/ngx/journal -http://127.0.0.1:10080/api/v1/ngx/journal/ +http://127.0.0.1:10088/api/v1/ngx/start +http://127.0.0.1:10088/api/v1/ngx/stop +http://127.0.0.1:10088/api/v1/ngx/restart +http://127.0.0.1:10088/api/v1/ngx/reload +http://127.0.0.1:10088/api/v1/ngx/reloadorrestart +http://127.0.0.1:10088/api/v1/ngx/status +http://127.0.0.1:10088/api/v1/ngx/journal +http://127.0.0.1:10088/api/v1/ngx/journal/ ``` [1]: https://aur.archlinux.org/packages/sysdweb/ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..5f819c7 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,55 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "sysdweb" +version = "1.1.5" +description = "Control systemd services through Web or REST API" +readme = "README.md" +requires-python = ">=3.10" +license = {file = "LICENSE"} +keywords = ["REST API", "systemd"] +authors = [ + {name = "Óscar García Amor", email = "ogarcia@connectical.com"} +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Framework :: Bottle", + "Intended Audience :: End Users/Desktop", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Natural Language :: English", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3", + "Topic :: System", + "Topic :: Utilities" +] +dependencies = [ + "bottle ~= 0.12.25", + "dbus-python ~= 1.3.2", + "python-pam ~= 2.0.2", + "systemd-python" +] + +[tool.setuptools.packages.find] +include = ["sysdweb*"] + +[tool.setuptools.package-data] +"*" = [ + "sysdweb.conf" +] +sysdweb = [ + "templates/static/css/*", + "templates/static/img/*", + "templates/static/js/*", + "templates/views/*" +] + +[project.scripts] +sysdweb = "sysdweb.main:main" + +[project.urls] +"Bug Reports" = "https://github.com/ogarcia/sysdweb/issues" +"Source" = "https://github.com/ogarcia/sysdweb" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index d1e259c..0000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -bottle >= 0.12.10 -dbus-python -python-pam -systemd-python diff --git a/sysdweb.py b/run.py similarity index 75% rename from sysdweb.py rename to run.py index 2db37d8..3bd2a90 100755 --- a/sysdweb.py +++ b/run.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # vim:fenc=utf-8 # -# Copyright © 2016-2018 Óscar García Amor +# Copyright © 2016-2023 Óscar García Amor # # Distributed under terms of the GNU GPLv3 license. diff --git a/setup.py b/setup.py deleted file mode 100644 index d85067d..0000000 --- a/setup.py +++ /dev/null @@ -1,65 +0,0 @@ -#! /usr/bin/env python -# -*- coding: utf-8 -*- -# vim:fenc=utf-8 -# -# Copyright © 2016-2018 Óscar García Amor -# -# Distributed under terms of the GNU GPLv3 license. - -import sysdweb as project - -import os -from setuptools import find_packages -from setuptools import setup - -# Utility function to read the README file. -# Used for the long_description. It's nice, because now 1) we have a top level -# README file and 2) it's easier to type in the README file than to put a raw -# string in below ... -def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() - -setup( - name = project.NAME, - version = project.VERSION, - author = project.AUTHOR_NAME, - author_email = project.AUTHOR_EMAIL, - description = project.DESCRIPTION, - license = project.LICENSE, - keywords = project.KEYWORDS, - url = project.URL, - long_description=read('README.md'), - long_description_content_type='text/markdown', - packages=find_packages(), - install_requires=read('requirements.txt'), - package_data={'sysdweb': [ - 'templates/static/css/*', - 'templates/static/fonts/*', - 'templates/static/img/*', - 'templates/static/js/*', - 'templates/views/*' - ] - }, - entry_points={ - 'console_scripts': [ - 'sysdweb = sysdweb.main:main' - ] - }, - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Web Environment', - 'Framework :: Bottle', - 'Intended Audience :: End Users/Desktop', - 'Intended Audience :: System Administrators', - 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', - 'Natural Language :: English', - 'Operating System :: POSIX :: Linux', - 'Programming Language :: Python :: 3', - 'Topic :: System', - 'Topic :: Utilities', - ], - project_urls={ - 'Bug Reports': 'https://github.com/ogarcia/sysdweb/issues', - 'Source': 'https://github.com/ogarcia/sysdweb', - }, -) diff --git a/sysdweb.conf b/sysdweb.conf index d757b99..5efd0ae 100644 --- a/sysdweb.conf +++ b/sysdweb.conf @@ -4,7 +4,7 @@ # # Entries consist of: # - [label]. It maches with URL /api/v1/