phiton 1.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 (52) hide show
  1. phiton-1.0.1/.github/workflows/push.yml +112 -0
  2. phiton-1.0.1/.github/workflows/release.yml +59 -0
  3. phiton-1.0.1/.gitignore +315 -0
  4. phiton-1.0.1/.pre-commit-config.yaml +20 -0
  5. phiton-1.0.1/.specstory/history/.what-is-this.md +54 -0
  6. phiton-1.0.1/.specstory/history/2025-03-02_09-14-improving-python-to-phiton-converter-implementation.md +46 -0
  7. phiton-1.0.1/.specstory/history/2025-03-02_09-37-improving-phiton-compression-for-python.md +1247 -0
  8. phiton-1.0.1/.specstory/history/2025-03-02_10-22-running-phiton-script-on-itself.md +9933 -0
  9. phiton-1.0.1/.specstory/history/2025-03-02_11-27-parsing-python-script-results-with-error-handling.md +885 -0
  10. phiton-1.0.1/.specstory/history/2025-03-02_11-44-refactoring-phiton-code-structure.md +4247 -0
  11. phiton-1.0.1/.specstory/history/2025-03-02_12-15-enhancing-phiton-multi-functional-compression-plan.md +298 -0
  12. phiton-1.0.1/.specstory/history/2025-03-02_12-29-executing-todo-md-tasks.md +2535 -0
  13. phiton-1.0.1/CHANGELOG.md +47 -0
  14. phiton-1.0.1/LICENSE +21 -0
  15. phiton-1.0.1/PKG-INFO +264 -0
  16. phiton-1.0.1/PROGRESS.md +79 -0
  17. phiton-1.0.1/README.md +206 -0
  18. phiton-1.0.1/TODO.md +63 -0
  19. phiton-1.0.1/dist/.gitkeep +1 -0
  20. phiton-1.0.1/examples/example.phi +1 -0
  21. phiton-1.0.1/examples/example.py +99 -0
  22. phiton-1.0.1/package.toml +11 -0
  23. phiton-1.0.1/pyproject.toml +238 -0
  24. phiton-1.0.1/src/phiton/__init__.py +176 -0
  25. phiton-1.0.1/src/phiton/__main__.py +12 -0
  26. phiton-1.0.1/src/phiton/__version__.py +21 -0
  27. phiton-1.0.1/src/phiton/cli.py +200 -0
  28. phiton-1.0.1/src/phiton/config.py +20 -0
  29. phiton-1.0.1/src/phiton/constants.py +288 -0
  30. phiton-1.0.1/src/phiton/converter.py +589 -0
  31. phiton-1.0.1/src/phiton/phiton.md +1273 -0
  32. phiton-1.0.1/src/phiton/phiton.phi +1 -0
  33. phiton-1.0.1/src/phiton/utils.py +170 -0
  34. phiton-1.0.1/tests/README.md +64 -0
  35. phiton-1.0.1/tests/__init__.py +2 -0
  36. phiton-1.0.1/tests/conftest.py +70 -0
  37. phiton-1.0.1/tests/data/complex.py +223 -0
  38. phiton-1.0.1/tests/data/expected/README.md +30 -0
  39. phiton-1.0.1/tests/data/expected/simple_level1.phi +55 -0
  40. phiton-1.0.1/tests/data/expected/simple_level5.phi +22 -0
  41. phiton-1.0.1/tests/data/patterns.py +298 -0
  42. phiton-1.0.1/tests/data/simple.py +48 -0
  43. phiton-1.0.1/tests/test1.phi +1 -0
  44. phiton-1.0.1/tests/test1.py +61 -0
  45. phiton-1.0.1/tests/test2.py +80 -0
  46. phiton-1.0.1/tests/test_cli.py +173 -0
  47. phiton-1.0.1/tests/test_config.py +66 -0
  48. phiton-1.0.1/tests/test_converter.py +129 -0
  49. phiton-1.0.1/tests/test_package.py +6 -0
  50. phiton-1.0.1/tests/test_refactored.py +47 -0
  51. phiton-1.0.1/tests/test_utils.py +113 -0
  52. phiton-1.0.1/uv.lock +531 -0
@@ -0,0 +1,112 @@
1
+ name: Build & Test
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ tags-ignore: ["v*"]
7
+ pull_request:
8
+ branches: [main]
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: write
13
+ id-token: write
14
+
15
+ concurrency:
16
+ group: ${{ github.workflow }}-${{ github.ref }}
17
+ cancel-in-progress: true
18
+
19
+ jobs:
20
+ quality:
21
+ name: Code Quality
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - name: Checkout code
25
+ uses: actions/checkout@v4
26
+ with:
27
+ fetch-depth: 0
28
+
29
+ - name: Run Ruff lint
30
+ uses: astral-sh/ruff-action@v3
31
+ with:
32
+ version: "latest"
33
+ args: "check --output-format=github"
34
+
35
+ - name: Run Ruff Format
36
+ uses: astral-sh/ruff-action@v3
37
+ with:
38
+ version: "latest"
39
+ args: "format --check --respect-gitignore"
40
+
41
+ test:
42
+ name: Run Tests
43
+ needs: quality
44
+ strategy:
45
+ matrix:
46
+ python-version: ["3.10", "3.11", "3.12"]
47
+ os: [ubuntu-latest]
48
+ fail-fast: true
49
+ runs-on: ${{ matrix.os }}
50
+ steps:
51
+ - name: Checkout code
52
+ uses: actions/checkout@v4
53
+
54
+ - name: Set up Python
55
+ uses: actions/setup-python@v5
56
+ with:
57
+ python-version: ${{ matrix.python-version }}
58
+
59
+ - name: Install UV
60
+ uses: astral-sh/setup-uv@v5
61
+ with:
62
+ version: "latest"
63
+ python-version: ${{ matrix.python-version }}
64
+ enable-cache: true
65
+ cache-suffix: ${{ matrix.os }}-${{ matrix.python-version }}
66
+
67
+ - name: Install test dependencies
68
+ run: |
69
+ uv pip install --system --upgrade pip
70
+ uv pip install --system ".[test]"
71
+
72
+ - name: Run tests with Pytest
73
+ run: uv run pytest -n auto --maxfail=1 --disable-warnings --cov-report=xml --cov-config=pyproject.toml --cov=src/phiton --cov=tests tests/
74
+
75
+ - name: Upload coverage report
76
+ uses: actions/upload-artifact@v4
77
+ with:
78
+ name: coverage-${{ matrix.python-version }}-${{ matrix.os }}
79
+ path: coverage.xml
80
+
81
+ build:
82
+ name: Build Distribution
83
+ needs: test
84
+ runs-on: ubuntu-latest
85
+ steps:
86
+ - name: Checkout code
87
+ uses: actions/checkout@v4
88
+
89
+ - name: Set up Python
90
+ uses: actions/setup-python@v5
91
+ with:
92
+ python-version: "3.12"
93
+
94
+ - name: Install UV
95
+ uses: astral-sh/setup-uv@v5
96
+ with:
97
+ version: "latest"
98
+ python-version: "3.12"
99
+ enable-cache: true
100
+
101
+ - name: Install build tools
102
+ run: uv pip install build hatchling hatch-vcs
103
+
104
+ - name: Build distributions
105
+ run: uv run python -m build --outdir dist
106
+
107
+ - name: Upload distribution artifacts
108
+ uses: actions/upload-artifact@v4
109
+ with:
110
+ name: dist-files
111
+ path: dist/
112
+ retention-days: 5
@@ -0,0 +1,59 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ permissions:
8
+ contents: write
9
+ id-token: write
10
+
11
+ jobs:
12
+ release:
13
+ name: Release to PyPI
14
+ runs-on: ubuntu-latest
15
+ environment:
16
+ name: pypi
17
+ url: https://pypi.org/p/phiton
18
+ steps:
19
+ - name: Checkout code
20
+ uses: actions/checkout@v4
21
+ with:
22
+ fetch-depth: 0
23
+
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: "3.12"
28
+
29
+ - name: Install UV
30
+ uses: astral-sh/setup-uv@v5
31
+ with:
32
+ version: "latest"
33
+ python-version: "3.12"
34
+ enable-cache: true
35
+
36
+ - name: Install build tools
37
+ run: uv pip install build hatchling hatch-vcs
38
+
39
+ - name: Build distributions
40
+ run: uv run python -m build --outdir dist
41
+
42
+ - name: Verify distribution files
43
+ run: |
44
+ ls -la dist/
45
+ test -n "$(find dist -name '*.whl')" || (echo "Wheel file missing" && exit 1)
46
+ test -n "$(find dist -name '*.tar.gz')" || (echo "Source distribution missing" && exit 1)
47
+
48
+ - name: Publish to PyPI
49
+ uses: pypa/gh-action-pypi-publish@release/v1
50
+ with:
51
+ password: ${{ secrets.PYPI_TOKEN }}
52
+
53
+ - name: Create GitHub Release
54
+ uses: softprops/action-gh-release@v1
55
+ with:
56
+ files: dist/*
57
+ generate_release_notes: true
58
+ env:
59
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,315 @@
1
+ *_autogen/
2
+ .DS_Store
3
+ __version__.py
4
+ __pycache__/
5
+ _Chutzpah*
6
+ _deps
7
+ _NCrunch_*
8
+ _pkginfo.txt
9
+ _Pvt_Extensions
10
+ _ReSharper*/
11
+ _TeamCity*
12
+ _UpgradeReport_Files/
13
+ !?*.[Cc]ache/
14
+ !.axoCover/settings.json
15
+ !.vscode/extensions.json
16
+ !.vscode/launch.json
17
+ !.vscode/settings.json
18
+ !.vscode/tasks.json
19
+ !**/[Pp]ackages/build/
20
+ !Directory.Build.rsp
21
+ .*crunch*.local.xml
22
+ .axoCover/*
23
+ .builds
24
+ .cr/personal
25
+ .fake/
26
+ .history/
27
+ .ionide/
28
+ .localhistory/
29
+ .mfractor/
30
+ .ntvs_analysis.dat
31
+ .paket/paket.exe
32
+ .sass-cache/
33
+ .vs/
34
+ .vscode
35
+ .vscode/*
36
+ .vshistory/
37
+ [Aa][Rr][Mm]/
38
+ [Aa][Rr][Mm]64/
39
+ [Bb]in/
40
+ [Bb]uild[Ll]og.*
41
+ [Dd]ebug/
42
+ [Dd]ebugPS/
43
+ [Dd]ebugPublic/
44
+ [Ee]xpress/
45
+ [Ll]og/
46
+ [Ll]ogs/
47
+ [Oo]bj/
48
+ [Rr]elease/
49
+ [Rr]eleasePS/
50
+ [Rr]eleases/
51
+ [Tt]est[Rr]esult*/
52
+ [Ww][Ii][Nn]32/
53
+ *_h.h
54
+ *_i.c
55
+ *_p.c
56
+ *_wpftmp.csproj
57
+ *- [Bb]ackup ([0-9]).rdl
58
+ *- [Bb]ackup ([0-9][0-9]).rdl
59
+ *- [Bb]ackup.rdl
60
+ *.[Cc]ache
61
+ *.[Pp]ublish.xml
62
+ *.[Rr]e[Ss]harper
63
+ *.a
64
+ *.app
65
+ *.appx
66
+ *.appxbundle
67
+ *.appxupload
68
+ *.aps
69
+ *.azurePubxml
70
+ *.bim_*.settings
71
+ *.bim.layout
72
+ *.binlog
73
+ *.btm.cs
74
+ *.btp.cs
75
+ *.build.csdef
76
+ *.cab
77
+ *.cachefile
78
+ *.code-workspace
79
+ *.coverage
80
+ *.coveragexml
81
+ *.d
82
+ *.dbmdl
83
+ *.dbproj.schemaview
84
+ *.dll
85
+ *.dotCover
86
+ *.DotSettings.user
87
+ *.dsp
88
+ *.dsw
89
+ *.dylib
90
+ *.e2e
91
+ *.exe
92
+ *.gch
93
+ *.GhostDoc.xml
94
+ *.gpState
95
+ *.ilk
96
+ *.iobj
97
+ *.ipdb
98
+ *.jfm
99
+ *.jmconfig
100
+ *.la
101
+ *.lai
102
+ *.ldf
103
+ *.lib
104
+ *.lo
105
+ *.log
106
+ *.mdf
107
+ *.meta
108
+ *.mm.*
109
+ *.mod
110
+ *.msi
111
+ *.msix
112
+ *.msm
113
+ *.msp
114
+ *.ncb
115
+ *.ndf
116
+ *.nuget.props
117
+ *.nuget.targets
118
+ *.nupkg
119
+ *.nvuser
120
+ *.o
121
+ *.obj
122
+ *.odx.cs
123
+ *.opendb
124
+ *.opensdf
125
+ *.opt
126
+ *.out
127
+ *.pch
128
+ *.pdb
129
+ *.pfx
130
+ *.pgc
131
+ *.pgd
132
+ *.pidb
133
+ *.plg
134
+ *.psess
135
+ *.publishproj
136
+ *.publishsettings
137
+ *.pubxml
138
+ *.pyc
139
+ *.rdl.data
140
+ *.rptproj.bak
141
+ *.rptproj.rsuser
142
+ *.rsp
143
+ *.rsuser
144
+ *.sap
145
+ *.sbr
146
+ *.scc
147
+ *.sdf
148
+ *.sln.docstates
149
+ *.sln.iml
150
+ *.slo
151
+ *.smod
152
+ *.snupkg
153
+ *.so
154
+ *.suo
155
+ *.svclog
156
+ *.tlb
157
+ *.tlh
158
+ *.tli
159
+ *.tlog
160
+ *.tmp
161
+ *.tmp_proj
162
+ *.tss
163
+ *.user
164
+ *.userosscache
165
+ *.userprefs
166
+ *.vbp
167
+ *.vbw
168
+ *.VC.db
169
+ *.VC.VC.opendb
170
+ *.VisualState.xml
171
+ *.vsp
172
+ *.vspscc
173
+ *.vspx
174
+ *.vssscc
175
+ *.xsd.cs
176
+ **/[Pp]ackages/*
177
+ **/*.DesktopClient/GeneratedArtifacts
178
+ **/*.DesktopClient/ModelManifest.xml
179
+ **/*.HTMLClient/GeneratedArtifacts
180
+ **/*.Server/GeneratedArtifacts
181
+ **/*.Server/ModelManifest.xml
182
+ *~
183
+ ~$*
184
+ $tf/
185
+ AppPackages/
186
+ artifacts/
187
+ ASALocalRun/
188
+ AutoTest.Net/
189
+ Backup*/
190
+ BenchmarkDotNet.Artifacts/
191
+ bld/
192
+ BundleArtifacts/
193
+ ClientBin/
194
+ cmake_install.cmake
195
+ CMakeCache.txt
196
+ CMakeFiles
197
+ CMakeLists.txt.user
198
+ CMakeScripts
199
+ CMakeUserPresets.json
200
+ compile_commands.json
201
+ coverage*.info
202
+ coverage*.json
203
+ coverage*.xml
204
+ csx/
205
+ CTestTestfile.cmake
206
+ dlldata.c
207
+ DocProject/buildhelp/
208
+ DocProject/Help/*.hhc
209
+ DocProject/Help/*.hhk
210
+ DocProject/Help/*.hhp
211
+ DocProject/Help/*.HxC
212
+ DocProject/Help/*.HxT
213
+ DocProject/Help/html
214
+ DocProject/Help/Html2
215
+ ecf/
216
+ FakesAssemblies/
217
+ FodyWeavers.xsd
218
+ Generated_Code/
219
+ Generated\ Files/
220
+ healthchecksdb
221
+ install_manifest.txt
222
+ ipch/
223
+ Makefile
224
+ MigrationBackup/
225
+ mono_crash.*
226
+ nCrunchTemp_*
227
+ node_modules/
228
+ nunit-*.xml
229
+ OpenCover/
230
+ orleans.codegen.cs
231
+ Package.StoreAssociation.xml
232
+ paket-files/
233
+ project.fragment.lock.json
234
+ project.lock.json
235
+ publish/
236
+ PublishScripts/
237
+ rcf/
238
+ ScaffoldingReadMe.txt
239
+ ServiceFabricBackup/
240
+ StyleCopReport.xml
241
+ Testing
242
+ TestResult.xml
243
+ UpgradeLog*.htm
244
+ UpgradeLog*.XML
245
+ x64/
246
+ x86/
247
+ # Python
248
+ __pycache__/
249
+ *.py[cod]
250
+ *$py.class
251
+ *.so
252
+ .Python
253
+ build/
254
+ develop-eggs/
255
+ downloads/
256
+ eggs/
257
+ .eggs/
258
+ lib/
259
+ lib64/
260
+ parts/
261
+ sdist/
262
+ var/
263
+ wheels/
264
+ *.egg-info/
265
+ .installed.cfg
266
+ *.egg
267
+ MANIFEST
268
+
269
+ # Distribution / packaging
270
+ !dist/.gitkeep
271
+
272
+ # Unit test / coverage reports
273
+ htmlcov/
274
+ .tox/
275
+ .nox/
276
+ .coverage
277
+ .coverage.*
278
+ .cache
279
+ nosetests.xml
280
+ coverage.xml
281
+ *.cover
282
+ *.py,cover
283
+ .hypothesis/
284
+ .pytest_cache/
285
+ cover/
286
+ .ruff_cache/
287
+
288
+ # Environments
289
+ .env
290
+ .venv
291
+ env/
292
+ venv/
293
+ ENV/
294
+ env.bak/
295
+ venv.bak/
296
+
297
+ # IDE
298
+ .idea/
299
+ .vscode/
300
+ *.swp
301
+ *.swo
302
+ *~
303
+
304
+ # OS
305
+ .DS_Store
306
+ .DS_Store?
307
+ ._*
308
+ .Spotlight-V100
309
+ .Trashes
310
+ ehthumbs.db
311
+ Thumbs.db
312
+
313
+ # Project specific
314
+ __version__.py
315
+ _private
@@ -0,0 +1,20 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.3.4
4
+ hooks:
5
+ - id: ruff
6
+ args: [--fix]
7
+ - id: ruff-format
8
+ args: [--respect-gitignore]
9
+ - repo: https://github.com/pre-commit/pre-commit-hooks
10
+ rev: v4.5.0
11
+ hooks:
12
+ - id: trailing-whitespace
13
+ - id: end-of-file-fixer
14
+ - id: check-yaml
15
+ - id: check-toml
16
+ - id: check-added-large-files
17
+ - id: debug-statements
18
+ - id: check-case-conflict
19
+ - id: mixed-line-ending
20
+ args: [--fix=lf]
@@ -0,0 +1,54 @@
1
+ # SpecStory Artifacts Directory
2
+
3
+ This directory is automatically created and maintained by the SpecStory extension to preserve your Cursor composer and chat history.
4
+
5
+ ## What's Here?
6
+
7
+ - `.specstory/history`: Contains markdown files of your AI coding sessions
8
+ - Each file represents a separate chat or composer session
9
+ - Files are automatically updated as you work
10
+
11
+ ## Valuable Uses
12
+
13
+ - Capture: Keep your context window up-to-date when starting new Chat/Composer sessions via @ references
14
+ - Search: For previous prompts and code snippets
15
+ - Learn: Meta-analyze your patterns and learn from your past experiences
16
+
17
+ ## Version Control
18
+
19
+ We recommend keeping this directory under version control to maintain a history of your AI interactions. However, if you prefer not to version these files, you can exclude them by adding this to your `.gitignore`:
20
+
21
+ ```
22
+ .specstory/**
23
+ ```
24
+
25
+ ## Searching Your Codebase
26
+
27
+ When searching your codebase in Cursor, search results may include your previous AI coding interactions. To focus solely on your actual code files, you can exclude the AI interaction history from search results.
28
+
29
+ To exclude AI interaction history:
30
+
31
+ 1. Open the "Find in Files" search in Cursor (Cmd/Ctrl + Shift + F)
32
+ 2. Navigate to the "files to exclude" section
33
+ 3. Add the following pattern:
34
+
35
+ ```
36
+ .specstory/*
37
+ ```
38
+
39
+ This will ensure your searches only return results from your working codebase files.
40
+
41
+ ## Notes
42
+
43
+ - Auto-save only works when Cursor/sqlite flushes data to disk. This results in a small delay after the AI response is complete before SpecStory can save the history.
44
+ - Auto-save does not yet work on remote WSL workspaces.
45
+
46
+ ## Settings
47
+
48
+ You can control auto-saving behavior in Cursor:
49
+
50
+ 1. Open Cursor → Settings → VS Code Settings (Cmd/Ctrl + ,)
51
+ 2. Search for "SpecStory"
52
+ 3. Find "Auto Save" setting to enable/disable
53
+
54
+ Auto-save occurs when changes are detected in Cursor's sqlite database, or every 2 minutes as a safety net.
@@ -0,0 +1,46 @@
1
+ ## SpecStory
2
+
3
+ ## Improving Python to Phiton Converter Implementation (02/03/2025, 09:14:08)
4
+
5
+ _**User**_
6
+
7
+ @phiton.md Read the Phiton spec code. Step back and think step by step, in @phiton.py write a more complete implementation of a converter from Python to Phiton, and at least partially back.
8
+
9
+ ---
10
+
11
+ _**Assistant**_
12
+
13
+ I'll help you implement the Phiton converter. Let me first analyze the specification and then implement the converter step by step.
14
+
15
+ ---
16
+
17
+ _****_
18
+
19
+ Read file: src/phiton/phiton.md
20
+
21
+ ---
22
+
23
+ _****_
24
+
25
+
26
+
27
+ Let me continue reading the rest of the specification to understand the complete conversion rules.
28
+
29
+ ---
30
+
31
+ _****_
32
+
33
+
34
+
35
+ ---
36
+
37
+ _****_
38
+
39
+
40
+
41
+ ---
42
+
43
+
44
+
45
+ ---
46
+