From 107dba2a0f5f3c2d6e4f915c8ec8954c59221ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= Date: Wed, 23 Oct 2024 22:16:37 +0300 Subject: [PATCH] Overhauled packaging and testing --- .github/workflows/publish.yaml | 53 ++++++++++++++++++-------------- .github/workflows/test.yml | 28 +++++++++++++++++ MANIFEST.in | 29 ----------------- README.MD => README.md | 2 +- example/{README.MD => README.md} | 0 pyproject.toml | 48 +++++++++++++++++++++++++++++ requirements.txt | 8 ----- setup.py | 38 ----------------------- tkreload/__init__.py | 10 ++---- 9 files changed, 109 insertions(+), 107 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 MANIFEST.in rename README.MD => README.md (99%) rename example/{README.MD => README.md} (100%) create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100644 setup.py diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 8a8139f..b1bfe47 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -4,32 +4,39 @@ name: Publish Python Package on: push: tags: - - 'v*.*.*' + - "v[0-9]+.[0-9]+.[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+.post[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+[a-b][0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+" jobs: build: runs-on: ubuntu-latest - + environment: release steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build twine - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Install dependencies + run: pip install build + - name: Create packages + run: python -m build + - name: Archive packages + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist - - name: Build package - run: python -m build - - - name: Publish package to PyPI - env: - TWINE_USERNAME: "__token__" - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} - run: python -m twine upload dist/* + publish: + needs: build + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + steps: + - name: Retrieve packages + uses: actions/download-artifact@v4 + - name: Upload packages + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ed418f7 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,28 @@ +name: test suite + +on: + push: + branches: [main] + pull_request: + +jobs: + test: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + allow-prereleases: true + cache: pip + cache-dependency-path: pyproject.toml + - name: Install dependencies + run: pip install -e .[test] + - name: Test with pytest + run: pytest -v diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index e6b8ead..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,29 +0,0 @@ -# Include the license file -include LICENSE - -# Include the README file -include README.md - -# Include all Python source files -recursive-include src *.py - -# Include any additional data files your package might need -# recursive-include src/tkreload/data * - -# Exclude any compiled Python files -global-exclude *.pyc -global-exclude *.pyo -global-exclude __pycache__ - -# Exclude any development or temporary files -exclude .gitignore -exclude .travis.yml -exclude tox.ini -exclude .coveragerc -exclude .pylintrc - -# Exclude test directory -prune tests - -# Exclude any documentation source files (if you have a separate docs directory) -# prune docs diff --git a/README.MD b/README.md similarity index 99% rename from README.MD rename to README.md index a1fe46d..a9d9af5 100644 --- a/README.MD +++ b/README.md @@ -37,7 +37,7 @@ tkreload solves this issue by providing an automatic reload mechanism for termin # Getting Started ## Prerequisites -- Python 3.7+ +- Python 3.9+ - pip ## Installation diff --git a/example/README.MD b/example/README.md similarity index 100% rename from example/README.MD rename to example/README.md diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e35cfe9 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,48 @@ +[build-system] +requires = [ + "setuptools >= 64", + "setuptools_scm >= 6.4" +] +build-backend = "setuptools.build_meta" + +[project] +name = "tkreload" +description = "A library that auto reloads your tkinter app whenever file changes are detected." +readme = "README.md" +authors = [{name = "iamDyeus", email = "dyeusyt@gmail.com"}] +license = {text = "Apache License 2.0"} +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Topic :: Software Development :: Build Tools", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 3", +] +requires-python = ">=3.9" +dependencies = [ + "watchdog >= 5.0.3", + "rich >= 13.9.2" +] +dynamic = ["version"] + +[project.urls] +Documentation = "https://github.com/iamDyeus/tkreload/blob/main/README.md" +"Bug Tracker" = "https://github.com/iamDyeus/tkreload/issues" +"Source code" = "https://github.com/iamDyeus/tkreload" + +[project.optional-dependencies] +test = [ + "pytest >= 7", + "pytest-cov" +] + +[project.scripts] +tkreload = "kreload.main:main" + +[tool.setuptools.packages.find] +include = ["tkreload", "tkreload.*"] +namespaces = false + +[tool.setuptools_scm] +version_scheme = "post-release" +local_scheme = "dirty-tag" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index de0db4d..0000000 --- a/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -rich==13.9.2 -setuptools==75.2.0 -watchdog==5.0.3 -pytest==7.4.2 -pytest-cov==4.1.0 -setuptools==75.2.0 -twine==5.1.1 -wheel==0.44.0 \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 2b7bacb..0000000 --- a/setup.py +++ /dev/null @@ -1,38 +0,0 @@ -from setuptools import setup, find_packages - -setup( - name='tkreload', - version='1.0.0', - description='A library that auto reloads your tkinter app whenever file changes are detected.', - packages=find_packages(), - include_package_data=True, - long_description=open('README.md', 'r', encoding='utf-8').read(), - long_description_content_type='text/markdown', - author='iamDyeus', - author_email='dyeusyt@gmail.com', - url='https://github.com/iamDyeus/tkreload', - project_urls={ - 'Documentation': 'https://github.com/iamDyeus/tkreload/blob/main/README.md', - 'Bug Tracker': 'https://github.com/iamDyeus/tkreload/issues', - 'Source Code': 'https://github.com/iamDyeus/tkreload', - }, - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Topic :: Software Development :: Build Tools', - 'License :: OSI Approved :: Apache Software License', - 'Programming Language :: Python :: 3', - ], - keywords='tkinter auto reload python developer tool file-watcher development', - license='Apache Software License', - license_file='LICENSE', - install_requires=[ - 'watchdog', - 'rich' - ], - entry_points={ - 'console_scripts': [ - 'tkreload=tkreload.main:main', - ], - }, -) diff --git a/tkreload/__init__.py b/tkreload/__init__.py index 55b6962..0a896f8 100644 --- a/tkreload/__init__.py +++ b/tkreload/__init__.py @@ -5,14 +5,8 @@ applications, enhancing the development workflow for Tkinter-based projects. """ +__all__ = ["TkreloadApp", "AutoReloadManager", "show_help"] -from .main import TkreloadApp, main +from .main import TkreloadApp from .auto_reload import AutoReloadManager from .help import show_help - -__all__ = ["TkreloadApp", "AutoReloadManager", "show_help"] - -__version__ = "1.0.1" -__author__ = "iamDyeus" -__license__ = "Apache 2.0" -__email__ = "dyeusyt@gmail.com"