From a033cd91c12e7b0c1c7f93b1e296229342d13795 Mon Sep 17 00:00:00 2001 From: Glyph Date: Sun, 1 Dec 2024 01:56:06 -0800 Subject: [PATCH 1/4] re-structure requirements gathering This commit was sponsored by Jacob Kaplan-Moss, hacklschorsch, Derek Veit, and my other patrons. If you want to join them, you can support my work at https://glyph.im/patrons/. --- pindeps | 3 +++ setup.py => py2app_setup.py | 0 pyproject.toml | 45 ++++++++++++++++++++++++++++++++++++- requirements.in | 22 ------------------ requirements.txt | 44 ++++++++++++++++++------------------ runme | 2 +- setup.cfg | 27 ---------------------- testme | 2 +- 8 files changed, 71 insertions(+), 74 deletions(-) create mode 100755 pindeps rename setup.py => py2app_setup.py (100%) delete mode 100644 requirements.in diff --git a/pindeps b/pindeps new file mode 100755 index 0000000..4ba0327 --- /dev/null +++ b/pindeps @@ -0,0 +1,3 @@ +#!/bin/sh + +pip-compile --strip-extras --quiet --upgrade --allow-unsafe --no-emit-index-url diff --git a/setup.py b/py2app_setup.py similarity index 100% rename from setup.py rename to py2app_setup.py diff --git a/pyproject.toml b/pyproject.toml index f8c3d84..74e5a6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,52 @@ [build-system] requires = [ - "setuptools>=42", + "setuptools>=42,<71.0.0", "wheel", ] build-backend = "setuptools.build_meta" +[project] +name = "Pomodouroboros" +authors=[ + { name = "Glyph", email = "code@glyph.im" }, +] +description = "An extremely opinionated pomodoro system." +readme = "README.md" +dependencies = [ + # core dependencies + "twisted[tls,http2]", + "python-dateutil", + "ulid-py", + "datetype", + "fritter", + "setuptools<71.0.0", + + "pip-tools", + "mypy", + "mypy-zope", + "types-python-dateutil", + + "py2app ; sys_platform == 'darwin'", + "pyobjc-core ; sys_platform == 'darwin'", + "pyobjc-framework-Cocoa ; sys_platform == 'darwin'", + "pyobjc-framework-ExceptionHandling ; sys_platform == 'darwin'", + "pyobjc-framework-UserNotifications ; sys_platform == 'darwin'", + "pyobjc-framework-CFNetwork ; sys_platform == 'darwin'", + "quickmacapp ; sys_platform == 'darwin'", + "quickmachotkey ; sys_platform == 'darwin'", + "encrust ; sys_platform == 'darwin'", +] +classifiers = [ + "Programming Language :: Python :: 3", +] +version = "0.4.8" + +[project.urls] +Source = "https://github.com/glyph/Pomodouroboros" +Bug-Tracker = "https://github.com/glyph/Pomodouroboros/issues" +[project.scripts] +pom = "pomodouroboros.cli:main" + [tool.black] line-length = 79 @@ -17,3 +59,4 @@ line_length = 79 ignore = [ "E731", ] + diff --git a/requirements.in b/requirements.in deleted file mode 100644 index f3ba640..0000000 --- a/requirements.in +++ /dev/null @@ -1,22 +0,0 @@ -# requirements -py2app ; sys_platform == 'darwin' -pip-tools - -pyobjc-core ; sys_platform == 'darwin' -pyobjc-framework-Cocoa ; sys_platform == 'darwin' -pyobjc-framework-ExceptionHandling ; sys_platform == 'darwin' -pyobjc-framework-UserNotifications ; sys_platform == 'darwin' -pyobjc-framework-CFNetwork ; sys_platform == 'darwin' - -twisted[tls,http2] -mypy -mypy-zope -python-dateutil -types-python-dateutil -ulid-py -quickmacapp ; sys_platform == 'darwin' -quickmachotkey ; sys_platform == 'darwin' -encrust; sys_platform == 'darwin' -datetype -fritter -setuptools<71.0.0 diff --git a/requirements.txt b/requirements.txt index 37b3828..fcc922c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ # This file is autogenerated by pip-compile with Python 3.12 # by the following command: # -# pip-compile --allow-unsafe --no-emit-index-url +# pip-compile --allow-unsafe --no-emit-index-url --strip-extras # altgraph==0.17.4 # via @@ -45,14 +45,14 @@ cython-test-exception-raiser==1.0.2 # via twisted datetype==2024.2.28 # via - # -r requirements.in + # Pomodouroboros (pyproject.toml) # fritter delocate==0.12.0 # via encrust encrust==2024.9.3 ; sys_platform == "darwin" - # via -r requirements.in + # via Pomodouroboros (pyproject.toml) fritter==0.0.9 - # via -r requirements.in + # via Pomodouroboros (pyproject.toml) h11==0.14.0 # via httpcore h2==4.1.0 @@ -63,7 +63,7 @@ hpack==4.0.0 # via h2 httpcore==1.0.7 # via httpx -httpx[http2]==0.28.0 +httpx==0.28.0 # via twisted hyperframe==6.0.1 # via h2 @@ -87,24 +87,24 @@ modulegraph==0.19.6 # via py2app mypy==1.13.0 # via - # -r requirements.in + # Pomodouroboros (pyproject.toml) # mypy-zope mypy-extensions==1.0.0 # via mypy mypy-zope==1.0.9 - # via -r requirements.in + # via Pomodouroboros (pyproject.toml) packaging==24.2 # via # build # delocate # py2app pip-tools==7.4.1 - # via -r requirements.in + # via Pomodouroboros (pyproject.toml) priority==1.3.0 # via twisted py2app==0.28.8 ; sys_platform == "darwin" # via - # -r requirements.in + # Pomodouroboros (pyproject.toml) # encrust pyasn1==0.6.1 # via @@ -118,7 +118,7 @@ pyhamcrest==2.1.0 # via twisted pyobjc-core==10.3.2 ; sys_platform == "darwin" # via - # -r requirements.in + # Pomodouroboros (pyproject.toml) # pyobjc-framework-cfnetwork # pyobjc-framework-cocoa # pyobjc-framework-exceptionhandling @@ -127,11 +127,11 @@ pyobjc-core==10.3.2 ; sys_platform == "darwin" # twisted pyobjc-framework-cfnetwork==10.3.2 ; sys_platform == "darwin" # via - # -r requirements.in + # Pomodouroboros (pyproject.toml) # twisted pyobjc-framework-cocoa==10.3.2 ; sys_platform == "darwin" # via - # -r requirements.in + # Pomodouroboros (pyproject.toml) # pyobjc-framework-cfnetwork # pyobjc-framework-exceptionhandling # pyobjc-framework-usernotifications @@ -139,11 +139,11 @@ pyobjc-framework-cocoa==10.3.2 ; sys_platform == "darwin" # twisted pyobjc-framework-exceptionhandling==10.3.2 ; sys_platform == "darwin" # via - # -r requirements.in + # Pomodouroboros (pyproject.toml) # quickmacapp pyobjc-framework-usernotifications==10.3.2 ; sys_platform == "darwin" # via - # -r requirements.in + # Pomodouroboros (pyproject.toml) # quickmacapp pyopenssl==24.3.0 # via twisted @@ -154,11 +154,11 @@ pyproject-hooks==1.2.0 pyserial==3.5 # via twisted python-dateutil==2.9.0.post0 - # via -r requirements.in + # via Pomodouroboros (pyproject.toml) quickmacapp==2023.4.24 ; sys_platform == "darwin" - # via -r requirements.in + # via Pomodouroboros (pyproject.toml) quickmachotkey==2023.11.17 ; sys_platform == "darwin" - # via -r requirements.in + # via Pomodouroboros (pyproject.toml) service-identity==24.2.0 # via twisted six==1.16.0 @@ -167,13 +167,13 @@ sniffio==1.3.1 # via anyio sortedcontainers==2.4.0 # via hypothesis -twisted[http2,tls]==24.10.0 +twisted==24.10.0 # via - # -r requirements.in + # Pomodouroboros (pyproject.toml) # encrust # quickmacapp types-python-dateutil==2.9.0.20241003 - # via -r requirements.in + # via Pomodouroboros (pyproject.toml) typing-extensions==4.12.2 # via # delocate @@ -182,7 +182,7 @@ typing-extensions==4.12.2 tzdata==2024.2 # via fritter ulid-py==1.1.0 - # via -r requirements.in + # via Pomodouroboros (pyproject.toml) wheel==0.45.1 # via pip-tools wheel-filename==1.4.1 @@ -202,7 +202,7 @@ pip==24.3.1 # via pip-tools setuptools==70.3.0 # via - # -r requirements.in + # Pomodouroboros (pyproject.toml) # incremental # modulegraph # pip-tools diff --git a/runme b/runme index 33332d4..e21a8f0 100755 --- a/runme +++ b/runme @@ -3,6 +3,6 @@ mypy ./src; rm -fr ./build ./dist; # https://github.com/ronaldoussoren/py2app/issues/444 -python setup.py py2app --alias | cat; +python py2app_setup.py py2app --alias | cat; rm -fr ./build; exec ./dist/Pomodouroboros.app/Contents/MacOS/Pomodouroboros; diff --git a/setup.cfg b/setup.cfg index c34bec4..3b467b1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,30 +1,3 @@ -[metadata] -name = Pomodouroboros -version = 0.4.7 -author = Glyph -author_email = glyph@glyph.im -description = An extremely opinionated pomodoro system. -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/glyph/Pomodouroboros -project_urls = - Bug Tracker = https://github.com/glyph/Pomodouroboros/issues -classifiers = - Programming Language :: Python :: 3 - -[options] -package_dir = - = src -packages = find: -python_requires = >=3.6 - -[options.packages.find] -where = src - -[options.entry_points] -console_scripts = - pom = pomodouroboros.cli:main - [flake8] # ObjC method names create too many impossible-to-shorten lines # W503 seems at odds with black? diff --git a/testme b/testme index ddc022a..de03bc4 100755 --- a/testme +++ b/testme @@ -4,5 +4,5 @@ mypy ./src; rm -fr ./dist/TestPomodouroboros.app; export TEST_MODE=YES; # https://github.com/ronaldoussoren/py2app/issues/444 -python setup.py py2app --alias | cat; +python py2app_setup.py py2app --alias | cat; ./dist/TestPomodouroboros.app/Contents/MacOS/TestPomodouroboros; From f4c74eab28f33c107d5b5abcac1a2eb430dec253 Mon Sep 17 00:00:00 2001 From: Glyph Date: Sun, 1 Dec 2024 01:58:08 -0800 Subject: [PATCH 2/4] missed a spot This commit was sponsored by Derek Veit, Jacob Kaplan-Moss, hacklschorsch, and my other patrons. If you want to join them, you can support my work at https://glyph.im/patrons/. --- .github/workflows/test-ui.yml | 2 +- py2app_setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-ui.yml b/.github/workflows/test-ui.yml index a1ebf91..87b8b94 100644 --- a/.github/workflows/test-ui.yml +++ b/.github/workflows/test-ui.yml @@ -32,7 +32,7 @@ jobs: mypy src - name: Run Mac GUI tests run: | - CI_MODE=YES python setup.py py2app --alias | cat + CI_MODE=YES python py2app_setup.py py2app --alias | cat ./dist/CiPomodouroboros.app/Contents/MacOS/CiPomodouroboros model-tests: diff --git a/py2app_setup.py b/py2app_setup.py index 69a89f9..cb00d36 100644 --- a/py2app_setup.py +++ b/py2app_setup.py @@ -2,7 +2,7 @@ This is a setup.py script generated by py2applet Usage: - python setup.py py2app + python py2app_setup.py py2app """ import os From 3b0928a17871d9c637d5ff44609d9925afb1dc86 Mon Sep 17 00:00:00 2001 From: Glyph Date: Sun, 1 Dec 2024 02:29:03 -0800 Subject: [PATCH 3/4] python project name can't be dynamic any more, but CFBundleName can! This commit was sponsored by Matt Campbell, Alex Scammon, hacklschorsch, and my other patrons. If you want to join them, you can support my work at https://glyph.im/patrons/. --- py2app_setup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/py2app_setup.py b/py2app_setup.py index cb00d36..3608902 100644 --- a/py2app_setup.py +++ b/py2app_setup.py @@ -4,6 +4,8 @@ Usage: python py2app_setup.py py2app """ + +import py2app import os from setuptools import setup @@ -33,13 +35,13 @@ def check_mode() -> str: "LSUIElement": True, "NSRequiresAquaSystemAppearance": False, "CFBundleIdentifier": f"im.glyph.and.this.is.{MODE}pomodouroboros", + "CFBundleName": f"{MODE}Pomodouroboros", }, "iconfile": f"{MODE}icon.icns", + "app": APP, } setup( - name=f"{MODE}Pomodouroboros", - app=APP, data_files=DATA_FILES, options={"py2app": OPTIONS}, ) From 147d95a3ac87e75a41e2a5407aa3fcdb3a5254b8 Mon Sep 17 00:00:00 2001 From: Glyph Date: Sun, 1 Dec 2024 02:34:35 -0800 Subject: [PATCH 4/4] remove scratch file This commit was sponsored by Jason Mills, Brian Grohe, Matt Campbell, and my other patrons. If you want to join them, you can support my work at https://glyph.im/patrons/. --- src/scratch.py | 57 -------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 src/scratch.py diff --git a/src/scratch.py b/src/scratch.py deleted file mode 100644 index 19d806c..0000000 --- a/src/scratch.py +++ /dev/null @@ -1,57 +0,0 @@ -from contextlib import contextmanager -from typing import Any, Iterator - -from pomodouroboros.model.observables import Changes, Observer, observable - - -@observable() -class Box: - observer: Observer - contents: int - - -class ShowChanges: - @contextmanager - def added(self, key: object, new: object) -> Iterator[None]: - print(f"will add {key} as {new}") - yield - print(f"did add {key} as {new}") - - @contextmanager - def removed(self, key: object, old: object) -> Iterator[None]: - print(f"will remove {key} (was {old})") - yield - print(f"did remove {key} (was {old})") - - @contextmanager - def changed(self, key: object, old: object, new: object) -> Iterator[None]: - print(f"will change {key} from {old} to {new}") - yield - print(f"did change {key} from {old} to {new}") - - def child(self, key: object) -> Changes[Any, Any]: - return ShowChanges() - - -box = Box(ShowChanges(), 1) -box.contents += 1 - - -from pomodouroboros.model.observables import ObservableList, PathObserver - - -@observable() -class Shelf: - observer: Observer - boxes: ObservableList[Box] - - -def newShelf(observer: Changes[tuple[object, ...], object]) -> Shelf: - p: PathObserver[object] = PathObserver(observer, (), "") - return Shelf(p, ObservableList(p.child("boxes"))) - - -shelf = newShelf(ShowChanges()) -shelf.boxes.append(box) -box.observer = shelf.observer.child("boxes").child(0) -box.contents += 1