Skip to content

Commit

Permalink
Setup. Changed to use setuptools & pyproject.toml. No longer tries to…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
semiprime committed May 26, 2024
1 parent ccfdecb commit f958d9c
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 38 deletions.
12 changes: 0 additions & 12 deletions MANIFEST.in

This file was deleted.

8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
3 changes: 3 additions & 0 deletions description.md
Original file line number Diff line number Diff line change
@@ -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
59 changes: 36 additions & 23 deletions docs/Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down Expand Up @@ -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,
Expand All @@ -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
----------------
Expand All @@ -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

Expand Down
46 changes: 46 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 3 additions & 1 deletion setup.py → setup_old.py
Original file line number Diff line number Diff line change
@@ -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
#
Expand All @@ -20,6 +20,8 @@
# along with Pygenda. If not, see <https://www.gnu.org/licenses/>.
#

# This is an old setup script for those who need it.

# Example usage:
# ./setup.py install [--user]
# ./setup.py develop [--user]
Expand Down

0 comments on commit f958d9c

Please sign in to comment.