almasi 0.1.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.
- almasi-0.1.0/LICENSE +73 -0
- almasi-0.1.0/PKG-INFO +167 -0
- almasi-0.1.0/README.md +154 -0
- almasi-0.1.0/almasi.egg-info/PKG-INFO +167 -0
- almasi-0.1.0/almasi.egg-info/SOURCES.txt +59 -0
- almasi-0.1.0/almasi.egg-info/dependency_links.txt +1 -0
- almasi-0.1.0/almasi.egg-info/requires.txt +2 -0
- almasi-0.1.0/almasi.egg-info/top_level.txt +4 -0
- almasi-0.1.0/almasi.py +390 -0
- almasi-0.1.0/lib/__init__.py +0 -0
- almasi-0.1.0/lib/directory.py +395 -0
- almasi-0.1.0/lib/dual.py +44 -0
- almasi-0.1.0/lib/events.py +47 -0
- almasi-0.1.0/lib/file.py +58 -0
- almasi-0.1.0/lib/filesystem_resource.py +63 -0
- almasi-0.1.0/lib/function.py +131 -0
- almasi-0.1.0/lib/imports.py +124 -0
- almasi-0.1.0/lib/logger.py +169 -0
- almasi-0.1.0/lib/module.py +172 -0
- almasi-0.1.0/lib/plugin.py +17 -0
- almasi-0.1.0/lib/reloadable.py +174 -0
- almasi-0.1.0/lib/resource.py +25 -0
- almasi-0.1.0/lib/singleton.py +87 -0
- almasi-0.1.0/lib/spinner.py +60 -0
- almasi-0.1.0/lib/string.py +161 -0
- almasi-0.1.0/lib/subscribable.py +141 -0
- almasi-0.1.0/lib/subscription.py +34 -0
- almasi-0.1.0/lib/tester.py +181 -0
- almasi-0.1.0/lib/timer.py +174 -0
- almasi-0.1.0/lib/undefined.py +23 -0
- almasi-0.1.0/plugins/bytes.py +51 -0
- almasi-0.1.0/plugins/json.py +80 -0
- almasi-0.1.0/plugins/py.py +71 -0
- almasi-0.1.0/plugins/text.py +73 -0
- almasi-0.1.0/pyproject.toml +25 -0
- almasi-0.1.0/root/demo_class.py +7 -0
- almasi-0.1.0/root/foo.py +10 -0
- almasi-0.1.0/root/services/filesystem.py +312 -0
- almasi-0.1.0/root/services/libraries.py +154 -0
- almasi-0.1.0/root/test.py +2 -0
- almasi-0.1.0/root/tests/fixtures/fixture.json +8 -0
- almasi-0.1.0/root/tests/fixtures/fixture_markdown.md +3 -0
- almasi-0.1.0/root/tests/fixtures/fixture_text.txt +1 -0
- almasi-0.1.0/root/tests/test_core.py +170 -0
- almasi-0.1.0/root/tests/test_directory.py +258 -0
- almasi-0.1.0/root/tests/test_extend.py +198 -0
- almasi-0.1.0/root/tests/test_filesystem.py +519 -0
- almasi-0.1.0/root/tests/test_fork.py +243 -0
- almasi-0.1.0/root/tests/test_libraries.py +384 -0
- almasi-0.1.0/root/tests/test_library.py +85 -0
- almasi-0.1.0/root/tests/test_logger.py +202 -0
- almasi-0.1.0/root/tests/test_module.py +139 -0
- almasi-0.1.0/root/tests/test_ownership.py +113 -0
- almasi-0.1.0/root/tests/test_plugins.py +35 -0
- almasi-0.1.0/root/tests/test_reload.py +430 -0
- almasi-0.1.0/root/tests/test_reloadable.py +137 -0
- almasi-0.1.0/root/tests/test_resolution.py +201 -0
- almasi-0.1.0/root/tests/test_resource_subscriptions.py +487 -0
- almasi-0.1.0/root/tests/test_singleton.py +387 -0
- almasi-0.1.0/root/tests/test_subscribable.py +355 -0
- almasi-0.1.0/setup.cfg +4 -0
almasi-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
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, and distribution as defined by Sections 1 through 9 of this document.
|
|
10
|
+
|
|
11
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
12
|
+
|
|
13
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
14
|
+
|
|
15
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
16
|
+
|
|
17
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
18
|
+
|
|
19
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
20
|
+
|
|
21
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
22
|
+
|
|
23
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
24
|
+
|
|
25
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
26
|
+
|
|
27
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
28
|
+
|
|
29
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
30
|
+
|
|
31
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
32
|
+
|
|
33
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
34
|
+
|
|
35
|
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
36
|
+
|
|
37
|
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
38
|
+
|
|
39
|
+
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
40
|
+
|
|
41
|
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
42
|
+
|
|
43
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
44
|
+
|
|
45
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
46
|
+
|
|
47
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
48
|
+
|
|
49
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
50
|
+
|
|
51
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
52
|
+
|
|
53
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
54
|
+
|
|
55
|
+
END OF TERMS AND CONDITIONS
|
|
56
|
+
|
|
57
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
58
|
+
|
|
59
|
+
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
|
60
|
+
|
|
61
|
+
Copyright [yyyy] [name of copyright owner]
|
|
62
|
+
|
|
63
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
64
|
+
you may not use this file except in compliance with the License.
|
|
65
|
+
You may obtain a copy of the License at
|
|
66
|
+
|
|
67
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
68
|
+
|
|
69
|
+
Unless required by applicable law or agreed to in writing, software
|
|
70
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
71
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
72
|
+
See the License for the specific language governing permissions and
|
|
73
|
+
limitations under the License.
|
almasi-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: almasi
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A filesystem-native Python runtime for composing libraries.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Project-URL: Source, https://github.com/WordWield/almasi
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: yaspin
|
|
11
|
+
Requires-Dist: watchfiles<2,>=1
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# Almasi
|
|
15
|
+
|
|
16
|
+
**What if your codebase was already your runtime architecture?**
|
|
17
|
+
Almasi is an open-source Python foundation that turns source structure into a live, composable namespace—without a separate layer of registration and wiring.
|
|
18
|
+
**For developers:** fewer moving parts, lazy components, natural composition. **For ambitious products:** a common foundation for persistent state and AI agents.
|
|
19
|
+
[Watch the 2-minute overview](https://www.youtube.com/watch?v=eCk6kiAriR0) · [Persistent objects: Almasi O](https://github.com/WordWield/almasi.o) · [Agents: Almasi Do](https://github.com/WordWield/almasi.do)
|
|
20
|
+
|
|
21
|
+
## See it in 30 seconds
|
|
22
|
+
|
|
23
|
+
Install the core from GitHub (Python 3.11+):
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
python -m pip install git+https://github.com/WordWield/almasi.git
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Use a library as if it were part of the runtime:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from almasi import o
|
|
33
|
+
|
|
34
|
+
print(o) # <Library 'almasi.o'>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
On first access, Almasi retrieves the library's Git source, installs its declared dependencies and publishes its canonical Python namespace. Repeated imports reuse that instance. **The core stays small; libraries arrive when needed.** Git and internet access are required for first acquisition.
|
|
38
|
+
|
|
39
|
+
Or define a filesystem-native library yourself:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
mylib.py
|
|
43
|
+
root/
|
|
44
|
+
└── greetings.py
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
# mylib.py
|
|
49
|
+
import almasi
|
|
50
|
+
|
|
51
|
+
mylib = almasi.extend('mylib')
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
# root/greetings.py
|
|
56
|
+
import mylib
|
|
57
|
+
|
|
58
|
+
class Greetings(mylib.Module):
|
|
59
|
+
|
|
60
|
+
def hello(self):
|
|
61
|
+
return 'Hello from the filesystem'
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
import mylib
|
|
66
|
+
|
|
67
|
+
print(mylib.greetings().hello())
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
A file becomes a module in the runtime namespace when it is needed. No manual registry of `greetings`, no generated integration layer.
|
|
71
|
+
|
|
72
|
+
## The idea
|
|
73
|
+
|
|
74
|
+
Most frameworks describe the same system repeatedly: files, package exports, service registries, plugin registries, dependency wiring and application configuration. Each representation can drift from the others.
|
|
75
|
+
|
|
76
|
+
**Almasi makes the filesystem a first-class source of runtime structure.** Its libraries are canonical instances of classes, with inheritance, lazily resolved components and extensible file-type plugins.
|
|
77
|
+
|
|
78
|
+
| Capability | What it changes |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
| Filesystem-native namespaces | A `root/` tree resolves naturally into a Python library namespace |
|
|
81
|
+
| Library inheritance | Extend a library without copying its components |
|
|
82
|
+
| Lazy resolution | Discover and cache components on access |
|
|
83
|
+
| Pluggable file semantics | Load Python, JSON, text and other supported resource types through plugins |
|
|
84
|
+
| Named forks | Isolate runtime classes, services and module globals within a library lineage |
|
|
85
|
+
| On-demand library acquisition | Retrieve WordWield libraries and their dependencies on first import |
|
|
86
|
+
|
|
87
|
+
### A family, not a monolith
|
|
88
|
+
|
|
89
|
+
**[Almasi Core](https://github.com/WordWield/almasi)** — runtime identity, filesystem-native discovery and library composition.
|
|
90
|
+
|
|
91
|
+
**[Almasi O](https://github.com/WordWield/almasi.o)** — a persistent Python ontology: typed entities, identity, relationships, nested collections, schemas and LMDB-backed state.
|
|
92
|
+
|
|
93
|
+
**[Almasi Do](https://github.com/WordWield/almasi.do)** — AI agents, structured outputs and provider orchestration that build on the same runtime and object model.
|
|
94
|
+
|
|
95
|
+
The larger opportunity is architectural: applications and agents can build on shared native primitives instead of maintaining an ever-growing web of translations. Almasi is active infrastructure research and development, not a claim that every integration has already been completed.
|
|
96
|
+
|
|
97
|
+
## How it works
|
|
98
|
+
|
|
99
|
+
A library entry point declares its name through `extend()`:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
import almasi
|
|
103
|
+
|
|
104
|
+
mylib = almasi.extend('mylib')
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The entry file and library name must match, and a sibling `root/` directory must exist. Components stored under `root/` are resolved by their names, loaded when accessed and cached. Python components are classes derived from `Module`; other supported files use registered plugins.
|
|
108
|
+
|
|
109
|
+
Libraries inherit the capabilities of their parent:
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
from almasi import o
|
|
113
|
+
|
|
114
|
+
# In the entry point of an appropriately named child library:
|
|
115
|
+
# child = o.extend('child')
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
When a library is extended from `__main__`, Almasi also selects it as the active application. Application selection is process-wide; services do not implicitly initialize merely because a library is extended.
|
|
119
|
+
|
|
120
|
+
### Named forks
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
alice = mylib.fork('alice')
|
|
124
|
+
bob = mylib.fork('bob')
|
|
125
|
+
|
|
126
|
+
assert alice is not bob
|
|
127
|
+
assert mylib['alice'] is alice
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Forks isolate Python-side runtime namespaces and service instances. They **do not** automatically duplicate external databases or other application-owned resources. Those lifecycle choices belong to the consuming library.
|
|
131
|
+
|
|
132
|
+
### Filesystem operations
|
|
133
|
+
|
|
134
|
+
The runtime also provides `join()`, `mkdir()`, `read()`, `write()`, `copy()` and `link()` on directory faces and library roots. Writes and copies use atomic replacement, and successful mutations invalidate affected cached filesystem carriers. [Read the detailed invariants](docs/almasi_invariants8.md).
|
|
135
|
+
|
|
136
|
+
## Acquisition and security
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
from almasi import o, do
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Missing libraries are resolved from the default Git base `https://github.com/WordWield` and stored under `~/.cache/almasi/libraries`. Existing checkouts may be fast-forwarded on first import in a process. The loader installs a library's `requirements.txt` into the **active Python environment**.
|
|
143
|
+
|
|
144
|
+
| Setting | Effect |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| `ALMASI_PATH` | Choose the directory for library checkouts |
|
|
147
|
+
| `ALMASI_GIT_BASE` | Choose a Git source base, including SSH URLs |
|
|
148
|
+
|
|
149
|
+
Only libraries accessible with your Git credentials can be acquired. Git revisions are currently **not pinned or cryptographically verified**; imports execute source code and may install Python packages. Use only repositories you trust. This is convenient for development and experimentation, not a sandbox for untrusted code.
|
|
150
|
+
|
|
151
|
+
The supported library entry layouts are `<checkout>/<name>.py` and `<checkout>/almasi/<name>.py`, each with a `root/` directory. The latter preserves unrelated top-level packages such as the official Python `mcp` SDK. The supported lazy-import contract is `from almasi import name`, not direct `import almasi.name`.
|
|
152
|
+
|
|
153
|
+
## For builders and collaborators
|
|
154
|
+
|
|
155
|
+
Almasi explores a focused thesis: **complexity should emerge from necessity, not from duplicate representations of the same concept.**
|
|
156
|
+
|
|
157
|
+
This is relevant to AI-native applications, agent infrastructure, developer tooling and software that needs persistent, inspectable structure. The three libraries demonstrate distinct layers of that thesis; there are no claimed adoption or benchmark numbers beyond published project tests.
|
|
158
|
+
|
|
159
|
+
- [Source and issues](https://github.com/WordWield/almasi)
|
|
160
|
+
- [Architecture and invariants](docs/almasi_invariants8.md)
|
|
161
|
+
- [Python CI](https://github.com/WordWield/almasi/actions/workflows/python-tests.yml)
|
|
162
|
+
|
|
163
|
+
## Project status
|
|
164
|
+
|
|
165
|
+
Python 3.11+; Apache-2.0. The core builds as a wheel and is tested in CI on Python 3.11 and 3.12. PyPI publication is a separate release step; until it happens, use the Git installation command above.
|
|
166
|
+
|
|
167
|
+
**Created by Alexander Podgorny** — AI systems architect and researcher. [Connect on LinkedIn](https://www.linkedin.com/in/podgorny/).
|
almasi-0.1.0/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Almasi
|
|
2
|
+
|
|
3
|
+
**What if your codebase was already your runtime architecture?**
|
|
4
|
+
Almasi is an open-source Python foundation that turns source structure into a live, composable namespace—without a separate layer of registration and wiring.
|
|
5
|
+
**For developers:** fewer moving parts, lazy components, natural composition. **For ambitious products:** a common foundation for persistent state and AI agents.
|
|
6
|
+
[Watch the 2-minute overview](https://www.youtube.com/watch?v=eCk6kiAriR0) · [Persistent objects: Almasi O](https://github.com/WordWield/almasi.o) · [Agents: Almasi Do](https://github.com/WordWield/almasi.do)
|
|
7
|
+
|
|
8
|
+
## See it in 30 seconds
|
|
9
|
+
|
|
10
|
+
Install the core from GitHub (Python 3.11+):
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
python -m pip install git+https://github.com/WordWield/almasi.git
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Use a library as if it were part of the runtime:
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
from almasi import o
|
|
20
|
+
|
|
21
|
+
print(o) # <Library 'almasi.o'>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
On first access, Almasi retrieves the library's Git source, installs its declared dependencies and publishes its canonical Python namespace. Repeated imports reuse that instance. **The core stays small; libraries arrive when needed.** Git and internet access are required for first acquisition.
|
|
25
|
+
|
|
26
|
+
Or define a filesystem-native library yourself:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
mylib.py
|
|
30
|
+
root/
|
|
31
|
+
└── greetings.py
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
# mylib.py
|
|
36
|
+
import almasi
|
|
37
|
+
|
|
38
|
+
mylib = almasi.extend('mylib')
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
# root/greetings.py
|
|
43
|
+
import mylib
|
|
44
|
+
|
|
45
|
+
class Greetings(mylib.Module):
|
|
46
|
+
|
|
47
|
+
def hello(self):
|
|
48
|
+
return 'Hello from the filesystem'
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
import mylib
|
|
53
|
+
|
|
54
|
+
print(mylib.greetings().hello())
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
A file becomes a module in the runtime namespace when it is needed. No manual registry of `greetings`, no generated integration layer.
|
|
58
|
+
|
|
59
|
+
## The idea
|
|
60
|
+
|
|
61
|
+
Most frameworks describe the same system repeatedly: files, package exports, service registries, plugin registries, dependency wiring and application configuration. Each representation can drift from the others.
|
|
62
|
+
|
|
63
|
+
**Almasi makes the filesystem a first-class source of runtime structure.** Its libraries are canonical instances of classes, with inheritance, lazily resolved components and extensible file-type plugins.
|
|
64
|
+
|
|
65
|
+
| Capability | What it changes |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| Filesystem-native namespaces | A `root/` tree resolves naturally into a Python library namespace |
|
|
68
|
+
| Library inheritance | Extend a library without copying its components |
|
|
69
|
+
| Lazy resolution | Discover and cache components on access |
|
|
70
|
+
| Pluggable file semantics | Load Python, JSON, text and other supported resource types through plugins |
|
|
71
|
+
| Named forks | Isolate runtime classes, services and module globals within a library lineage |
|
|
72
|
+
| On-demand library acquisition | Retrieve WordWield libraries and their dependencies on first import |
|
|
73
|
+
|
|
74
|
+
### A family, not a monolith
|
|
75
|
+
|
|
76
|
+
**[Almasi Core](https://github.com/WordWield/almasi)** — runtime identity, filesystem-native discovery and library composition.
|
|
77
|
+
|
|
78
|
+
**[Almasi O](https://github.com/WordWield/almasi.o)** — a persistent Python ontology: typed entities, identity, relationships, nested collections, schemas and LMDB-backed state.
|
|
79
|
+
|
|
80
|
+
**[Almasi Do](https://github.com/WordWield/almasi.do)** — AI agents, structured outputs and provider orchestration that build on the same runtime and object model.
|
|
81
|
+
|
|
82
|
+
The larger opportunity is architectural: applications and agents can build on shared native primitives instead of maintaining an ever-growing web of translations. Almasi is active infrastructure research and development, not a claim that every integration has already been completed.
|
|
83
|
+
|
|
84
|
+
## How it works
|
|
85
|
+
|
|
86
|
+
A library entry point declares its name through `extend()`:
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
import almasi
|
|
90
|
+
|
|
91
|
+
mylib = almasi.extend('mylib')
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The entry file and library name must match, and a sibling `root/` directory must exist. Components stored under `root/` are resolved by their names, loaded when accessed and cached. Python components are classes derived from `Module`; other supported files use registered plugins.
|
|
95
|
+
|
|
96
|
+
Libraries inherit the capabilities of their parent:
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
from almasi import o
|
|
100
|
+
|
|
101
|
+
# In the entry point of an appropriately named child library:
|
|
102
|
+
# child = o.extend('child')
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
When a library is extended from `__main__`, Almasi also selects it as the active application. Application selection is process-wide; services do not implicitly initialize merely because a library is extended.
|
|
106
|
+
|
|
107
|
+
### Named forks
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
alice = mylib.fork('alice')
|
|
111
|
+
bob = mylib.fork('bob')
|
|
112
|
+
|
|
113
|
+
assert alice is not bob
|
|
114
|
+
assert mylib['alice'] is alice
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Forks isolate Python-side runtime namespaces and service instances. They **do not** automatically duplicate external databases or other application-owned resources. Those lifecycle choices belong to the consuming library.
|
|
118
|
+
|
|
119
|
+
### Filesystem operations
|
|
120
|
+
|
|
121
|
+
The runtime also provides `join()`, `mkdir()`, `read()`, `write()`, `copy()` and `link()` on directory faces and library roots. Writes and copies use atomic replacement, and successful mutations invalidate affected cached filesystem carriers. [Read the detailed invariants](docs/almasi_invariants8.md).
|
|
122
|
+
|
|
123
|
+
## Acquisition and security
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
from almasi import o, do
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Missing libraries are resolved from the default Git base `https://github.com/WordWield` and stored under `~/.cache/almasi/libraries`. Existing checkouts may be fast-forwarded on first import in a process. The loader installs a library's `requirements.txt` into the **active Python environment**.
|
|
130
|
+
|
|
131
|
+
| Setting | Effect |
|
|
132
|
+
| --- | --- |
|
|
133
|
+
| `ALMASI_PATH` | Choose the directory for library checkouts |
|
|
134
|
+
| `ALMASI_GIT_BASE` | Choose a Git source base, including SSH URLs |
|
|
135
|
+
|
|
136
|
+
Only libraries accessible with your Git credentials can be acquired. Git revisions are currently **not pinned or cryptographically verified**; imports execute source code and may install Python packages. Use only repositories you trust. This is convenient for development and experimentation, not a sandbox for untrusted code.
|
|
137
|
+
|
|
138
|
+
The supported library entry layouts are `<checkout>/<name>.py` and `<checkout>/almasi/<name>.py`, each with a `root/` directory. The latter preserves unrelated top-level packages such as the official Python `mcp` SDK. The supported lazy-import contract is `from almasi import name`, not direct `import almasi.name`.
|
|
139
|
+
|
|
140
|
+
## For builders and collaborators
|
|
141
|
+
|
|
142
|
+
Almasi explores a focused thesis: **complexity should emerge from necessity, not from duplicate representations of the same concept.**
|
|
143
|
+
|
|
144
|
+
This is relevant to AI-native applications, agent infrastructure, developer tooling and software that needs persistent, inspectable structure. The three libraries demonstrate distinct layers of that thesis; there are no claimed adoption or benchmark numbers beyond published project tests.
|
|
145
|
+
|
|
146
|
+
- [Source and issues](https://github.com/WordWield/almasi)
|
|
147
|
+
- [Architecture and invariants](docs/almasi_invariants8.md)
|
|
148
|
+
- [Python CI](https://github.com/WordWield/almasi/actions/workflows/python-tests.yml)
|
|
149
|
+
|
|
150
|
+
## Project status
|
|
151
|
+
|
|
152
|
+
Python 3.11+; Apache-2.0. The core builds as a wheel and is tested in CI on Python 3.11 and 3.12. PyPI publication is a separate release step; until it happens, use the Git installation command above.
|
|
153
|
+
|
|
154
|
+
**Created by Alexander Podgorny** — AI systems architect and researcher. [Connect on LinkedIn](https://www.linkedin.com/in/podgorny/).
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: almasi
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A filesystem-native Python runtime for composing libraries.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Project-URL: Source, https://github.com/WordWield/almasi
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: yaspin
|
|
11
|
+
Requires-Dist: watchfiles<2,>=1
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# Almasi
|
|
15
|
+
|
|
16
|
+
**What if your codebase was already your runtime architecture?**
|
|
17
|
+
Almasi is an open-source Python foundation that turns source structure into a live, composable namespace—without a separate layer of registration and wiring.
|
|
18
|
+
**For developers:** fewer moving parts, lazy components, natural composition. **For ambitious products:** a common foundation for persistent state and AI agents.
|
|
19
|
+
[Watch the 2-minute overview](https://www.youtube.com/watch?v=eCk6kiAriR0) · [Persistent objects: Almasi O](https://github.com/WordWield/almasi.o) · [Agents: Almasi Do](https://github.com/WordWield/almasi.do)
|
|
20
|
+
|
|
21
|
+
## See it in 30 seconds
|
|
22
|
+
|
|
23
|
+
Install the core from GitHub (Python 3.11+):
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
python -m pip install git+https://github.com/WordWield/almasi.git
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Use a library as if it were part of the runtime:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from almasi import o
|
|
33
|
+
|
|
34
|
+
print(o) # <Library 'almasi.o'>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
On first access, Almasi retrieves the library's Git source, installs its declared dependencies and publishes its canonical Python namespace. Repeated imports reuse that instance. **The core stays small; libraries arrive when needed.** Git and internet access are required for first acquisition.
|
|
38
|
+
|
|
39
|
+
Or define a filesystem-native library yourself:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
mylib.py
|
|
43
|
+
root/
|
|
44
|
+
└── greetings.py
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
# mylib.py
|
|
49
|
+
import almasi
|
|
50
|
+
|
|
51
|
+
mylib = almasi.extend('mylib')
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
# root/greetings.py
|
|
56
|
+
import mylib
|
|
57
|
+
|
|
58
|
+
class Greetings(mylib.Module):
|
|
59
|
+
|
|
60
|
+
def hello(self):
|
|
61
|
+
return 'Hello from the filesystem'
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
import mylib
|
|
66
|
+
|
|
67
|
+
print(mylib.greetings().hello())
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
A file becomes a module in the runtime namespace when it is needed. No manual registry of `greetings`, no generated integration layer.
|
|
71
|
+
|
|
72
|
+
## The idea
|
|
73
|
+
|
|
74
|
+
Most frameworks describe the same system repeatedly: files, package exports, service registries, plugin registries, dependency wiring and application configuration. Each representation can drift from the others.
|
|
75
|
+
|
|
76
|
+
**Almasi makes the filesystem a first-class source of runtime structure.** Its libraries are canonical instances of classes, with inheritance, lazily resolved components and extensible file-type plugins.
|
|
77
|
+
|
|
78
|
+
| Capability | What it changes |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
| Filesystem-native namespaces | A `root/` tree resolves naturally into a Python library namespace |
|
|
81
|
+
| Library inheritance | Extend a library without copying its components |
|
|
82
|
+
| Lazy resolution | Discover and cache components on access |
|
|
83
|
+
| Pluggable file semantics | Load Python, JSON, text and other supported resource types through plugins |
|
|
84
|
+
| Named forks | Isolate runtime classes, services and module globals within a library lineage |
|
|
85
|
+
| On-demand library acquisition | Retrieve WordWield libraries and their dependencies on first import |
|
|
86
|
+
|
|
87
|
+
### A family, not a monolith
|
|
88
|
+
|
|
89
|
+
**[Almasi Core](https://github.com/WordWield/almasi)** — runtime identity, filesystem-native discovery and library composition.
|
|
90
|
+
|
|
91
|
+
**[Almasi O](https://github.com/WordWield/almasi.o)** — a persistent Python ontology: typed entities, identity, relationships, nested collections, schemas and LMDB-backed state.
|
|
92
|
+
|
|
93
|
+
**[Almasi Do](https://github.com/WordWield/almasi.do)** — AI agents, structured outputs and provider orchestration that build on the same runtime and object model.
|
|
94
|
+
|
|
95
|
+
The larger opportunity is architectural: applications and agents can build on shared native primitives instead of maintaining an ever-growing web of translations. Almasi is active infrastructure research and development, not a claim that every integration has already been completed.
|
|
96
|
+
|
|
97
|
+
## How it works
|
|
98
|
+
|
|
99
|
+
A library entry point declares its name through `extend()`:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
import almasi
|
|
103
|
+
|
|
104
|
+
mylib = almasi.extend('mylib')
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The entry file and library name must match, and a sibling `root/` directory must exist. Components stored under `root/` are resolved by their names, loaded when accessed and cached. Python components are classes derived from `Module`; other supported files use registered plugins.
|
|
108
|
+
|
|
109
|
+
Libraries inherit the capabilities of their parent:
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
from almasi import o
|
|
113
|
+
|
|
114
|
+
# In the entry point of an appropriately named child library:
|
|
115
|
+
# child = o.extend('child')
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
When a library is extended from `__main__`, Almasi also selects it as the active application. Application selection is process-wide; services do not implicitly initialize merely because a library is extended.
|
|
119
|
+
|
|
120
|
+
### Named forks
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
alice = mylib.fork('alice')
|
|
124
|
+
bob = mylib.fork('bob')
|
|
125
|
+
|
|
126
|
+
assert alice is not bob
|
|
127
|
+
assert mylib['alice'] is alice
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Forks isolate Python-side runtime namespaces and service instances. They **do not** automatically duplicate external databases or other application-owned resources. Those lifecycle choices belong to the consuming library.
|
|
131
|
+
|
|
132
|
+
### Filesystem operations
|
|
133
|
+
|
|
134
|
+
The runtime also provides `join()`, `mkdir()`, `read()`, `write()`, `copy()` and `link()` on directory faces and library roots. Writes and copies use atomic replacement, and successful mutations invalidate affected cached filesystem carriers. [Read the detailed invariants](docs/almasi_invariants8.md).
|
|
135
|
+
|
|
136
|
+
## Acquisition and security
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
from almasi import o, do
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Missing libraries are resolved from the default Git base `https://github.com/WordWield` and stored under `~/.cache/almasi/libraries`. Existing checkouts may be fast-forwarded on first import in a process. The loader installs a library's `requirements.txt` into the **active Python environment**.
|
|
143
|
+
|
|
144
|
+
| Setting | Effect |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| `ALMASI_PATH` | Choose the directory for library checkouts |
|
|
147
|
+
| `ALMASI_GIT_BASE` | Choose a Git source base, including SSH URLs |
|
|
148
|
+
|
|
149
|
+
Only libraries accessible with your Git credentials can be acquired. Git revisions are currently **not pinned or cryptographically verified**; imports execute source code and may install Python packages. Use only repositories you trust. This is convenient for development and experimentation, not a sandbox for untrusted code.
|
|
150
|
+
|
|
151
|
+
The supported library entry layouts are `<checkout>/<name>.py` and `<checkout>/almasi/<name>.py`, each with a `root/` directory. The latter preserves unrelated top-level packages such as the official Python `mcp` SDK. The supported lazy-import contract is `from almasi import name`, not direct `import almasi.name`.
|
|
152
|
+
|
|
153
|
+
## For builders and collaborators
|
|
154
|
+
|
|
155
|
+
Almasi explores a focused thesis: **complexity should emerge from necessity, not from duplicate representations of the same concept.**
|
|
156
|
+
|
|
157
|
+
This is relevant to AI-native applications, agent infrastructure, developer tooling and software that needs persistent, inspectable structure. The three libraries demonstrate distinct layers of that thesis; there are no claimed adoption or benchmark numbers beyond published project tests.
|
|
158
|
+
|
|
159
|
+
- [Source and issues](https://github.com/WordWield/almasi)
|
|
160
|
+
- [Architecture and invariants](docs/almasi_invariants8.md)
|
|
161
|
+
- [Python CI](https://github.com/WordWield/almasi/actions/workflows/python-tests.yml)
|
|
162
|
+
|
|
163
|
+
## Project status
|
|
164
|
+
|
|
165
|
+
Python 3.11+; Apache-2.0. The core builds as a wheel and is tested in CI on Python 3.11 and 3.12. PyPI publication is a separate release step; until it happens, use the Git installation command above.
|
|
166
|
+
|
|
167
|
+
**Created by Alexander Podgorny** — AI systems architect and researcher. [Connect on LinkedIn](https://www.linkedin.com/in/podgorny/).
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
almasi.py
|
|
4
|
+
pyproject.toml
|
|
5
|
+
almasi.egg-info/PKG-INFO
|
|
6
|
+
almasi.egg-info/SOURCES.txt
|
|
7
|
+
almasi.egg-info/dependency_links.txt
|
|
8
|
+
almasi.egg-info/requires.txt
|
|
9
|
+
almasi.egg-info/top_level.txt
|
|
10
|
+
lib/__init__.py
|
|
11
|
+
lib/directory.py
|
|
12
|
+
lib/dual.py
|
|
13
|
+
lib/events.py
|
|
14
|
+
lib/file.py
|
|
15
|
+
lib/filesystem_resource.py
|
|
16
|
+
lib/function.py
|
|
17
|
+
lib/imports.py
|
|
18
|
+
lib/logger.py
|
|
19
|
+
lib/module.py
|
|
20
|
+
lib/plugin.py
|
|
21
|
+
lib/reloadable.py
|
|
22
|
+
lib/resource.py
|
|
23
|
+
lib/singleton.py
|
|
24
|
+
lib/spinner.py
|
|
25
|
+
lib/string.py
|
|
26
|
+
lib/subscribable.py
|
|
27
|
+
lib/subscription.py
|
|
28
|
+
lib/tester.py
|
|
29
|
+
lib/timer.py
|
|
30
|
+
lib/undefined.py
|
|
31
|
+
plugins/bytes.py
|
|
32
|
+
plugins/json.py
|
|
33
|
+
plugins/py.py
|
|
34
|
+
plugins/text.py
|
|
35
|
+
root/demo_class.py
|
|
36
|
+
root/foo.py
|
|
37
|
+
root/test.py
|
|
38
|
+
root/services/filesystem.py
|
|
39
|
+
root/services/libraries.py
|
|
40
|
+
root/tests/test_core.py
|
|
41
|
+
root/tests/test_directory.py
|
|
42
|
+
root/tests/test_extend.py
|
|
43
|
+
root/tests/test_filesystem.py
|
|
44
|
+
root/tests/test_fork.py
|
|
45
|
+
root/tests/test_libraries.py
|
|
46
|
+
root/tests/test_library.py
|
|
47
|
+
root/tests/test_logger.py
|
|
48
|
+
root/tests/test_module.py
|
|
49
|
+
root/tests/test_ownership.py
|
|
50
|
+
root/tests/test_plugins.py
|
|
51
|
+
root/tests/test_reload.py
|
|
52
|
+
root/tests/test_reloadable.py
|
|
53
|
+
root/tests/test_resolution.py
|
|
54
|
+
root/tests/test_resource_subscriptions.py
|
|
55
|
+
root/tests/test_singleton.py
|
|
56
|
+
root/tests/test_subscribable.py
|
|
57
|
+
root/tests/fixtures/fixture.json
|
|
58
|
+
root/tests/fixtures/fixture_markdown.md
|
|
59
|
+
root/tests/fixtures/fixture_text.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|