From f958d9c1b4c32a19e4fc6a9245796990a03e09d3 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Sat, 25 May 2024 19:04:59 +0200 Subject: [PATCH] Setup. Changed to use setuptools & pyproject.toml. No longer tries to build C library, but that means it doesn't need a C toolchain, and behaviour without the C library is now reasonable in most cases. --- MANIFEST.in | 12 -------- README.md | 8 ++++-- description.md | 3 ++ docs/Development.md | 59 ++++++++++++++++++++++++---------------- pyproject.toml | 46 +++++++++++++++++++++++++++++++ setup.py => setup_old.py | 4 ++- 6 files changed, 94 insertions(+), 38 deletions(-) delete mode 100644 MANIFEST.in create mode 100644 description.md create mode 100644 pyproject.toml rename setup.py => setup_old.py (97%) diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 7eff5b9..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,12 +0,0 @@ -# MANIFEST.in -# Extra rules for files to include in/exclude in *sdist* - -include README.md -include csrc/*.c -include csrc/CMakeLists.txt -prune docs -prune test -exclude pygenda/locale/*/LC_MESSAGES/pygenda.po -global-exclude *.so -global-exclude .gitignore -global-exclude mypy.ini diff --git a/README.md b/README.md index 6d79c3e..ef583ba 100644 --- a/README.md +++ b/README.md @@ -101,9 +101,13 @@ readme), with the command: Better/recommended: install the Python module with (for example)... - ./setup.py develop --user + pip3 install --editable . --user -(You can uninstall the module with `pip3 uninstall pygenda`.) +Or, for older versions of pip/Python: + + ./setup_old.py develop --user + +(In either case you can uninstall the module with `pip3 uninstall pygenda`.) Now you can now run Pygenda from anywhere with: diff --git a/description.md b/description.md new file mode 100644 index 0000000..2f8246b --- /dev/null +++ b/description.md @@ -0,0 +1,3 @@ +Pygenda is a calendar/agenda application written in Python3/GTK3. The UI is inspired by the Agenda programs on the Psion Series 3 and Series 5 range of keyboard PDAs, with the aim of being suitable for devices such as Planet Computers' Gemini (running Linux). + +For more information/latest source, see https://github.com/semiprime/pygenda diff --git a/docs/Development.md b/docs/Development.md index d544d6c..c954987 100644 --- a/docs/Development.md +++ b/docs/Development.md @@ -2,30 +2,36 @@ Pygenda Development =================== Miscellaneous hints/notes for development. -Installing in Develop mode --------------------------- -In Python, you can install modules in Develop mode with: +Installing in Development mode +------------------------------ +In Python, you can install modules in Development (Editable) mode with: - ./setup.py develop [--user] + pip3 install --editable . [--user] -Rather than copying the files over, this just creates a link to the +Or, for older versions of pip3 (e.g. on Gemini): + + ./setup_old.py develop --user + +Rather than copying the application files, this creates a link to the source directory, so any changes you make in the source are instantly available in the "installed" version. -(Note that if you install in Develop mode, you'll need to build the -clipboard library manually, as in the section below.) - -Building clipboard library --------------------------- +Clipboard library +----------------- This is a small C library to improve cutting/copying behaviour. Specifically it allows Pygenda entries to be copied+pasted as text into applications that expect text, and as calendar entries into -applications that expect clendar entries. Built automatically with -`./setup.py install`. Tested on Gemian, postmarketOS and Slackware, -and probably works on other Linux distributions. It might need -tweaking for Windows/MacOS/BSD/other. +applications that expect calendar entries. Tested on Gemian, +postmarketOS and Slackware, and probably works on other Linux +distributions. It might need tweaking for Windows/MacOS/BSD/other. -To build by hand and copy to the correct location in the source tree: +In order to be as universally compatible as possible, the clipboard +library is not included in the default wheel package. However, you can +build the library yourself, and if you are packaging Pygenda (e.g. for +a specific OS or a Flatpak) it is recommended that you include an +appropriate version of libpygenda_clipboard.so for improved functionality. + +To build and copy to the correct location in the source tree: cd csrc cmake . @@ -75,8 +81,9 @@ Checklist for releases * Check new code is appropriately commented and annotated * Check any doc changes made (e.g. known issues, config, this checklist) * Run `mypy .` in source directory, check any new messages -* If any new dependencies are required, add them to setup.py -* Check setup.py install works & the installed module runs correctly +* If any new dependencies are required, add them to pyproject.toml +* Check `python3 -m build` then `pip3 install dist/pygenda-*.whl` works + and the installed module runs correctly * Create various events & todo items. Close & reopen Pygenda and check they are still there (with iCal file, EDS, & CalDAV server). * Check copy/cut/paste works, including e.g. event date/time, multi-day events, @@ -94,7 +101,7 @@ Checklist for releases * Check darkmode & backgrounds CSS still work * Check mouse clicks/touchscreen taps/swipes work (all views) * Check start_week_day!=Monday still works (all views) -* Increase version number +* Increase version number in pygenda_version.py & pyproject.toml Checking repeats ---------------- @@ -116,19 +123,25 @@ Debugging GTK_DEBUG=interactive python3 -m pygenda -Test setup ----------- -Can test setup.py by using a virtual Python environment: +Test packaging +-------------- +You can test packaging using a virtual Python environment: + # In root directory of Pygenda source, build a wheel + python3 -m build + # Set up and activate the virtual environment + cd ~ python3 -m venv venv_dir source venv_dir/bin/activate + # Install the wheel cd PYGENDA_SRC_DIR - ./setup.py install + pip3 install dist/pygenda-*.whl # Check no install errors cd ~ - # Check pygenda runs with file + # Check pygenda runs with a file python3 -m pygenda -f test.ics # (Optionally install caldav and check pygenda can use it) + # Exit and tidy up deactivate rm -r venv_dir diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..db5d290 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,46 @@ +[build-system] +requires = ["setuptools>=57.5", "setuptools_scm>=6.3"] + + +[project] +name = "pygenda" +version = "0.3.3-dev0" +authors = [ + { name="Matthew Lewis", email="pygenda@semiprime.com" }, +] +# license = "GPLv3 only" +description = "An agenda application inspired by Agenda programs on Psion PDAs." +readme = "description.md" +keywords = [ "calendar", "agenda", "todolist", "diary", "pda", "psion", "geminipda", "linux-mobile" ] + +requires-python = ">=3.5" +dependencies = [ + "PyGObject", + "python-dateutil", + "icalendar", + "tzlocal!=2.*", # Gemian on GeminiPDA does not work with tzlocal 2.x + "num2words", +] + +classifiers = [ + "Development Status :: 3 - Alpha", + "Environment :: Handhelds/PDA's", + "Environment :: X11 Applications :: GTK", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Topic :: Office/Business :: Scheduling", +] + + +[tool.setuptools] +packages = ["pygenda"] + +[tool.setuptools.exclude-package-data] +pygenda = ["mypy.ini", "*.pot", "*.po"] + +[tool.setuptools_scm] + + +[project.urls] +Homepage = "https://github.com/semiprime/pygenda" diff --git a/setup.py b/setup_old.py similarity index 97% rename from setup.py rename to setup_old.py index 01fe7c8..4fa9990 100755 --- a/setup.py +++ b/setup_old.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- # -# setup.py for Pygenda +# setup_old.py for Pygenda # # Copyright (C) 2022,2023 Matthew Lewis # @@ -20,6 +20,8 @@ # along with Pygenda. If not, see . # +# This is an old setup script for those who need it. + # Example usage: # ./setup.py install [--user] # ./setup.py develop [--user]