diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index bc27e71..c9720c6 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -19,16 +19,17 @@ jobs: - name: Set up pip run: | python -m pip install --upgrade pip - pip install --upgrade setuptools wheel - name: Install run: pip install '.[testing]' 'urllib3<1.27' - name: Test with pytest - run: python setup.py test + run: pytest publish: runs-on: ubuntu-latest needs: test if: startsWith(github.event.ref, 'refs/tags/v') + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing steps: - uses: actions/checkout@v4 - name: Set up Python @@ -38,13 +39,8 @@ jobs: - name: Set up pip run: | python -m pip install --upgrade pip - pip install --upgrade setuptools wheel - - name: Install - run: pip install '.[releasing]' + pip install --upgrade hatch - name: Build - run: python setup.py bdist_wheel + run: hatch build - name: Publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: twine upload dist/* + uses: pypa/gh-action-pypi-publish@v1.8.14 diff --git a/README.rst b/README.rst index 50ec789..d4bddc8 100644 --- a/README.rst +++ b/README.rst @@ -67,10 +67,5 @@ Take a look at the `technical documentation`_. .. _GitHub: https://github.com/AlexisBRENON/ewmh_m2m .. _technical documentation: https://ewmh-m2m.readthedocs.io/ -Note -==== - -This project has been set up using PyScaffold 3.2.2. For details and usage -information on PyScaffold see https://pyscaffold.org/. .. _move-to-next-monitor: https://github.com/jc00ke/move-to-next-monitor diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..4f36b44 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,52 @@ +[build-system] +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" + +[tool.hatch.build] +packages = ["src/ewmh_m2m"] + +[tool.hatch.version] +source = "vcs" + +[tool.hatch.build.hooks.vcs] +version-file = "src/ewmh_m2m/__init__.py" + +[project] +dynamic = ["version"] +name = "ewmh_m2m" +authors = [ + { name="Alexis BRENON", email="brenon.alexis@gmail.com" }, +] +description = "Move window between monitor in EWMH compliant WM" +readme = "README.rst" +license = {file = "LICENSE.txt"} +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Development Status :: 5 - Production/Stable", +] +requires-python = ">=3.8" +dependencies = [ + "xcffib==0.8.1", + "xpybutil==0.0.6" +] + +[project.optional-dependencies] +testing = [ "pytest", "pytest-cov" ] + +[project.urls] +Documentation = "https://ewmh-m2m.readthedocs.io" +Repository = "https://github.com/AlexisBRENON/ewmh_m2m" + +[project.scripts] +move-to-monitor = "ewmh_m2m.__main__:main" + + +[tool.pytest.ini_options] +addopts = "--cov ewmh_m2m --cov-report term-missing --verbose" +norecursedirs = [ + "dist", + "build", + ".tox" +] +testpaths = ["tests"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 38405b9..0000000 --- a/setup.cfg +++ /dev/null @@ -1,123 +0,0 @@ -# This file is used to configure your project. -# Read more about the various options under: -# http://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files - -[metadata] -name = ewmh_m2m -description = Move window between monitor in EWMH compliant WM -author = Alexis BRENON -author-email = brenon.alexis@gmail.com -license = mit -# Long description is set in setup.py file -#long-description = file: README.rst -#long-description-content-type = text/x-rst; charset=UTF-8 -url = https://github.com/AlexisBRENON/ewmh_m2m -project-urls = - Documentation = https://ewmh-m2m.readthedocs.io -# Change if running only on Windows, Mac or Linux (comma-separated) -platforms = any -# Add here all kinds of additional classifiers as defined under -# https://pypi.python.org/pypi?%3Aaction=list_classifiers -classifiers = - Development Status :: 4 - Beta - Programming Language :: Python - -[options] -zip_safe = False -packages = find: -include_package_data = True -package_dir = - =src -# DON'T CHANGE THE FOLLOWING LINE! IT WILL BE UPDATED BY PYSCAFFOLD! -setup_requires = pyscaffold>=3.2a0,<3.3a0 -# Add here dependencies of your project (semicolon/line-separated), e.g. -# install_requires = numpy; scipy -install_requires = - xcffib==0.8.1 - xpybutil==0.0.6 -# The usage of test_requires is discouraged, see `Dependency Management` docs -# tests_require = pytest; pytest-cov -# Require a specific Python version, e.g. Python 2.7 or >= 3.4 -# python_requires = >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.* -python_requires = >=3.8 - -[options.packages.find] -where = src -exclude = - tests - -[options.extras_require] -# Add here additional requirements for extra features, to install with: -# `pip install ewmh_m2m[PDF]` like: -# PDF = ReportLab; RXP -# Add here test requirements (semicolon/line-separated) -testing = - pytest - pytest-cov -releasing = - wheel - twine - -[options.entry_points] -# Add here console scripts like: -# console_scripts = -# script_name = ewmh_m2m.module:function -# For example: -# console_scripts = -# fibonacci = ewmh_m2m.skeleton:run -console_scripts = - move-to-monitor = ewmh_m2m.__main__:main -# And any other entry points, for example: -# pyscaffold.cli = -# awesome = pyscaffoldext.awesome.extension:AwesomeExtension - -[test] -# py.test options when running `python setup.py test` -# addopts = --verbose -extras = True - -[tool:pytest] -# Options for py.test: -# Specify command line options as you would do when invoking py.test directly. -# e.g. --cov-report html (or xml) for html/xml output or --junitxml junit.xml -# in order to write a coverage file that can be read by Jenkins. -addopts = - --cov ewmh_m2m --cov-report term-missing - --verbose -norecursedirs = - dist - build - .tox -testpaths = tests - -[aliases] -dists = bdist_wheel - -[bdist_wheel] -# Use this option if your package is pure-python -universal = 1 - -[build_sphinx] -source_dir = docs -build_dir = build/sphinx - -[devpi:upload] -# Options for the devpi: PyPI server and packaging tool -# VCS export must be deactivated since we are using setuptools-scm -no-vcs = 1 -formats = bdist_wheel - -[flake8] -# Some sane defaults for the code style checker flake8 -exclude = - .tox - build - dist - .eggs - docs/conf.py - -[pyscaffold] -# PyScaffold's parameters when the project was created. -# This will be used when updating. Do not change! -version = 3.2.2 -package = ewmh_m2m diff --git a/setup.py b/setup.py deleted file mode 100644 index 3c955f5..0000000 --- a/setup.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -""" - Setup file for ewmh_m2m. - Use setup.cfg to configure your project. - - This file was generated with PyScaffold 3.2.2. - PyScaffold helps you to put up the scaffold of your new Python project. - Learn more under: https://pyscaffold.org/ -""" -import sys - -from pkg_resources import VersionConflict, require -from setuptools import setup - -try: - require('setuptools>=38.3') -except VersionConflict: - print("Error: version of setuptools is too old (<38.3)!") - sys.exit(1) - -from os import path - -if __name__ == "__main__": - links = "\n".join(( - ".. _Authors: https://ewmh-m2m.readthedocs.io/en/latest/authors.html", - ".. _Licence: https://ewmh-m2m.readthedocs.io/en/latest/license.html", - ".. _Changelog: https://ewmh-m2m.readthedocs.io/en/latest/changelog.html", - "", - ".. |logo| image:: https://ewmh-m2m.readthedocs.io/en/latest/_images/ewmh_m2m.svg", - " :alt: Logo", - " :width: 500", - "" - )) - - with open(path.join(path.abspath(path.dirname(__file__)), 'README.rst'), encoding='utf-8') as f: - lines = f.readlines() - start_index = lines.index(".. EndOfLinks\n") - description_content = "".join(lines[start_index+1:]) - - setup( - long_description=links + description_content, - long_description_content_type="text/x-rst; charset=UTF-8", - use_pyscaffold=True - ) diff --git a/src/ewmh_m2m/__init__.py b/src/ewmh_m2m/__init__.py index 21aa09e..8268f89 100644 --- a/src/ewmh_m2m/__init__.py +++ b/src/ewmh_m2m/__init__.py @@ -1,10 +1,16 @@ -# -*- coding: utf-8 -*- -import importlib.metadata +# file generated by setuptools_scm +# don't change, don't track in version control +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import Tuple, Union + VERSION_TUPLE = Tuple[Union[int, str], ...] +else: + VERSION_TUPLE = object -try: - # Change here if project is renamed and does not equal the package name - __version__ = importlib.metadata.version(__name__) -except importlib.metadata.PackageNotFoundError: - __version__ = 'unknown' -finally: - del importlib.metadata +version: str +__version__: str +__version_tuple__: VERSION_TUPLE +version_tuple: VERSION_TUPLE + +__version__ = version = '2.0.1.dev3+g99db25e.d20240514' +__version_tuple__ = version_tuple = (2, 0, 1, 'dev3', 'g99db25e.d20240514')