things-py 0.0.4__py3.9.egg

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
EGG-INFO/PKG-INFO ADDED
@@ -0,0 +1,137 @@
1
+ Metadata-Version: 2.1
2
+ Name: things.py
3
+ Version: 0.0.4
4
+ Summary: A simple Python 3 library to read your Things app data.
5
+ Home-page: https://github.com/thingsapi/things.py
6
+ Author: Alexander Willner, Michael B.
7
+ Author-email: alex@willner.ws
8
+ License: UNKNOWN
9
+ Description: # Things Python API
10
+
11
+ A simple Python 3 library to read your [Things app](https://culturedcode.com/things) data. You can test the API [via our CLI](https://github.com/thingsapi/things-cli).
12
+
13
+ [![Build Status](https://github.com/thingsapi/things.py/workflows/Build-Test/badge.svg)](https://github.com/thingsapi/things.py/actions)
14
+ [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/quality/g/thingsapi/things.py)](https://scrutinizer-ci.com/g/thingsapi/things.py/?branch=master)
15
+ [![Coverage Status](https://codecov.io/gh/thingsapi/things.py/branch/main/graph/badge.svg?token=DBWGKAEYAP)](https://codecov.io/gh/thingsapi/things.py)
16
+ [![GitHub Issues](https://img.shields.io/github/issues/thingsapi/things.py)](https://github.com/thingsapi/things.py/issues)
17
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
18
+ [![GitHub Release](https://img.shields.io/github/v/release/thingsapi/things.py?sort=semver)](https://github.com/thingsapi/things.py/releases)
19
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/things.py?label=pypi%20downloads)](https://pypi.org/project/things.py/)
20
+ [![GitHub Download Count](https://img.shields.io/github/downloads/thingsapi/things.py/total.svg)](https://github.com/thingsapi/things.py/releases)
21
+
22
+ ## Table of Contents
23
+
24
+ - [Install](#install)
25
+ - [Examples](#examples)
26
+ - [Background](#background)
27
+ - [Things URLs](#things-urls)
28
+
29
+ ## Install
30
+
31
+ ```sh
32
+ $ pip3 install things.py
33
+ # or
34
+ $ git clone https://github.com/thingsapi/things.py && cd things.py && make install
35
+ ```
36
+
37
+ ## Examples
38
+
39
+ ```python
40
+ >>> import things
41
+ >>> things.todos()
42
+ [{'uuid': '2Ukg8I2nLukhyEM7wYiBeb',
43
+ 'type': 'to-do',
44
+ 'title': 'Make reservation for dinner',
45
+ 'project': 'bNj6TPdKYhY6fScvXWVRDX',
46
+ ...},
47
+ {'uuid': 'RLZroza3jz0XPs3uAlynS7',
48
+ 'type': 'to-do',
49
+ 'title': 'Buy a whiteboard and accessories',
50
+ 'project': 'w8oSP1HjWstPin8RMaJOtB',
51
+ 'notes': "Something around 4' x 3' that's free-standing, two-sided, and magnetic.",
52
+ 'checklist': True,
53
+ ...
54
+ >>> things.todos('RLZroza3jz0XPs3uAlynS7')
55
+ {'uuid': 'RLZroza3jz0XPs3uAlynS7',
56
+ 'type': 'to-do',
57
+ 'title': 'Buy a whiteboard and accessories',
58
+ ...
59
+ 'checklist': [
60
+ {'title': 'Cleaning Spray', 'status': 'completed', ...},
61
+ {'title': 'Magnetic Eraser', 'status': 'incomplete', ...},
62
+ {'title': 'Round magnets', 'status': 'incomplete', ...}
63
+ ]
64
+ ...
65
+ }
66
+
67
+ >>> things.projects()
68
+ [{'uuid': 'bNj6TPdKYhY6fScvXWVRDX',
69
+ 'type': 'project',
70
+ 'title': 'Throw Birthday Party',
71
+ 'area': 'bNj6TPdKYhY6fScvXWVRDX',
72
+ ...},
73
+ {'uuid': 'w8oSP1HjWstPin8RMaJOtB',
74
+ 'type': 'project',
75
+ 'title': 'Set Up Home Office',
76
+ 'area': 'Gw9QefIdgR6nPEoY5hBNSh',
77
+ ...
78
+
79
+ >>> things.areas()
80
+ [{'uuid': 'ToLxnnBrWkfHC3tkx4vxdV',
81
+ 'type': 'area',
82
+ 'title': 'Family',
83
+ ...},
84
+ {'uuid': 'Gw9QefIdgR6nPEoY5hBNSh',
85
+ 'type': 'area',
86
+ 'title': 'Apartment',
87
+ ...
88
+
89
+ >>> things.tags()
90
+ [{'uuid': 'CKILg3kKF2jlCRisNFcqOj',
91
+ 'type': 'tag',
92
+ 'title': 'Home',
93
+ 'shortcut': None},
94
+ {'uuid': 'gfmpz8zxnyfqMDvRi3E8vo',
95
+ 'type': 'tag',
96
+ 'title': 'Office',
97
+ 'shortcut': None},
98
+ ...
99
+
100
+ >>> things.get('CKILg3kKF2jlCRisNFcqOj')
101
+ {'uuid': 'CKILg3kKF2jlCRisNFcqOj',
102
+ 'type': 'tag',
103
+ 'title': 'Home',
104
+ 'shortcut': None}
105
+
106
+ ```
107
+
108
+ ## Background
109
+
110
+ The task management app Things stores all your to-dos in a SQLite database file (details [here](https://culturedcode.com/things/support/articles/2982272/#get-the-things-3-database-file)). This format is machine-readable, not human-readable. The aim of this project is let you access all your data in a human-readable way. We thereby stay as true to the database as possible while doing SQL Joins and transformations to aid understanding of the data.
111
+
112
+ Here's the terminology used involving the database:
113
+
114
+ - area
115
+ - tag
116
+ - task
117
+ - type
118
+ - `'to-do'`: may have a checklist; may be in an area and have tags.
119
+ - `'project'`: may have to-dos and headings; may be in an area and have tags.
120
+ - `'heading'`: part of a project; groups "tasks".
121
+ - status: `"incomplete"`, `"canceled"`, or `"completed"`
122
+ - trashed: `True` or `False`
123
+ - start: `"Inbox"`, `"Anytime"`, or `"Someday"`
124
+ - checklist item (contained within a to-do)
125
+
126
+ ## Things URLs
127
+
128
+ You can make good use of the `uuid` to link to to-dos, areas, tags, and more from other apps. Read more [here](https://culturedcode.com/things/blog/2018/02/hey-things/).
129
+
130
+ Platform: UNKNOWN
131
+ Classifier: Development Status :: 3 - Alpha
132
+ Classifier: Programming Language :: Python :: 3
133
+ Classifier: License :: OSI Approved :: Apache Software License
134
+ Classifier: Operating System :: MacOS :: MacOS X
135
+ Classifier: Natural Language :: English
136
+ Requires-Python: >=3.6
137
+ Description-Content-Type: text/markdown
EGG-INFO/SOURCES.txt ADDED
@@ -0,0 +1,11 @@
1
+ README.md
2
+ setup.py
3
+ tests/__init__.py
4
+ tests/test_things.py
5
+ things/__init__.py
6
+ things/api.py
7
+ things/database.py
8
+ things.py.egg-info/PKG-INFO
9
+ things.py.egg-info/SOURCES.txt
10
+ things.py.egg-info/dependency_links.txt
11
+ things.py.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+
EGG-INFO/top_level.txt ADDED
@@ -0,0 +1,2 @@
1
+ tests
2
+ things
EGG-INFO/zip-safe ADDED
@@ -0,0 +1 @@
1
+
tests/__init__.py ADDED
File without changes
tests/test_things.py ADDED
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ """Module documentation goes here."""
5
+
6
+ import unittest
7
+
8
+ import things
9
+
10
+
11
+ FILEPATH = dict(filepath="tests/main.sqlite")
12
+
13
+
14
+ class ThingsCase(unittest.TestCase):
15
+ """Class documentation goes here."""
16
+
17
+ def test_search(self):
18
+ """Test search."""
19
+ tasks = things.search("wrong_query", **FILEPATH)
20
+ self.assertEqual(0, len(tasks))
21
+ tasks = things.search("To-Do % Heading", **FILEPATH)
22
+ self.assertEqual(1, len(tasks))
23
+
24
+ def test_inbox(self):
25
+ """Test inbox."""
26
+ tasks = things.inbox(**FILEPATH)
27
+ self.assertEqual(2, len(tasks))
28
+
29
+ def test_upcoming(self):
30
+ """Test upcoming."""
31
+ tasks = things.upcoming(**FILEPATH)
32
+ self.assertEqual(2, len(tasks))
33
+
34
+ def test_deadlines(self):
35
+ """Test deadlines."""
36
+ tasks = things.deadlines(**FILEPATH)
37
+ self.assertEqual(1, len(tasks))
38
+
39
+ def test_today(self):
40
+ """Test today."""
41
+ tasks = things.today(**FILEPATH)
42
+ self.assertEqual(1, len(tasks))
43
+
44
+ def test_checklist(self):
45
+ """Test checklist."""
46
+ tasks = things.checklist_items('3Eva4XFof6zWb9iSfYy4ej', **FILEPATH)
47
+ self.assertEqual(3, len(tasks))
48
+ tasks = things.checklist_items('K9bx7h1xCJdevvyWardZDq', **FILEPATH)
49
+ self.assertEqual(0, len(tasks))
50
+
51
+
52
+ def test_anytime(self):
53
+ """Test antime."""
54
+ tasks = things.anytime(**FILEPATH)
55
+ self.assertEqual(8, len(tasks))
56
+ self.assertTrue(any(task['area_title'] == 'Area 1' for task in tasks))
57
+
58
+ def test_logbook(self):
59
+ """Test logbook."""
60
+ tasks = things.logbook(**FILEPATH)
61
+ self.assertEqual(21, len(tasks))
62
+
63
+ def test_canceled(self):
64
+ """Test canceled."""
65
+ tasks = things.canceled(**FILEPATH)
66
+ self.assertEqual(11, len(tasks))
67
+
68
+ def test_completed(self):
69
+ """Test completed."""
70
+ tasks = things.completed(**FILEPATH)
71
+ self.assertEqual(10, len(tasks))
72
+
73
+ def test_someday(self):
74
+ """Test someday."""
75
+ tasks = things.someday(**FILEPATH)
76
+ self.assertEqual(1, len(tasks))
77
+
78
+ def test_get(self):
79
+ """Test get."""
80
+ tasks = things.get("wrong_uuid", **FILEPATH)
81
+ self.assertEqual(None, tasks)
82
+ tasks = things.get("wrong_uuid", "NOT FOUND", **FILEPATH)
83
+ self.assertEqual("NOT FOUND", tasks)
84
+ tasks = things.get("Qt2AY87x2QDdowSn9HKTt1", **FILEPATH)
85
+ self.assertEqual(4, len(tasks))
86
+
87
+ def test_todos(self):
88
+ """Test all tasks."""
89
+ tasks = things.todos(start="Anytime", **FILEPATH)
90
+ self.assertEqual(5, len(tasks))
91
+ tasks = things.todos(start="Anytime", status="completed", **FILEPATH)
92
+ self.assertEqual(6, len(tasks))
93
+ tasks = things.todos(status="completed", **FILEPATH)
94
+ self.assertEqual(10, len(tasks))
95
+ tasks = things.todos(include_items=True, **FILEPATH)
96
+ self.assertEqual(10, len(tasks))
97
+ with self.assertRaises(ValueError):
98
+ things.todos(status="wrong_value", **FILEPATH)
99
+ tasks = things.tasks("A2oPvtt4dXoypeoLc8uYzY", **FILEPATH)
100
+ self.assertEqual(14, len(tasks))
101
+
102
+ def test_tags(self):
103
+ """Test all tags."""
104
+ tags = things.tags(**FILEPATH)
105
+ self.assertEqual(5, len(tags))
106
+
107
+ def test_projects(self):
108
+ """Test all projects."""
109
+ projects = things.projects(**FILEPATH)
110
+ self.assertEqual(2, len(projects))
111
+
112
+ def test_areas(self):
113
+ """Test all test_areas."""
114
+ test_areas = things.areas(**FILEPATH)
115
+ self.assertEqual(3, len(test_areas))
116
+
117
+ def test_database_version(self):
118
+ """Test database version."""
119
+ version = things.Database(**FILEPATH).get_version()
120
+ self.assertEqual(18, version)
121
+
122
+
123
+ if __name__ == "__main__":
124
+ unittest.main()
things/__init__.py ADDED
@@ -0,0 +1,24 @@
1
+ """A simple Python 3 library to read your Things app data."""
2
+
3
+ from things.api import ( # noqa
4
+ anytime,
5
+ areas,
6
+ canceled,
7
+ checklist_items,
8
+ completed,
9
+ deadlines,
10
+ get,
11
+ inbox,
12
+ link,
13
+ logbook,
14
+ projects,
15
+ search,
16
+ show,
17
+ someday,
18
+ tags,
19
+ tasks,
20
+ today,
21
+ todos,
22
+ upcoming,
23
+ )
24
+ from things.database import Database # noqa
Binary file