From 7e445d94c6c77dfdd8b2ca70c8c24afb20d65779 Mon Sep 17 00:00:00 2001 From: Christian Geier Date: Tue, 14 Nov 2023 17:33:31 +0100 Subject: [PATCH 1/7] use isinstance() instead of type() --- khal/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/khal/utils.py b/khal/utils.py index d7df22b4c..78f525bbd 100644 --- a/khal/utils.py +++ b/khal/utils.py @@ -191,7 +191,7 @@ def get_wrapped_text(widget: urwid.AttrMap) -> str: def human_formatter(format_string, width=None, colors=True): """Create a formatter that formats events to be human readable.""" def fmt(rows): - single = type(rows) == dict + single = isinstance(rows, dict) if single: rows = [rows] results = [] @@ -233,7 +233,7 @@ def json_formatter(fields): fields = CONTENT_ATTRIBUTES def fmt(rows): - single = type(rows) == dict + single = isinstance(rows, dict) if single: rows = [rows] From ecae6937b0d81ca74be584e5fc521fc1ccb317dc Mon Sep 17 00:00:00 2001 From: Christian Geier Date: Tue, 14 Nov 2023 17:41:57 +0100 Subject: [PATCH 2/7] move setup.py -> pyproject.toml --- pyproject.toml | 61 ++++++++++++++++++++++++++++++++++++++++ setup.py | 76 -------------------------------------------------- 2 files changed, 61 insertions(+), 76 deletions(-) delete mode 100755 setup.py diff --git a/pyproject.toml b/pyproject.toml index 6b38a33d7..95b5004ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,64 @@ +[project] +name = "khal" +dynamic = ["version"] +description = "A standards based terminal calendar" +readme = "README.rst" +authors = [ + {name = "khal contributors", email = "khal@lostpackets.de"}, +] +license = {file = "LICENSE"} +classifiers = [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: MIT License", + "Environment :: Console :: Curses", + "Intended Audience :: End Users/Desktop", + "Operating System :: POSIX", + "Programming Language :: Python :: 3 :: Only", + "Topic :: Utilities", + "Topic :: Communications", +] +dependencies = [ + "click>=3.2", + "click_log>=0.2.0", + "icalendar>=4.0.3", + "urwid>=1.3.0", + "pyxdg", + "pytz", + "python-dateutil", + "configobj", + "atomicwrites>=0.1.7", + "tzlocal>=1.0", +] +[project.optional-dependencies] +proctitle = [ + "setproctitle" +] +test = [ + "freezegun", + "hypothesis", + "packaging", + "vdirsyncer", +] + +[project.urls] +homepage = "http://lostpackets.de/khal/" +repository = "https://github.com/pimutils/khal" + +[project.scripts] +khal = "khal.cli:main_khal" +ikhal = "khal.cli:main_ikhal" + +[build-system] +requires = ["setuptools>=64", "setuptools_scm>=8"] +build-backend = "setuptools.build_meta" +requires-python = ">=3.8,<3.12" + +[tool.setuptools.packages] +find = {} + +[tool.setuptools_scm] +version_file = "khal/version.py" + [tool.ruff] select = ["E", "F", "W", "I", "B0", "UP", "C4"] ignore = ["B008"] diff --git a/setup.py b/setup.py deleted file mode 100755 index b6be6c93c..000000000 --- a/setup.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python3 -import sys - -from setuptools import setup - -if sys.version_info < (3, 8): - errstr = "khal only supports python version 3.8+. Please Upgrade.\n" - sys.stderr.write("#" * len(errstr) + '\n') - sys.stderr.write(errstr) - sys.stderr.write("#" * len(errstr) + '\n') - sys.exit(1) - -requirements = [ - 'click>=3.2', - 'click_log>=0.2.0', - 'icalendar>=4.0.3', - 'urwid>=1.3.0', - 'pyxdg', - 'pytz', - 'python-dateutil', - 'configobj', - # https://github.com/untitaker/python-atomicwrites/commit/4d12f23227b6a944ab1d99c507a69fdbc7c9ed6d # noqa - 'atomicwrites>=0.1.7', - 'tzlocal>=1.0', -] - -test_requirements = [ - 'freezegun', - 'hypothesis', - 'packaging', - 'vdirsyncer', -] - -extra_requirements = { - 'proctitle': ['setproctitle'], -} - -setup( - name='khal', - description='A standards based terminal calendar', - long_description=open('README.rst').read(), - author='khal contributors', - author_email='khal@lostpackets.de', - url='http://lostpackets.de/khal/', - license='Expat/MIT', - packages=['khal', 'khal/ui', 'khal/khalendar', 'khal/settings'], - package_data={'khal': [ - 'settings/default.khal', - 'settings/khal.spec', - ]}, - entry_points={ - 'console_scripts': [ - 'khal = khal.cli:main_khal', - 'ikhal = khal.cli:main_ikhal', - ] - }, - install_requires=requirements, - extras_require=extra_requirements, - tests_require=test_requirements, - setup_requires=['setuptools_scm != 1.12.0'], # not needed when using packages from PyPI - use_scm_version={'write_to': 'khal/version.py'}, - zip_safe=False, # because of configobj loading the .spec file - classifiers=[ - "Development Status :: 4 - Beta", - "License :: OSI Approved :: MIT License", - "Environment :: Console :: Curses", - "Intended Audience :: End Users/Desktop", - "Operating System :: POSIX", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3 :: Only", - "Topic :: Utilities", - "Topic :: Communications", - ], -) From d3a1860ced5cf3008ca5dd6aa156f61a44f473dd Mon Sep 17 00:00:00 2001 From: Christian Geier Date: Tue, 14 Nov 2023 17:43:18 +0100 Subject: [PATCH 3/7] require urwid>2.1 Since ikhal uses 2*24 colors by default, we need urwid>2.1. --- CHANGELOG.rst | 1 + pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b58161f5d..e54148826 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -11,6 +11,7 @@ may want to subscribe to `GitHub's tag feed ====== not released yet +* UPDATED REQUIREMENT urwid is now required >= 2.1.0 * optimization in ikhal when editing events in the far future or past * FIX an issue in ikhal with updating the view of the event list after editing an event diff --git a/pyproject.toml b/pyproject.toml index 95b5004ae..923f3bc46 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ dependencies = [ "click>=3.2", "click_log>=0.2.0", "icalendar>=4.0.3", - "urwid>=1.3.0", + "urwid>=2.1.0", "pyxdg", "pytz", "python-dateutil", From ae3d39e7571e7ae6623fa78ee5695ebbae6bccff Mon Sep 17 00:00:00 2001 From: Christian Geier Date: Tue, 14 Nov 2023 19:54:05 +0100 Subject: [PATCH 4/7] readthedocs: install using pip, not setuptools --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index a2a5e6585..434aef189 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -12,7 +12,7 @@ build: python: install: - requirements: doc/requirements.txt - - method: setuptools + - method: pip path: . # This is the default, you can omit this From eb74b3b3acc4dc747900cfb9cb4fcc65ba00a4fe Mon Sep 17 00:00:00 2001 From: Christian Geier Date: Tue, 14 Nov 2023 19:56:21 +0100 Subject: [PATCH 5/7] move doc requirements to pyproject.toml --- .readthedocs.yml | 3 ++- doc/requirements.txt | 3 --- pyproject.toml | 5 +++++ 3 files changed, 7 insertions(+), 4 deletions(-) delete mode 100644 doc/requirements.txt diff --git a/.readthedocs.yml b/.readthedocs.yml index 434aef189..bcb1b78cb 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -11,9 +11,10 @@ build: python: install: - - requirements: doc/requirements.txt - method: pip path: . + extra_requirements: + - docs # This is the default, you can omit this formats: [] diff --git a/doc/requirements.txt b/doc/requirements.txt deleted file mode 100644 index 2b49a6fa4..000000000 --- a/doc/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -sphinx!=1.6.1 -sphinxcontrib-newsfeed -sphinx-rtd-theme diff --git a/pyproject.toml b/pyproject.toml index 923f3bc46..a64504174 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,11 @@ test = [ "packaging", "vdirsyncer", ] +docs = [ + "sphinx!=1.6.1", + "sphinxcontrib-newsfeed", + "sphinx-rtd-theme", +] [project.urls] homepage = "http://lostpackets.de/khal/" From e97141ffd7fb198d5f8039c0223d5abd7b0516a0 Mon Sep 17 00:00:00 2001 From: Christian Geier Date: Wed, 15 Nov 2023 09:31:04 +0100 Subject: [PATCH 6/7] Update pyproject.toml Co-authored-by: Hugo --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a64504174..cb594e5a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "khal" dynamic = ["version"] -description = "A standards based terminal calendar" +description = "Standards based terminal calendar" readme = "README.rst" authors = [ {name = "khal contributors", email = "khal@lostpackets.de"}, From e386a3a9eabe214d17ac165b867a46cbdb2aaac9 Mon Sep 17 00:00:00 2001 From: Christian Geier Date: Wed, 15 Nov 2023 20:54:30 +0100 Subject: [PATCH 7/7] add language classifiers and sort alphabetically Co-authored-by: Hugo --- pyproject.toml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index cb594e5a8..d6a215b1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,13 +9,18 @@ authors = [ license = {file = "LICENSE"} classifiers = [ "Development Status :: 4 - Beta", - "License :: OSI Approved :: MIT License", "Environment :: Console :: Curses", "Intended Audience :: End Users/Desktop", + "License :: OSI Approved :: MIT License", "Operating System :: POSIX", + "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Topic :: Utilities", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Communications", + "Topic :: Utilities", ] dependencies = [ "click>=3.2",