issues-fs 0.3.0__tar.gz

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.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,375 @@
1
+ Metadata-Version: 2.1
2
+ Name: issues_fs
3
+ Version: 0.3.0
4
+ Summary: Issues-FS
5
+ Home-page: https://github.com/owasp-sbot/Issues-FS
6
+ License: Apache 2.0
7
+ Author: Dinis Cruz
8
+ Author-email: dinis.cruz@owasp.org
9
+ Requires-Python: >=3.12,<4.0
10
+ Classifier: License :: Other/Proprietary License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Requires-Dist: osbot-utils
14
+ Project-URL: Repository, https://github.com/owasp-sbot/Issues-FS
15
+ Description-Content-Type: text/markdown
16
+
17
+ # Issues-FS
18
+
19
+ [![PyPI version](https://badge.fury.io/py/issues-fs.svg)](https://pypi.org/project/issues-fs/)
20
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
21
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
22
+
23
+ **A file-system based issue tracking library with hierarchical structure and pluggable storage backends.**
24
+
25
+ Issues-FS stores issues as JSON files in a folder structure, enabling version control with Git, offline access, and flexible deployment options. It provides the core data layer for building issue tracking applications.
26
+
27
+ ## Key Features
28
+
29
+ - **File-Based Storage** — Issues stored as `issue.json` files, easily version-controlled with Git
30
+ - **Hierarchical Structure** — Nest issues inside other issues via `issues/` subfolders
31
+ - **Pluggable Backends** — Works with memory, local disk, S3, SQLite, or ZIP via Memory-FS
32
+ - **MGraph-DB Integration** — Efficient graph queries for visualization and traversal
33
+ - **Type-Safe** — Built with `osbot-utils` Type_Safe patterns for runtime validation
34
+ - **Recursive Discovery** — Find issues at any depth in the hierarchy
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ pip install issues-fs
40
+ ```
41
+
42
+ ## Quick Start
43
+
44
+ ```python
45
+ from memory_fs.Memory_FS import Memory_FS
46
+ from memory_fs.storage_fs.Storage_FS__Memory import Storage_FS__Memory
47
+ from memory_fs.storage_fs.Storage_FS__Local_Disk import Storage_FS__Local_Disk
48
+ from issues_fs.graph.Graph__Repository import Graph__Repository
49
+ from issues_fs.graph.Node__Service import Node__Service
50
+ from issues_fs.graph.Type__Service import Type__Service
51
+ from issues_fs.storage.Path__Handler__Graph_Node import Path__Handler__Graph_Node
52
+
53
+ # Setup with in-memory storage (great for testing)
54
+ storage_fs = Storage_FS__Memory()
55
+ memory_fs = Memory_FS(storage_fs=storage_fs)
56
+ path_handler = Path__Handler__Graph_Node(base_path='')
57
+ repository = Graph__Repository(memory_fs=memory_fs, path_handler=path_handler)
58
+
59
+ # Or use local disk storage
60
+ storage_fs = Storage_FS__Local_Disk(root_path='.issues')
61
+ memory_fs = Memory_FS(storage_fs=storage_fs)
62
+ path_handler = Path__Handler__Graph_Node(base_path='')
63
+ repository = Graph__Repository(memory_fs=memory_fs, path_handler=path_handler)
64
+
65
+ # Initialize services
66
+ type_service = Type__Service(repository=repository)
67
+ node_service = Node__Service(repository=repository)
68
+
69
+ # Initialize default types
70
+ type_service.initialize_default_types()
71
+ ```
72
+
73
+ ## Core Operations
74
+
75
+ ### Create an Issue
76
+
77
+ ```python
78
+ from issues_fs.schemas.Schema__Node__Create__Request import Schema__Node__Create__Request
79
+
80
+ request = Schema__Node__Create__Request(
81
+ node_type = 'task',
82
+ title = 'Implement user authentication',
83
+ description = 'Add OAuth2 support',
84
+ status = 'backlog',
85
+ tags = ['security', 'backend']
86
+ )
87
+
88
+ response = node_service.create_node(request)
89
+
90
+ if response.success:
91
+ print(f"Created: {response.node.label}") # Task-1
92
+ ```
93
+
94
+ ### Load an Issue
95
+
96
+ ```python
97
+ from issues_fs.schemas.Safe_Str__Graph_Types import Safe_Str__Node_Type, Safe_Str__Node_Label
98
+
99
+ node = repository.node_load(
100
+ node_type = Safe_Str__Node_Type('task'),
101
+ label = Safe_Str__Node_Label('Task-1')
102
+ )
103
+
104
+ print(node.title) # "Implement user authentication"
105
+ print(node.status) # "backlog"
106
+ ```
107
+
108
+ ### Find All Issues (Recursive)
109
+
110
+ ```python
111
+ # Find all issues, including nested ones
112
+ all_nodes = repository.nodes_list_all()
113
+
114
+ for info in all_nodes:
115
+ print(f"{info.label} ({info.node_type}) at {info.path}")
116
+
117
+ # Filter by root path
118
+ project_nodes = repository.nodes_list_all(
119
+ root_path=Safe_Str__File__Path('data/project/Project-1')
120
+ )
121
+ ```
122
+
123
+ ### Load by Path
124
+
125
+ ```python
126
+ # Load issue by folder path
127
+ node = repository.node_load_by_path(
128
+ Safe_Str__File__Path('data/project/Project-1/issues/Version-1/issues/Task-1')
129
+ )
130
+
131
+ # Find path for a label
132
+ path = repository.node_find_path_by_label(Safe_Str__Node_Label('Task-1'))
133
+ ```
134
+
135
+ ### Update an Issue
136
+
137
+ ```python
138
+ from issues_fs.schemas.Schema__Node__Update__Request import Schema__Node__Update__Request
139
+
140
+ request = Schema__Node__Update__Request(
141
+ status = 'in-progress',
142
+ tags = ['security', 'backend', 'urgent']
143
+ )
144
+
145
+ response = node_service.update_node(
146
+ node_type = Safe_Str__Node_Type('task'),
147
+ label = Safe_Str__Node_Label('Task-1'),
148
+ request = request
149
+ )
150
+ ```
151
+
152
+ ### Delete an Issue
153
+
154
+ ```python
155
+ response = node_service.delete_node(
156
+ node_type = Safe_Str__Node_Type('task'),
157
+ label = Safe_Str__Node_Label('Task-1')
158
+ )
159
+ ```
160
+
161
+ ## MGraph-DB Integration
162
+
163
+ For efficient graph queries and visualization:
164
+
165
+ ```python
166
+ from issues_fs.mgraph.MGraph__Issues__Sync__Service import MGraph__Issues__Sync__Service
167
+ from issues_fs.mgraph.MGraph__Issues__Domain import MGraph__Issues__Domain
168
+
169
+ # Create sync service
170
+ sync_service = MGraph__Issues__Sync__Service(
171
+ repository = repository,
172
+ path_handler = path_handler
173
+ )
174
+
175
+ # Lazy load graph (syncs from filesystem)
176
+ graph = sync_service.ensure_loaded()
177
+
178
+ # Query by label
179
+ node = graph.get_node_by_label('Task-1')
180
+
181
+ # Get children
182
+ children = graph.get_children(node.node_id)
183
+
184
+ # Get ancestors (path to root)
185
+ ancestors = graph.get_ancestors(node.node_id)
186
+
187
+ # Force resync after external changes
188
+ sync_service.full_sync()
189
+ ```
190
+
191
+ ## Storage Structure
192
+
193
+ Issues-FS uses a simple, human-readable folder structure:
194
+
195
+ ```
196
+ .issues/
197
+ ├── config/
198
+ │ ├── node-types.json # Issue type definitions
199
+ │ └── link-types.json # Link type definitions
200
+ ├── data/
201
+ │ └── {type}/
202
+ │ └── {Label}/
203
+ │ ├── issue.json # Issue data
204
+ │ └── issues/ # Child issues
205
+ │ └── {Child-Label}/
206
+ │ └── issue.json
207
+ └── indexes/
208
+ └── issues.mgraph.json # MGraph-DB cache
209
+ ```
210
+
211
+ ### Example Structure
212
+
213
+ ```
214
+ .issues/
215
+ ├── data/
216
+ │ └── project/
217
+ │ └── Project-1/
218
+ │ ├── issue.json
219
+ │ └── issues/
220
+ │ ├── Version-1/
221
+ │ │ ├── issue.json
222
+ │ │ └── issues/
223
+ │ │ ├── Task-1/
224
+ │ │ │ └── issue.json
225
+ │ │ └── Bug-2/
226
+ │ │ └── issue.json
227
+ │ └── Version-2/
228
+ │ └── issue.json
229
+ ```
230
+
231
+ ## Issue JSON Schema
232
+
233
+ ```json
234
+ {
235
+ "node_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
236
+ "node_type": "task",
237
+ "node_index": 1,
238
+ "label": "Task-1",
239
+ "title": "Implement user authentication",
240
+ "description": "Add OAuth2 support for user login",
241
+ "status": "in-progress",
242
+ "created_at": 1706745600000,
243
+ "updated_at": 1706832000000,
244
+ "tags": ["security", "backend"],
245
+ "links": [
246
+ {
247
+ "verb": "blocks",
248
+ "target_label": "Task-2"
249
+ }
250
+ ],
251
+ "properties": {
252
+ "priority": "high",
253
+ "estimate": "3d"
254
+ }
255
+ }
256
+ ```
257
+
258
+ ## Node Types
259
+
260
+ Default node types are created on initialization:
261
+
262
+ ```python
263
+ type_service.initialize_default_types()
264
+ ```
265
+
266
+ ```json
267
+ {
268
+ "types": [
269
+ {"name": "git-repo", "display_name": "Git Repo", "color": "#6e5494", "default_status": "active"},
270
+ {"name": "project", "display_name": "Project", "color": "#4A90D9", "default_status": "active"},
271
+ {"name": "version", "display_name": "Version", "color": "#7B68EE", "default_status": "planned"},
272
+ {"name": "task", "display_name": "Task", "color": "#50C878", "default_status": "backlog"},
273
+ {"name": "bug", "display_name": "Bug", "color": "#FF6B6B", "default_status": "open"},
274
+ {"name": "feature", "display_name": "Feature", "color": "#FFD700", "default_status": "backlog"},
275
+ {"name": "user-story", "display_name": "User Story", "color": "#20B2AA", "default_status": "backlog"}
276
+ ]
277
+ }
278
+ ```
279
+
280
+ ### Custom Types
281
+
282
+ ```python
283
+ from issues_fs.schemas.Schema__Node__Type import Schema__Node__Type
284
+
285
+ custom_type = Schema__Node__Type(
286
+ name = 'epic',
287
+ display_name = 'Epic',
288
+ color = '#9B59B6',
289
+ icon = 'rocket',
290
+ statuses = ['draft', 'active', 'completed'],
291
+ default_status = 'draft'
292
+ )
293
+
294
+ type_service.create_node_type(custom_type)
295
+ ```
296
+
297
+ ## Architecture
298
+
299
+ ```
300
+ ┌─────────────────────────────────────────────────────────────┐
301
+ │ Services │
302
+ │ Node__Service │ Type__Service │ Link__Service │
303
+ └────────────────────────────┬────────────────────────────────┘
304
+
305
+ ┌────────────────────────────▼────────────────────────────────┐
306
+ │ Graph__Repository │
307
+ │ (Data access layer with Type_Safe) │
308
+ └────────────────────────────┬────────────────────────────────┘
309
+
310
+ ┌────────────────────────────▼────────────────────────────────┐
311
+ │ Memory-FS │
312
+ │ Storage_FS__Memory │ Storage_FS__Local_Disk │ S3 │ ... │
313
+ └─────────────────────────────────────────────────────────────┘
314
+
315
+ ┌─────────────────────────────────────────────────────────────┐
316
+ │ MGraph Integration │
317
+ │ MGraph__Issues__Sync__Service → MGraph__Issues__Domain │
318
+ └─────────────────────────────────────────────────────────────┘
319
+ ```
320
+
321
+ ### Key Components
322
+
323
+ | Component | Purpose |
324
+ |-----------|---------|
325
+ | `Graph__Repository` | Data access layer for nodes, types, indexes |
326
+ | `Node__Service` | Business logic for CRUD operations |
327
+ | `Type__Service` | Manage node and link type definitions |
328
+ | `Link__Service` | Manage links between issues |
329
+ | `MGraph__Issues__Sync__Service` | Syncs filesystem to MGraph-DB |
330
+ | `MGraph__Issues__Domain` | Graph operations and indexes |
331
+ | `Path__Handler__Graph_Node` | Generate filesystem paths |
332
+
333
+ ## Development
334
+
335
+ ### Setup
336
+
337
+ ```bash
338
+ git clone https://github.com/owasp-sbot/Issues-FS.git
339
+ cd Issues-FS
340
+ pip install -e ".[dev]"
341
+ ```
342
+
343
+ ### Run Tests
344
+
345
+ ```bash
346
+ pytest
347
+ ```
348
+
349
+ ### Code Style
350
+
351
+ This project follows the [OSBot Python Formatting Guide](https://github.com/owasp-sbot/OSBot-Utils):
352
+
353
+ - Type_Safe inheritance on all classes
354
+ - Safe_* primitives for type validation
355
+ - `@type_safe` decorator on public methods
356
+ - Aligned imports/parameters at column 70-80
357
+ - Explicit `is True` / `is False` for booleans
358
+
359
+ ## Dependencies
360
+
361
+ - [Memory-FS](https://github.com/owasp-sbot/Memory-FS) — Pluggable filesystem abstraction
362
+ - [MGraph-DB](https://github.com/owasp-sbot/MGraph-DB) — Graph database operations
363
+ - [OSBot-Utils](https://github.com/owasp-sbot/OSBot-Utils) — Type_Safe utilities
364
+
365
+ ## Use Cases
366
+
367
+ - **Git-native issue tracking** — Store issues alongside code, branch/merge with PRs
368
+ - **Offline-first workflows** — Full functionality without network access
369
+ - **Custom integrations** — Simple JSON format for easy tooling
370
+ - **Hierarchical project management** — Organize epics → features → tasks → subtasks
371
+ - **Embedded issue tracking** — Add issue tracking to any Python application
372
+
373
+ ## License
374
+
375
+ MIT License — see [LICENSE](LICENSE) for details.
@@ -0,0 +1,359 @@
1
+ # Issues-FS
2
+
3
+ [![PyPI version](https://badge.fury.io/py/issues-fs.svg)](https://pypi.org/project/issues-fs/)
4
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ **A file-system based issue tracking library with hierarchical structure and pluggable storage backends.**
8
+
9
+ Issues-FS stores issues as JSON files in a folder structure, enabling version control with Git, offline access, and flexible deployment options. It provides the core data layer for building issue tracking applications.
10
+
11
+ ## Key Features
12
+
13
+ - **File-Based Storage** — Issues stored as `issue.json` files, easily version-controlled with Git
14
+ - **Hierarchical Structure** — Nest issues inside other issues via `issues/` subfolders
15
+ - **Pluggable Backends** — Works with memory, local disk, S3, SQLite, or ZIP via Memory-FS
16
+ - **MGraph-DB Integration** — Efficient graph queries for visualization and traversal
17
+ - **Type-Safe** — Built with `osbot-utils` Type_Safe patterns for runtime validation
18
+ - **Recursive Discovery** — Find issues at any depth in the hierarchy
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ pip install issues-fs
24
+ ```
25
+
26
+ ## Quick Start
27
+
28
+ ```python
29
+ from memory_fs.Memory_FS import Memory_FS
30
+ from memory_fs.storage_fs.Storage_FS__Memory import Storage_FS__Memory
31
+ from memory_fs.storage_fs.Storage_FS__Local_Disk import Storage_FS__Local_Disk
32
+ from issues_fs.graph.Graph__Repository import Graph__Repository
33
+ from issues_fs.graph.Node__Service import Node__Service
34
+ from issues_fs.graph.Type__Service import Type__Service
35
+ from issues_fs.storage.Path__Handler__Graph_Node import Path__Handler__Graph_Node
36
+
37
+ # Setup with in-memory storage (great for testing)
38
+ storage_fs = Storage_FS__Memory()
39
+ memory_fs = Memory_FS(storage_fs=storage_fs)
40
+ path_handler = Path__Handler__Graph_Node(base_path='')
41
+ repository = Graph__Repository(memory_fs=memory_fs, path_handler=path_handler)
42
+
43
+ # Or use local disk storage
44
+ storage_fs = Storage_FS__Local_Disk(root_path='.issues')
45
+ memory_fs = Memory_FS(storage_fs=storage_fs)
46
+ path_handler = Path__Handler__Graph_Node(base_path='')
47
+ repository = Graph__Repository(memory_fs=memory_fs, path_handler=path_handler)
48
+
49
+ # Initialize services
50
+ type_service = Type__Service(repository=repository)
51
+ node_service = Node__Service(repository=repository)
52
+
53
+ # Initialize default types
54
+ type_service.initialize_default_types()
55
+ ```
56
+
57
+ ## Core Operations
58
+
59
+ ### Create an Issue
60
+
61
+ ```python
62
+ from issues_fs.schemas.Schema__Node__Create__Request import Schema__Node__Create__Request
63
+
64
+ request = Schema__Node__Create__Request(
65
+ node_type = 'task',
66
+ title = 'Implement user authentication',
67
+ description = 'Add OAuth2 support',
68
+ status = 'backlog',
69
+ tags = ['security', 'backend']
70
+ )
71
+
72
+ response = node_service.create_node(request)
73
+
74
+ if response.success:
75
+ print(f"Created: {response.node.label}") # Task-1
76
+ ```
77
+
78
+ ### Load an Issue
79
+
80
+ ```python
81
+ from issues_fs.schemas.Safe_Str__Graph_Types import Safe_Str__Node_Type, Safe_Str__Node_Label
82
+
83
+ node = repository.node_load(
84
+ node_type = Safe_Str__Node_Type('task'),
85
+ label = Safe_Str__Node_Label('Task-1')
86
+ )
87
+
88
+ print(node.title) # "Implement user authentication"
89
+ print(node.status) # "backlog"
90
+ ```
91
+
92
+ ### Find All Issues (Recursive)
93
+
94
+ ```python
95
+ # Find all issues, including nested ones
96
+ all_nodes = repository.nodes_list_all()
97
+
98
+ for info in all_nodes:
99
+ print(f"{info.label} ({info.node_type}) at {info.path}")
100
+
101
+ # Filter by root path
102
+ project_nodes = repository.nodes_list_all(
103
+ root_path=Safe_Str__File__Path('data/project/Project-1')
104
+ )
105
+ ```
106
+
107
+ ### Load by Path
108
+
109
+ ```python
110
+ # Load issue by folder path
111
+ node = repository.node_load_by_path(
112
+ Safe_Str__File__Path('data/project/Project-1/issues/Version-1/issues/Task-1')
113
+ )
114
+
115
+ # Find path for a label
116
+ path = repository.node_find_path_by_label(Safe_Str__Node_Label('Task-1'))
117
+ ```
118
+
119
+ ### Update an Issue
120
+
121
+ ```python
122
+ from issues_fs.schemas.Schema__Node__Update__Request import Schema__Node__Update__Request
123
+
124
+ request = Schema__Node__Update__Request(
125
+ status = 'in-progress',
126
+ tags = ['security', 'backend', 'urgent']
127
+ )
128
+
129
+ response = node_service.update_node(
130
+ node_type = Safe_Str__Node_Type('task'),
131
+ label = Safe_Str__Node_Label('Task-1'),
132
+ request = request
133
+ )
134
+ ```
135
+
136
+ ### Delete an Issue
137
+
138
+ ```python
139
+ response = node_service.delete_node(
140
+ node_type = Safe_Str__Node_Type('task'),
141
+ label = Safe_Str__Node_Label('Task-1')
142
+ )
143
+ ```
144
+
145
+ ## MGraph-DB Integration
146
+
147
+ For efficient graph queries and visualization:
148
+
149
+ ```python
150
+ from issues_fs.mgraph.MGraph__Issues__Sync__Service import MGraph__Issues__Sync__Service
151
+ from issues_fs.mgraph.MGraph__Issues__Domain import MGraph__Issues__Domain
152
+
153
+ # Create sync service
154
+ sync_service = MGraph__Issues__Sync__Service(
155
+ repository = repository,
156
+ path_handler = path_handler
157
+ )
158
+
159
+ # Lazy load graph (syncs from filesystem)
160
+ graph = sync_service.ensure_loaded()
161
+
162
+ # Query by label
163
+ node = graph.get_node_by_label('Task-1')
164
+
165
+ # Get children
166
+ children = graph.get_children(node.node_id)
167
+
168
+ # Get ancestors (path to root)
169
+ ancestors = graph.get_ancestors(node.node_id)
170
+
171
+ # Force resync after external changes
172
+ sync_service.full_sync()
173
+ ```
174
+
175
+ ## Storage Structure
176
+
177
+ Issues-FS uses a simple, human-readable folder structure:
178
+
179
+ ```
180
+ .issues/
181
+ ├── config/
182
+ │ ├── node-types.json # Issue type definitions
183
+ │ └── link-types.json # Link type definitions
184
+ ├── data/
185
+ │ └── {type}/
186
+ │ └── {Label}/
187
+ │ ├── issue.json # Issue data
188
+ │ └── issues/ # Child issues
189
+ │ └── {Child-Label}/
190
+ │ └── issue.json
191
+ └── indexes/
192
+ └── issues.mgraph.json # MGraph-DB cache
193
+ ```
194
+
195
+ ### Example Structure
196
+
197
+ ```
198
+ .issues/
199
+ ├── data/
200
+ │ └── project/
201
+ │ └── Project-1/
202
+ │ ├── issue.json
203
+ │ └── issues/
204
+ │ ├── Version-1/
205
+ │ │ ├── issue.json
206
+ │ │ └── issues/
207
+ │ │ ├── Task-1/
208
+ │ │ │ └── issue.json
209
+ │ │ └── Bug-2/
210
+ │ │ └── issue.json
211
+ │ └── Version-2/
212
+ │ └── issue.json
213
+ ```
214
+
215
+ ## Issue JSON Schema
216
+
217
+ ```json
218
+ {
219
+ "node_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
220
+ "node_type": "task",
221
+ "node_index": 1,
222
+ "label": "Task-1",
223
+ "title": "Implement user authentication",
224
+ "description": "Add OAuth2 support for user login",
225
+ "status": "in-progress",
226
+ "created_at": 1706745600000,
227
+ "updated_at": 1706832000000,
228
+ "tags": ["security", "backend"],
229
+ "links": [
230
+ {
231
+ "verb": "blocks",
232
+ "target_label": "Task-2"
233
+ }
234
+ ],
235
+ "properties": {
236
+ "priority": "high",
237
+ "estimate": "3d"
238
+ }
239
+ }
240
+ ```
241
+
242
+ ## Node Types
243
+
244
+ Default node types are created on initialization:
245
+
246
+ ```python
247
+ type_service.initialize_default_types()
248
+ ```
249
+
250
+ ```json
251
+ {
252
+ "types": [
253
+ {"name": "git-repo", "display_name": "Git Repo", "color": "#6e5494", "default_status": "active"},
254
+ {"name": "project", "display_name": "Project", "color": "#4A90D9", "default_status": "active"},
255
+ {"name": "version", "display_name": "Version", "color": "#7B68EE", "default_status": "planned"},
256
+ {"name": "task", "display_name": "Task", "color": "#50C878", "default_status": "backlog"},
257
+ {"name": "bug", "display_name": "Bug", "color": "#FF6B6B", "default_status": "open"},
258
+ {"name": "feature", "display_name": "Feature", "color": "#FFD700", "default_status": "backlog"},
259
+ {"name": "user-story", "display_name": "User Story", "color": "#20B2AA", "default_status": "backlog"}
260
+ ]
261
+ }
262
+ ```
263
+
264
+ ### Custom Types
265
+
266
+ ```python
267
+ from issues_fs.schemas.Schema__Node__Type import Schema__Node__Type
268
+
269
+ custom_type = Schema__Node__Type(
270
+ name = 'epic',
271
+ display_name = 'Epic',
272
+ color = '#9B59B6',
273
+ icon = 'rocket',
274
+ statuses = ['draft', 'active', 'completed'],
275
+ default_status = 'draft'
276
+ )
277
+
278
+ type_service.create_node_type(custom_type)
279
+ ```
280
+
281
+ ## Architecture
282
+
283
+ ```
284
+ ┌─────────────────────────────────────────────────────────────┐
285
+ │ Services │
286
+ │ Node__Service │ Type__Service │ Link__Service │
287
+ └────────────────────────────┬────────────────────────────────┘
288
+
289
+ ┌────────────────────────────▼────────────────────────────────┐
290
+ │ Graph__Repository │
291
+ │ (Data access layer with Type_Safe) │
292
+ └────────────────────────────┬────────────────────────────────┘
293
+
294
+ ┌────────────────────────────▼────────────────────────────────┐
295
+ │ Memory-FS │
296
+ │ Storage_FS__Memory │ Storage_FS__Local_Disk │ S3 │ ... │
297
+ └─────────────────────────────────────────────────────────────┘
298
+
299
+ ┌─────────────────────────────────────────────────────────────┐
300
+ │ MGraph Integration │
301
+ │ MGraph__Issues__Sync__Service → MGraph__Issues__Domain │
302
+ └─────────────────────────────────────────────────────────────┘
303
+ ```
304
+
305
+ ### Key Components
306
+
307
+ | Component | Purpose |
308
+ |-----------|---------|
309
+ | `Graph__Repository` | Data access layer for nodes, types, indexes |
310
+ | `Node__Service` | Business logic for CRUD operations |
311
+ | `Type__Service` | Manage node and link type definitions |
312
+ | `Link__Service` | Manage links between issues |
313
+ | `MGraph__Issues__Sync__Service` | Syncs filesystem to MGraph-DB |
314
+ | `MGraph__Issues__Domain` | Graph operations and indexes |
315
+ | `Path__Handler__Graph_Node` | Generate filesystem paths |
316
+
317
+ ## Development
318
+
319
+ ### Setup
320
+
321
+ ```bash
322
+ git clone https://github.com/owasp-sbot/Issues-FS.git
323
+ cd Issues-FS
324
+ pip install -e ".[dev]"
325
+ ```
326
+
327
+ ### Run Tests
328
+
329
+ ```bash
330
+ pytest
331
+ ```
332
+
333
+ ### Code Style
334
+
335
+ This project follows the [OSBot Python Formatting Guide](https://github.com/owasp-sbot/OSBot-Utils):
336
+
337
+ - Type_Safe inheritance on all classes
338
+ - Safe_* primitives for type validation
339
+ - `@type_safe` decorator on public methods
340
+ - Aligned imports/parameters at column 70-80
341
+ - Explicit `is True` / `is False` for booleans
342
+
343
+ ## Dependencies
344
+
345
+ - [Memory-FS](https://github.com/owasp-sbot/Memory-FS) — Pluggable filesystem abstraction
346
+ - [MGraph-DB](https://github.com/owasp-sbot/MGraph-DB) — Graph database operations
347
+ - [OSBot-Utils](https://github.com/owasp-sbot/OSBot-Utils) — Type_Safe utilities
348
+
349
+ ## Use Cases
350
+
351
+ - **Git-native issue tracking** — Store issues alongside code, branch/merge with PRs
352
+ - **Offline-first workflows** — Full functionality without network access
353
+ - **Custom integrations** — Simple JSON format for easy tooling
354
+ - **Hierarchical project management** — Organize epics → features → tasks → subtasks
355
+ - **Embedded issue tracking** — Add issue tracking to any Python application
356
+
357
+ ## License
358
+
359
+ MIT License — see [LICENSE](LICENSE) for details.
@@ -0,0 +1,2 @@
1
+ package_name = 'issues_fs'
2
+ path = __path__[0]
@@ -0,0 +1,21 @@
1
+ import issues_fs
2
+ from osbot_utils.type_safe.primitives.domains.common.safe_str.Safe_Str__Version import Safe_Str__Version
3
+ from osbot_utils.type_safe.Type_Safe import Type_Safe
4
+ from osbot_utils.utils.Files import file_contents, path_combine
5
+
6
+
7
+ class Version(Type_Safe):
8
+
9
+ FILE_NAME_VERSION = 'version'
10
+
11
+ def path_code_root(self):
12
+ return issues_fs.path
13
+
14
+ def path_version_file(self):
15
+ return path_combine(self.path_code_root(), self.FILE_NAME_VERSION)
16
+
17
+ def value(self):
18
+ version = file_contents(self.path_version_file()) or ""
19
+ return Safe_Str__Version(version)
20
+
21
+ version__issues_fs = Version().value()
File without changes
@@ -0,0 +1 @@
1
+ v0.3.0
@@ -0,0 +1,17 @@
1
+ [tool.poetry]
2
+ name = "issues_fs"
3
+ version = "v0.3.0"
4
+ description = "Issues-FS"
5
+ authors = ["Dinis Cruz <dinis.cruz@owasp.org>"]
6
+ license = "Apache 2.0"
7
+ readme = "README.md"
8
+ homepage = "https://github.com/owasp-sbot/Issues-FS"
9
+ repository = "https://github.com/owasp-sbot/Issues-FS"
10
+
11
+ [tool.poetry.dependencies]
12
+ python = "^3.12"
13
+ osbot-utils = "*"
14
+
15
+ [build-system]
16
+ requires = ["poetry-core>=1.9.1"]
17
+ build-backend = "poetry.core.masonry.api"