pyhone 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.
Files changed (57) hide show
  1. pyhone-0.1.0/.beads/redirect +1 -0
  2. pyhone-0.1.0/.github/workflows/ci.yml +78 -0
  3. pyhone-0.1.0/.github/workflows/release.yml +136 -0
  4. pyhone-0.1.0/.gitignore +212 -0
  5. pyhone-0.1.0/Cargo.lock +817 -0
  6. pyhone-0.1.0/Cargo.toml +12 -0
  7. pyhone-0.1.0/PKG-INFO +251 -0
  8. pyhone-0.1.0/README.md +227 -0
  9. pyhone-0.1.0/pyhone.toml +15 -0
  10. pyhone-0.1.0/pyproject.toml +34 -0
  11. pyhone-0.1.0/src/config.rs +97 -0
  12. pyhone-0.1.0/src/formatter.rs +180 -0
  13. pyhone-0.1.0/src/main.rs +96 -0
  14. pyhone-0.1.0/src/output.rs +121 -0
  15. pyhone-0.1.0/src/parser.rs +26 -0
  16. pyhone-0.1.0/src/rules/import_hoisting.rs +370 -0
  17. pyhone-0.1.0/src/rules/mod.rs +53 -0
  18. pyhone-0.1.0/src/rules/multiline_spacing.rs +766 -0
  19. pyhone-0.1.0/tests/fixtures/import_hoisting/async_function_import.py +4 -0
  20. pyhone-0.1.0/tests/fixtures/import_hoisting/class_method_import.py +4 -0
  21. pyhone-0.1.0/tests/fixtures/import_hoisting/import_from_inside_function.py +3 -0
  22. pyhone-0.1.0/tests/fixtures/import_hoisting/import_in_conditional.py +4 -0
  23. pyhone-0.1.0/tests/fixtures/import_hoisting/import_in_try_except_import_error_allowed.py +5 -0
  24. pyhone-0.1.0/tests/fixtures/import_hoisting/import_in_try_except_module_not_found_allowed.py +6 -0
  25. pyhone-0.1.0/tests/fixtures/import_hoisting/import_in_try_except_other_exception_flagged.py +5 -0
  26. pyhone-0.1.0/tests/fixtures/import_hoisting/import_inside_function.py +3 -0
  27. pyhone-0.1.0/tests/fixtures/import_hoisting/module_level_import_ok.py +6 -0
  28. pyhone-0.1.0/tests/fixtures/import_hoisting/nested_function_import.py +5 -0
  29. pyhone-0.1.0/tests/fixtures/multiline_spacing/blank_before_decorator_is_sufficient.py +8 -0
  30. pyhone-0.1.0/tests/fixtures/multiline_spacing/class_body_assignments_ignored.py +10 -0
  31. pyhone-0.1.0/tests/fixtures/multiline_spacing/class_body_blank_between_assignments_flagged.py +4 -0
  32. pyhone-0.1.0/tests/fixtures/multiline_spacing/class_body_methods_still_checked.py +7 -0
  33. pyhone-0.1.0/tests/fixtures/multiline_spacing/comment_attached_to_multiline_no_blank_needed.py +9 -0
  34. pyhone-0.1.0/tests/fixtures/multiline_spacing/comment_block_needs_blank_before_comment.py +8 -0
  35. pyhone-0.1.0/tests/fixtures/multiline_spacing/if_default_override_blank_removed.py +7 -0
  36. pyhone-0.1.0/tests/fixtures/multiline_spacing/if_else_default_override_blank_removed.py +9 -0
  37. pyhone-0.1.0/tests/fixtures/multiline_spacing/if_else_different_variables_kept.py +9 -0
  38. pyhone-0.1.0/tests/fixtures/multiline_spacing/if_guard_setup_blank_removed.py +7 -0
  39. pyhone-0.1.0/tests/fixtures/multiline_spacing/if_guard_unrelated_variable_kept.py +7 -0
  40. pyhone-0.1.0/tests/fixtures/multiline_spacing/loop_setup_annotated_assignment.py +6 -0
  41. pyhone-0.1.0/tests/fixtures/multiline_spacing/loop_setup_blank_removed.py +7 -0
  42. pyhone-0.1.0/tests/fixtures/multiline_spacing/loop_setup_no_blank_needed.py +6 -0
  43. pyhone-0.1.0/tests/fixtures/multiline_spacing/multiline_assignment_before_if_blank_kept.py +10 -0
  44. pyhone-0.1.0/tests/fixtures/multiline_spacing/multiline_assignment_before_loop_blank_kept.py +10 -0
  45. pyhone-0.1.0/tests/fixtures/multiline_spacing/multiline_class_header_no_blank_after.py +7 -0
  46. pyhone-0.1.0/tests/fixtures/multiline_spacing/multiline_function_header_no_blank_after.py +7 -0
  47. pyhone-0.1.0/tests/fixtures/multiline_spacing/multiline_if_header_needs_blank_before.py +6 -0
  48. pyhone-0.1.0/tests/fixtures/multiline_spacing/multiline_if_header_no_blank_after.py +7 -0
  49. pyhone-0.1.0/tests/fixtures/multiline_spacing/multiline_import_ignored.py +8 -0
  50. pyhone-0.1.0/tests/fixtures/multiline_spacing/multiline_with_header_no_blank_after.py +7 -0
  51. pyhone-0.1.0/tests/fixtures/multiline_spacing/multiline_with_spacing.py +8 -0
  52. pyhone-0.1.0/tests/fixtures/multiline_spacing/multiline_without_spacing.py +6 -0
  53. pyhone-0.1.0/tests/fixtures/multiline_spacing/nested_multiline_inside_function_body.py +11 -0
  54. pyhone-0.1.0/tests/fixtures/multiline_spacing/nested_multiline_with_spacing.py +14 -0
  55. pyhone-0.1.0/tests/fixtures/multiline_spacing/no_blank_between_decorator_and_def.py +7 -0
  56. pyhone-0.1.0/tests/fixtures/multiline_spacing/single_line_header_still_needs_blank_after.py +7 -0
  57. pyhone-0.1.0/tests/fixtures/multiline_spacing/single_line_no_spacing_needed.py +3 -0
@@ -0,0 +1 @@
1
+ ../../../.beads
@@ -0,0 +1,78 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+
9
+ jobs:
10
+ test:
11
+ name: Test
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Setup Rust
17
+ uses: actions-rust-lang/setup-rust-toolchain@v1
18
+ with:
19
+ toolchain: stable
20
+
21
+ - name: Cache cargo registry
22
+ uses: actions/cache@v4
23
+ with:
24
+ path: ~/.cargo/registry
25
+ key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
26
+
27
+ - name: Cache cargo index
28
+ uses: actions/cache@v4
29
+ with:
30
+ path: ~/.cargo/git
31
+ key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
32
+
33
+ - name: Cache cargo build
34
+ uses: actions/cache@v4
35
+ with:
36
+ path: target
37
+ key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
38
+
39
+ - name: Run tests
40
+ run: cargo test
41
+
42
+ - name: Build
43
+ run: cargo build --release
44
+
45
+ lint:
46
+ name: Lint
47
+ runs-on: ubuntu-latest
48
+ steps:
49
+ - uses: actions/checkout@v4
50
+
51
+ - name: Setup Rust
52
+ uses: actions-rust-lang/setup-rust-toolchain@v1
53
+ with:
54
+ toolchain: stable
55
+ components: clippy
56
+
57
+ - name: Run clippy
58
+ run: cargo clippy -- -D warnings
59
+
60
+ maturin:
61
+ name: Maturin Build
62
+ runs-on: ubuntu-latest
63
+ steps:
64
+ - uses: actions/checkout@v4
65
+
66
+ - uses: actions/setup-python@v5
67
+ with:
68
+ python-version: '3.12'
69
+
70
+ - name: Build wheel
71
+ uses: PyO3/maturin-action@v1
72
+ with:
73
+ args: --release --out dist
74
+
75
+ - name: Install and test
76
+ run: |
77
+ pip install dist/*.whl
78
+ pyhone --help
@@ -0,0 +1,136 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: write
11
+
12
+ jobs:
13
+ linux:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ target: [x86_64, aarch64]
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - uses: actions/setup-python@v5
22
+ with:
23
+ python-version: '3.12'
24
+
25
+ - name: Build wheels
26
+ uses: PyO3/maturin-action@v1
27
+ with:
28
+ target: ${{ matrix.target }}
29
+ args: --release --out dist
30
+ manylinux: auto
31
+
32
+ - name: Upload wheels
33
+ uses: actions/upload-artifact@v4
34
+ with:
35
+ name: wheels-linux-${{ matrix.target }}
36
+ path: dist
37
+
38
+ windows:
39
+ runs-on: windows-latest
40
+ steps:
41
+ - uses: actions/checkout@v4
42
+
43
+ - uses: actions/setup-python@v5
44
+ with:
45
+ python-version: '3.12'
46
+ architecture: x64
47
+
48
+ - name: Build wheels
49
+ uses: PyO3/maturin-action@v1
50
+ with:
51
+ args: --release --out dist
52
+
53
+ - name: Upload wheels
54
+ uses: actions/upload-artifact@v4
55
+ with:
56
+ name: wheels-windows-x64
57
+ path: dist
58
+
59
+ macos:
60
+ runs-on: macos-latest
61
+ strategy:
62
+ matrix:
63
+ target: [x86_64, aarch64]
64
+ steps:
65
+ - uses: actions/checkout@v4
66
+
67
+ - uses: actions/setup-python@v5
68
+ with:
69
+ python-version: '3.12'
70
+
71
+ - name: Build wheels
72
+ uses: PyO3/maturin-action@v1
73
+ with:
74
+ target: ${{ matrix.target }}
75
+ args: --release --out dist
76
+
77
+ - name: Upload wheels
78
+ uses: actions/upload-artifact@v4
79
+ with:
80
+ name: wheels-macos-${{ matrix.target }}
81
+ path: dist
82
+
83
+ sdist:
84
+ runs-on: ubuntu-latest
85
+ steps:
86
+ - uses: actions/checkout@v4
87
+
88
+ - name: Build sdist
89
+ uses: PyO3/maturin-action@v1
90
+ with:
91
+ command: sdist
92
+ args: --out dist
93
+
94
+ - name: Upload sdist
95
+ uses: actions/upload-artifact@v4
96
+ with:
97
+ name: wheels-sdist
98
+ path: dist
99
+
100
+ github-release:
101
+ name: Create GitHub Release
102
+ runs-on: ubuntu-latest
103
+ needs: [linux, windows, macos, sdist]
104
+ if: startsWith(github.ref, 'refs/tags/')
105
+ steps:
106
+ - name: Download all wheels
107
+ uses: actions/download-artifact@v4
108
+ with:
109
+ path: wheels
110
+ merge-multiple: true
111
+
112
+ - name: Create release
113
+ uses: softprops/action-gh-release@v2
114
+ with:
115
+ files: wheels/*
116
+ generate_release_notes: true
117
+
118
+ publish:
119
+ name: Publish to PyPI
120
+ runs-on: ubuntu-latest
121
+ needs: [linux, windows, macos, sdist]
122
+ if: startsWith(github.ref, 'refs/tags/')
123
+ permissions:
124
+ id-token: write
125
+ steps:
126
+ - name: Download all wheels
127
+ uses: actions/download-artifact@v4
128
+ with:
129
+ path: dist
130
+ merge-multiple: true
131
+
132
+ - name: Publish to PyPI
133
+ uses: PyO3/maturin-action@v1
134
+ with:
135
+ command: upload
136
+ args: --non-interactive --skip-existing dist/*
@@ -0,0 +1,212 @@
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
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
208
+
209
+
210
+ # Added by cargo
211
+
212
+ /target