Skip to content

Commit b87bd0f

Browse files
tobixenclaude
andcommitted
Modernize Python packaging and fix Python 2 legacy code
config.py: - Replace raw_input() with input() (Python 3 compatible) - Add missing imports: os, time, getpass pyproject.toml: - Add console script entry point - Add classifiers for Python versions 3.9-3.13 - Add tzlocal, python-dateutil, icalendar to dependencies - Add ruff linting configuration - Add pytest and coverage configuration - Add dev dependencies setup.py: - Removed (superseded by pyproject.toml) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 653516c commit b87bd0f

3 files changed

Lines changed: 83 additions & 57 deletions

File tree

‎plann/config.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import logging
22
import json
3+
import os
4+
import time
5+
from getpass import getpass
6+
37
import yaml
48
from fnmatch import fnmatch
59

@@ -25,7 +29,7 @@ def interactive_config(args, config, remaining_argv):
2529
section = args.config_section
2630
else:
2731
## TODO: tab completion
28-
section = raw_input("Chose one of those, or a new name / no name for a new configuration section: ")
32+
section = input("Chose one of those, or a new name / no name for a new configuration section: ")
2933
if section in config:
3034
backup = config[section].copy()
3135
print("Using section " + section)
@@ -42,7 +46,7 @@ def interactive_config(args, config, remaining_argv):
4246
value = getpass(prompt="Enter new value (or just enter to keep the old): ")
4347
else:
4448
print("Config option %s - old value: %s" % (config_key, config[section].get(config_key, '(None)')))
45-
value = raw_input("Enter new value (or just enter to keep the old): ")
49+
value = input("Enter new value (or just enter to keep the old): ")
4650

4751
if value:
4852
config[section][config_key] = value
@@ -64,12 +68,12 @@ def interactive_config(args, config, remaining_argv):
6468
print("CONFIGURATION DONE ...")
6569
for o in options:
6670
print("Type %s if you want to %s" % o)
67-
cmd = raw_input("Enter a command: ")
71+
cmd = input("Enter a command: ")
6872
if cmd in ('use', 'abort'):
6973
state = 'done'
7074
if cmd in ('save', 'save_other'):
7175
if cmd == 'save_other':
72-
new_section = raw_input("New config section name: ")
76+
new_section = input("New config section name: ")
7377
config[new_section] = config[section]
7478
if backup:
7579
config[section] = backup

‎pyproject.toml‎

Lines changed: 75 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,84 @@
11
[project]
22
name = "plann"
3-
version = "1.1.dev"
4-
description = "Plann is a command-line tool for interfacing towards CalDAV calendar servers"
5-
authors = [{ name = "Tobias Brox", email="tobias@redpill-linpro.com"}]
6-
license = {text = "GPL-3.0"}
3+
version = "1.1.dev1"
4+
description = "Simple command-line CalDAV client and planning tool, for adding and browsing calendar items, todo list items, etc."
5+
authors = [{ name = "Tobias Brox", email = "t-plann@tobixen.no" }]
6+
maintainers = [{ name = "Tobias Brox", email = "t-plann@tobixen.no" }]
7+
license = { text = "GPL-3.0" }
78
readme = "README.md"
8-
urls = { Homepage = "https://plann.no" }
9+
requires-python = ">=3.9"
10+
classifiers = [
11+
"Development Status :: 4 - Beta",
12+
"Environment :: Console",
13+
"Intended Audience :: End Users/Desktop",
14+
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
15+
"Operating System :: POSIX",
16+
"Programming Language :: Python :: 3",
17+
"Programming Language :: Python :: 3.9",
18+
"Programming Language :: Python :: 3.10",
19+
"Programming Language :: Python :: 3.11",
20+
"Programming Language :: Python :: 3.12",
21+
"Programming Language :: Python :: 3.13",
22+
"Topic :: Office/Business :: Scheduling",
23+
"Topic :: Utilities",
24+
]
25+
keywords = ["caldav", "calendar", "cli", "todo", "planning"]
926
dependencies = [
10-
"caldav>=1.4.0",
11-
"Click",
12-
"PyYAML",
13-
"sortedcontainers"
27+
"caldav>=1.4.0",
28+
"Click",
29+
"PyYAML",
30+
"sortedcontainers",
31+
"tzlocal",
32+
"python-dateutil",
33+
"icalendar",
34+
]
35+
36+
[project.urls]
37+
Homepage = "https://plann.no"
38+
Repository = "https://github.com/tobixen/plann"
39+
Documentation = "https://plann.no"
40+
41+
[project.scripts]
42+
plann = "plann.cli:cli"
43+
44+
[project.optional-dependencies]
45+
dev = [
46+
"pytest>=7.0",
47+
"pytest-cov>=4.0",
48+
"ruff>=0.1.0",
49+
"xandikos",
1450
]
15-
#dynamic = ["version"]
1651

1752
[build-system]
1853
requires = ["poetry-core"]
1954
build-backend = "poetry.core.masonry.api"
55+
56+
[tool.ruff]
57+
target-version = "py39"
58+
line-length = 120
59+
60+
[tool.ruff.lint]
61+
select = [
62+
"E", # pycodestyle errors
63+
"W", # pycodestyle warnings
64+
"F", # Pyflakes
65+
"I", # isort
66+
"UP", # pyupgrade
67+
]
68+
ignore = [
69+
"E501", # line too long (many existing long lines)
70+
]
71+
72+
[tool.pytest.ini_options]
73+
testpaths = ["tests"]
74+
python_files = ["test_*.py"]
75+
76+
[tool.coverage.run]
77+
source = ["plann"]
78+
branch = true
79+
80+
[tool.coverage.report]
81+
exclude_lines = [
82+
"pragma: no cover",
83+
"if __name__ == .__main__.:",
84+
]

‎setup.py‎

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)