From 7998ecb011041abf131c5f16a5f12e010fb2c9d1 Mon Sep 17 00:00:00 2001 From: Zaharia Constantin <1303303+soulraven@users.noreply.github.com> Date: Thu, 6 Jun 2024 11:18:56 +0300 Subject: [PATCH] add poetry config and minimal config for poetry --- .flake8 | 5 ++ .github/workflows/ci-cd.yml | 18 ++++ .python-version | 1 + README.md | 27 +++--- poetry.lock | 7 ++ pyproject.toml | 114 ++++++++++++++++++++++++ setup.py | 5 +- {sgzenity => src/sgzenity}/__init__.py | 0 {sgzenity => src/sgzenity}/sgszenity.py | 0 tox.ini | 18 ++++ 10 files changed, 178 insertions(+), 17 deletions(-) create mode 100644 .flake8 create mode 100644 .github/workflows/ci-cd.yml create mode 100644 .python-version create mode 100644 poetry.lock create mode 100644 pyproject.toml rename {sgzenity => src/sgzenity}/__init__.py (100%) rename {sgzenity => src/sgzenity}/sgszenity.py (100%) create mode 100644 tox.ini diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..4c2f7ec --- /dev/null +++ b/.flake8 @@ -0,0 +1,5 @@ +[flake8] +ignore = W503 +max-line-length = 88 +exclude = .git, .github, .eggs, __pycache__, build, dist, notebooks, .ipynb_checkpoints, logs +per-file-ignores = __init__.py:F401 diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml new file mode 100644 index 0000000..49cd9b0 --- /dev/null +++ b/.github/workflows/ci-cd.yml @@ -0,0 +1,18 @@ +name: Upload Python Package +on: + release: [published] +permissions: + contents: read +jobs: + pypi-publish: + name: Upload release to PyPI + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/ + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + steps: + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..c8cfe39 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.10 diff --git a/README.md b/README.md index efa4916..c7f4ac0 100644 --- a/README.md +++ b/README.md @@ -5,23 +5,19 @@ http://badge.fury.io/py/sgzenity :target: http://sgzenity.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status -SGZenity -****** +# SGZenity -SGZenity is a library for python which was inspired by Zenity. When you write -scripts, -you can use SGZenity to create simple dialogs that interact graphically with the -user. +SGZenity is a library for python which was inspired by Zenity. -Requirements -============ +When you write scripts, you can use SGZenity to create simple dialogs that interact graphically with the user. + +## Requirements * Python 3 * GTK+4 * python3-gi -Installation -============ +## Installation Install using pip : @@ -37,14 +33,14 @@ $ cd ./sgzenity $ python setup.py install ``` -Example -======= +## Example Simple dialog: ```python -from sgzenity import calendar -result = calendar(title="Awesome Calendar",text="Your birthday ?") +from src.sgzenity import calendar + +result = calendar(title="Awesome Calendar", text="Your birthday ?") print(result) ``` This code show a calendar dialog : @@ -59,8 +55,7 @@ $ python test.py $ (year=2017, month=6, day=4) ``` -API -=== +## API ```python sgzenity.sgzenity.message(title='', text='', width=330, height=120, timeout=None) diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..a9b0222 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +package = [] + +[metadata] +lock-version = "2.0" +python-versions = "^3.10" +content-hash = "53f2eabc9c26446fbcc00d348c47878e118afc2054778c3c803a0a8028af27d9" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..fd30e1f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,114 @@ +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry] +name = "sgzenity" +version = "0.1.0" +description = "sgzentry is a library for python which was inspired by Zenity. When you write scripts, you can use sgzentry to create simple dialogs that interact graphically with the user." +homepage="https://github.com/SoftGeekRO/sgzenity" +repository="https://github.com/SoftGeekRO/sgzenity.git" +documentation="https://github.com/SoftGeekRO/sgzenity/blob/main/README.md" +authors = [ + "Zaharia Constantin " +] +maintainers = [] +license = "GPL-3.0-or-later" +readme = "README.md" +keywords=[ + 'zenity', + 'python3', + 'poetry', + 'dialog', + 'GTK+3' +] +classifiers=[ + "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", + "Operating System :: OS Independent", + "Topic :: Software Development :: Libraries", + "Topic :: Software Development :: Libraries :: Python Modules", + "Programming Language :: Python", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14" +] +packages=[ + { include="sgzenity", from="src" } +] +include=[ + "CHANGELOG.md" +] + +[tool.poetry.dependencies] +python = ">=3.10,<4.0" +watchdog = ">=4.0.0; python_version >= 3.10" +colorama = ">=0.4.6; python_version >= 3.10" +slugify = "^0.0.1" +PyGObject = "^3.48.2" + +[tool.poetry.dev-dependencies] +isort = "^5.13.2" +black = "^24.4.2" +pytest = "^8.2.2" +pytest-cookies = "^0.7.0" +tox = "^4.15.1" +toml = "^0.10.2" +coverage = "^7.5.3" + +[tool.poetry.extras] +lint = ["black", "isort"] +test = ["pytest", "pytest-cookies", "tox"] + +[tool.poetry.plugins] + +[tool.poetry.scripts] + +[tool.poetry.urls] +"Source" = "https://github.com/soulraven/roundbox" +"Issues" = "https://github.com/soulraven/roundbox/issues" +"Discussions" = "https://github.com/soulraven/roundbox/discussions" +"Documentation" = "https://soulraven.github.io/roundbox/" +"Releases" = "https://soulraven.github.io/roundbox/releases" + +[tool.black] +line_length = 88 +target_version = ['py310'] +skip-string-normalization = true +include = '\.pyi?$' +exclude = ''' +( + /( + \.eggs # exclude a few common directories in the + | \.git # root of the project + | \.github + | \.hg + | \.mypy_cache + | \.tox + | \.venv + | \notebooks + | .ipynb_checkpoints + | __pycache__ + | data + | logs + | _build + | buck-out + | build + | dist + | snapshots + )/ +) +''' + +[tool.isort] +py_version = 310 +profile = "black" + +[tool.flake8] +ignore = ['E231', 'E241'] +per-file-ignores = [ + '__init__.py:F401', +] +max-line-length = 88 +count = true diff --git a/setup.py b/setup.py index cba602b..ee0323a 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,10 @@ url='https://github.com/SoftGeekRO/sgzenity.git', author='SoulRaven', author_email='constantin.zaharia@sgsolar.ro', - license='GPLv3', + license="LICENSE.md", + readme="README.md", + repository="https://github.com/soulraven/roundbox", + documentation="https://soulraven.github.io/roundbox/", packages=['sgszenity'], zip_safe=False ) diff --git a/sgzenity/__init__.py b/src/sgzenity/__init__.py similarity index 100% rename from sgzenity/__init__.py rename to src/sgzenity/__init__.py diff --git a/sgzenity/sgszenity.py b/src/sgzenity/sgszenity.py similarity index 100% rename from sgzenity/sgszenity.py rename to src/sgzenity/sgszenity.py diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..1a967d6 --- /dev/null +++ b/tox.ini @@ -0,0 +1,18 @@ +[tox] +skipsdist = true +envlist = py310 + +[gh-actions] +python = + 3.10: py310 + +[testenv] +passenv = PYTHON_VERSION +whitelist_externals = poetry +commands = + poetry install -v + pytest --doctest-modules tests + +[isort] +profile = black +multi_line_output = 3