FoSpy 0.0.1__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.
Files changed (44) hide show
  1. fospy-0.0.1/.gitignore +218 -0
  2. fospy-0.0.1/LICENSE +21 -0
  3. fospy-0.0.1/PKG-INFO +33 -0
  4. fospy-0.0.1/README.md +17 -0
  5. fospy-0.0.1/brainstorm.md +106 -0
  6. fospy-0.0.1/example/end_synthesis.fos +13945 -0
  7. fospy-0.0.1/example/end_templates.fos +13968 -0
  8. fospy-0.0.1/example/example.py +140 -0
  9. fospy-0.0.1/example/readme.md +207 -0
  10. fospy-0.0.1/example/start_synthesis.fos +213 -0
  11. fospy-0.0.1/example/start_templates.fos +13842 -0
  12. fospy-0.0.1/pyproject.toml +27 -0
  13. fospy-0.0.1/src/FoSpy/__init__.py +50 -0
  14. fospy-0.0.1/src/FoSpy/_debug.py +72 -0
  15. fospy-0.0.1/src/FoSpy/blocks/__init__.py +30 -0
  16. fospy-0.0.1/src/FoSpy/blocks/blocks.py +1005 -0
  17. fospy-0.0.1/src/FoSpy/blocks/embedded.py +32 -0
  18. fospy-0.0.1/src/FoSpy/blocks/materials.py +106 -0
  19. fospy-0.0.1/src/FoSpy/blocks/metadata.py +71 -0
  20. fospy-0.0.1/src/FoSpy/blocks/synthesis.py +24 -0
  21. fospy-0.0.1/src/FoSpy/blocks/template.py +60 -0
  22. fospy-0.0.1/src/FoSpy/blocks/treatments.py +36 -0
  23. fospy-0.0.1/src/FoSpy/parsing/__init__.py +4 -0
  24. fospy-0.0.1/src/FoSpy/parsing/format.py +88 -0
  25. fospy-0.0.1/src/FoSpy/parsing/read.py +331 -0
  26. fospy-0.0.1/src/FoSpy/parsing/regex.py +145 -0
  27. fospy-0.0.1/src/FoSpy/parsing/syntax.py +58 -0
  28. fospy-0.0.1/src/FoSpy/parsing/validation.py +115 -0
  29. fospy-0.0.1/src/FoSpy/parsing/validators/__init__.py +1 -0
  30. fospy-0.0.1/src/FoSpy/parsing/validators/material.py +24 -0
  31. fospy-0.0.1/src/FoSpy/parsing/validators/reaction.py +11 -0
  32. fospy-0.0.1/src/FoSpy/parsing/validators/units.py +20 -0
  33. fospy-0.0.1/src/FoSpy/parsing/write.py +146 -0
  34. fospy-0.0.1/tests/example_fos/alternate_syntax_Ba2-Zn5-As6.fos +119 -0
  35. fospy-0.0.1/tests/example_fos/original_Ba2-Zn5-As6.fos +104 -0
  36. fospy-0.0.1/tests/scripts/constructorTest.py +40 -0
  37. fospy-0.0.1/tests/scripts/embedTest.py +20 -0
  38. fospy-0.0.1/tests/scripts/parseTest.py +169 -0
  39. fospy-0.0.1/tests/scripts/templateTest.py +55 -0
  40. fospy-0.0.1/tests/test_fos/read_test.fos +220 -0
  41. fospy-0.0.1/tests/test_fos/template_test.fos +86 -0
  42. fospy-0.0.1/tests/test_fos/template_write_test.fos +101 -0
  43. fospy-0.0.1/tests/test_fos/write_test.fos +219 -0
  44. fospy-0.0.1/windows_new_clone.bat +13 -0
fospy-0.0.1/.gitignore ADDED
@@ -0,0 +1,218 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
fospy-0.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Travis Errthum
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
fospy-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,33 @@
1
+ Metadata-Version: 2.4
2
+ Name: FoSpy
3
+ Version: 0.0.1
4
+ Summary: A package for opening, editing, and saving Files of Synthesis (*.fos)
5
+ Project-URL: Homepage, https://github.com/errthumt/FoSpy
6
+ Project-URL: Issues, https://github.com/errthumt/FoSpy/issues
7
+ Author: Travis Errthum
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.9
13
+ Requires-Dist: chemformula
14
+ Requires-Dist: pandas
15
+ Description-Content-Type: text/markdown
16
+
17
+ # FoSpy
18
+ A package for opening, editing, and saving Files of Synthesis (*.fos)
19
+
20
+ Running brainstorm for features and data structure: [brainstorm.md](./brainstorm.md)
21
+
22
+ Examples of what a FoS could look like: [example/start_synthesis.fos](./example/start_synthesis.fos)
23
+
24
+ Examples of what a python script could do with FoS files and FoS Templates: [example/readme.md](./example/readme.md)
25
+
26
+ There is a fully-packaged app as a proof-of-concept with a gui for opening and editing FOS files.
27
+ * [Github](https://www.github.com/errthumt/CyFoS-alpha)
28
+ * [Installer download](https://github.com/errthumt/CyFoS-alpha/raw/refs/heads/main/installer/windows_release/CyFoS_Setup_1.2.5.exe)
29
+
30
+ Windows batch script for setting up a dev environment: [windows_new_clone.bat](./windows_new_clone.bat)(requires python and git installed)
31
+ * Clones the repo under C:\users\your-username\FoSpy
32
+ * Creates virtual python environment under ...\FoSpy\venv
33
+ * Installs the current FoSpy package as a live editable package to your venv.
fospy-0.0.1/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # FoSpy
2
+ A package for opening, editing, and saving Files of Synthesis (*.fos)
3
+
4
+ Running brainstorm for features and data structure: [brainstorm.md](./brainstorm.md)
5
+
6
+ Examples of what a FoS could look like: [example/start_synthesis.fos](./example/start_synthesis.fos)
7
+
8
+ Examples of what a python script could do with FoS files and FoS Templates: [example/readme.md](./example/readme.md)
9
+
10
+ There is a fully-packaged app as a proof-of-concept with a gui for opening and editing FOS files.
11
+ * [Github](https://www.github.com/errthumt/CyFoS-alpha)
12
+ * [Installer download](https://github.com/errthumt/CyFoS-alpha/raw/refs/heads/main/installer/windows_release/CyFoS_Setup_1.2.5.exe)
13
+
14
+ Windows batch script for setting up a dev environment: [windows_new_clone.bat](./windows_new_clone.bat)(requires python and git installed)
15
+ * Clones the repo under C:\users\your-username\FoSpy
16
+ * Creates virtual python environment under ...\FoSpy\venv
17
+ * Installs the current FoSpy package as a live editable package to your venv.
@@ -0,0 +1,106 @@
1
+ # Back to the basics: What should the script side of FOS parsing do?
2
+
3
+ ## Parsing Basics:
4
+ What should we make sure the script does when reading a FOS file?
5
+ * Maintain block order
6
+ * Flexible classes for custom data blocks
7
+ * Assign existing classes
8
+ * Allow custom classes? (more complex syntax required)
9
+ * Enforce classes for required data blocks
10
+ * Look for units when expected.
11
+ * For non-required and required variables
12
+ * Embed experimental data
13
+ * Max volume?
14
+ * Allow comments within block/data order
15
+
16
+ ## Serializing Basics:
17
+ What should we make sure the script does when writing a FOS file?
18
+ * Block and comment order from reading should be maintained
19
+ * Flexible data types are specified, enforced data types are not (should already be re-enforced when reading)
20
+ * Experimental data is preserved (allow compression? How?)
21
+
22
+ ## Class basics:
23
+ How do we want to structure the data?
24
+ * Synthesis: container class
25
+ * Block: `pandas.DataFrame`? Or list of class objects?
26
+ * i.e. should each material be its own object? or should the material list be one object?
27
+ * Data: `pandas.DataFrame` stored within any block object.
28
+
29
+ ## Classes:
30
+ What "data types" do we want to parse blocks into? What existing data structures can we build these from?
31
+
32
+ ### Synthesis (file level)
33
+ A glorified dictionary
34
+
35
+ <ins>Desired functionality</ins>
36
+ * Somehow maintain link between comments and their corresponding blocks.
37
+ * Store comments inside blocks? Maintain block:comments dict?
38
+ * Maintain order of blocks
39
+ * Enforce required blocks and their types on `__init__`
40
+ * Extra values calculated on serialization, added as comments
41
+
42
+ <ins>Attributes</ins> (variables)
43
+ * Metadata
44
+ * `sourceFile`
45
+ * Comments
46
+ * Blocks
47
+
48
+ <ins>Methods</ins>
49
+ * `__init__(self, filepath)`
50
+ * `insert_material, insert_treatment, etc.`
51
+ * serializer
52
+ * Converts class structure into simple python structure for printing (probably `dict`)
53
+ * `save(self, filepath=self.sourceFile)`
54
+ * uses serializer, then prints to file path. Can be used for save or save as
55
+
56
+ ### Experimenters (Synthesis > metadata > experimenters)
57
+ Categorize information about experimenters involved
58
+
59
+ ### Generic Block (Synthesis > blocks > any block)
60
+ Parent class used for validation of any block type, including custom types.
61
+
62
+ <ins>Desired functionality</ins>
63
+ * Enforce classes required by given subclass
64
+ * Edit items within block
65
+ * Insert/add items.
66
+
67
+ <ins>Attributes</ins> (variables)
68
+
69
+
70
+ <ins>Methods</ins>
71
+
72
+
73
+ ### Materials
74
+
75
+ <ins>Desired functionality</ins>
76
+
77
+ <ins>Attributes</ins> (variables)
78
+
79
+ <ins>Methods</ins>
80
+
81
+ ### Treatments (synthesis steps)
82
+ Can be applied to materials or to main synthesis
83
+
84
+ <ins>Desired functionality</ins>
85
+
86
+ <ins>Attributes</ins> (variables)
87
+
88
+ <ins>Methods</ins>
89
+
90
+ ### Annealing Profiles (treatment subclass)
91
+
92
+ <ins>Desired functionality</ins>
93
+
94
+ <ins>Attributes</ins> (variables)
95
+
96
+ <ins>Methods</ins>
97
+
98
+
99
+ ### Experimental Data
100
+ Internal `data` class contains x/y/z data, but other metadata should be contained here too, like type or instrument
101
+
102
+ <ins>Desired functionality</ins>
103
+
104
+ <ins>Attributes</ins> (variables)
105
+
106
+ <ins>Methods</ins>