structured-text-formatter 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 (34) hide show
  1. structured_text_formatter-0.1.0/.gitattributes +2 -0
  2. structured_text_formatter-0.1.0/.github/workflows/ci.yml +23 -0
  3. structured_text_formatter-0.1.0/.github/workflows/release.yml +117 -0
  4. structured_text_formatter-0.1.0/.gitignore +18 -0
  5. structured_text_formatter-0.1.0/LICENSE +674 -0
  6. structured_text_formatter-0.1.0/PKG-INFO +175 -0
  7. structured_text_formatter-0.1.0/README.md +150 -0
  8. structured_text_formatter-0.1.0/azure-pipelines.yml +29 -0
  9. structured_text_formatter-0.1.0/examples/.stformat.toml +15 -0
  10. structured_text_formatter-0.1.0/examples/azure-pipelines-consumer.yml +10 -0
  11. structured_text_formatter-0.1.0/examples/github-actions-consumer.yml +16 -0
  12. structured_text_formatter-0.1.0/packaging/pyinstaller_entry.py +6 -0
  13. structured_text_formatter-0.1.0/pyproject.toml +42 -0
  14. structured_text_formatter-0.1.0/src/st_formatter/__init__.py +1 -0
  15. structured_text_formatter-0.1.0/src/st_formatter/__main__.py +6 -0
  16. structured_text_formatter-0.1.0/src/st_formatter/align.py +115 -0
  17. structured_text_formatter-0.1.0/src/st_formatter/blocks.py +135 -0
  18. structured_text_formatter-0.1.0/src/st_formatter/cli.py +181 -0
  19. structured_text_formatter-0.1.0/src/st_formatter/config.py +108 -0
  20. structured_text_formatter-0.1.0/src/st_formatter/formatter.py +40 -0
  21. structured_text_formatter-0.1.0/src/st_formatter/indent.py +89 -0
  22. structured_text_formatter-0.1.0/src/st_formatter/regions.py +101 -0
  23. structured_text_formatter-0.1.0/src/st_formatter/tokenizer.py +210 -0
  24. structured_text_formatter-0.1.0/src/st_formatter/validator.py +93 -0
  25. structured_text_formatter-0.1.0/tests/__init__.py +0 -0
  26. structured_text_formatter-0.1.0/tests/st_formatter/__init__.py +0 -0
  27. structured_text_formatter-0.1.0/tests/st_formatter/test_align.py +65 -0
  28. structured_text_formatter-0.1.0/tests/st_formatter/test_cli.py +86 -0
  29. structured_text_formatter-0.1.0/tests/st_formatter/test_config.py +114 -0
  30. structured_text_formatter-0.1.0/tests/st_formatter/test_indent.py +141 -0
  31. structured_text_formatter-0.1.0/tests/st_formatter/test_regions.py +76 -0
  32. structured_text_formatter-0.1.0/tests/st_formatter/test_roundtrip_idempotency.py +89 -0
  33. structured_text_formatter-0.1.0/tests/st_formatter/test_tokenizer.py +62 -0
  34. structured_text_formatter-0.1.0/tests/st_formatter/test_validator.py +59 -0
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
@@ -0,0 +1,23 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ os: [ubuntu-latest, windows-latest, macos-latest]
15
+ python-version: ["3.11", "3.12", "3.13"]
16
+ runs-on: ${{ matrix.os }}
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: actions/setup-python@v5
20
+ with:
21
+ python-version: ${{ matrix.python-version }}
22
+ - run: pip install -e .
23
+ - run: python -m unittest discover -s tests -t . -v
@@ -0,0 +1,117 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*.*.*"]
6
+
7
+ jobs:
8
+ check-version:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: actions/setup-python@v5
13
+ with:
14
+ python-version: "3.11"
15
+ - name: Verify tag matches package version
16
+ run: |
17
+ PKG_VERSION=$(python -c "import re; print(re.search(r'__version__ = \"([^\"]+)\"', open('src/st_formatter/__init__.py').read()).group(1))")
18
+ TAG_VERSION="${GITHUB_REF_NAME#v}"
19
+ if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
20
+ echo "::error::tag v$TAG_VERSION does not match package version $PKG_VERSION"
21
+ exit 1
22
+ fi
23
+
24
+ build-sdist-wheel:
25
+ needs: check-version
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ - uses: actions/setup-python@v5
30
+ with:
31
+ python-version: "3.11"
32
+ - run: pip install build
33
+ - run: python -m build
34
+ - uses: actions/upload-artifact@v4
35
+ with:
36
+ name: dist-sdist-wheel
37
+ path: dist/*
38
+
39
+ publish-pypi:
40
+ needs: build-sdist-wheel
41
+ runs-on: ubuntu-latest
42
+ environment: pypi
43
+ permissions:
44
+ id-token: write
45
+ steps:
46
+ - uses: actions/download-artifact@v4
47
+ with:
48
+ name: dist-sdist-wheel
49
+ path: dist
50
+ - uses: pypa/gh-action-pypi-publish@release/v1
51
+
52
+ build-executables:
53
+ needs: check-version
54
+ strategy:
55
+ fail-fast: false
56
+ matrix:
57
+ include:
58
+ - os: ubuntu-latest
59
+ asset_name: linux-x86_64
60
+ - os: windows-latest
61
+ asset_name: windows-x86_64
62
+ - os: macos-latest
63
+ asset_name: macos-arm64
64
+ runs-on: ${{ matrix.os }}
65
+ steps:
66
+ - uses: actions/checkout@v4
67
+ - uses: actions/setup-python@v5
68
+ with:
69
+ python-version: "3.11"
70
+ - run: pip install .[build]
71
+ - run: pyinstaller --onefile --name st-formatter packaging/pyinstaller_entry.py
72
+ - name: Smoke test
73
+ shell: bash
74
+ run: |
75
+ if [ -f dist/st-formatter.exe ]; then
76
+ ./dist/st-formatter.exe --version
77
+ else
78
+ ./dist/st-formatter --version
79
+ fi
80
+ - name: Package artifact
81
+ shell: bash
82
+ run: |
83
+ cd dist
84
+ TAG="${GITHUB_REF_NAME}"
85
+ if [ -f st-formatter.exe ]; then
86
+ OUT="st-formatter-${TAG}-${{ matrix.asset_name }}.exe"
87
+ mv st-formatter.exe "$OUT"
88
+ else
89
+ OUT="st-formatter-${TAG}-${{ matrix.asset_name }}"
90
+ mv st-formatter "$OUT"
91
+ fi
92
+ if command -v sha256sum >/dev/null 2>&1; then
93
+ sha256sum "$OUT" > "$OUT.sha256"
94
+ else
95
+ shasum -a 256 "$OUT" > "$OUT.sha256"
96
+ fi
97
+ - uses: actions/upload-artifact@v4
98
+ with:
99
+ name: dist-executable-${{ matrix.asset_name }}
100
+ path: |
101
+ dist/st-formatter-*
102
+
103
+ github-release:
104
+ needs: [publish-pypi, build-executables]
105
+ runs-on: ubuntu-latest
106
+ permissions:
107
+ contents: write
108
+ steps:
109
+ - uses: actions/download-artifact@v4
110
+ with:
111
+ pattern: dist-*
112
+ path: dist
113
+ merge-multiple: true
114
+ - uses: softprops/action-gh-release@v2
115
+ with:
116
+ files: dist/*
117
+ generate_release_notes: true
@@ -0,0 +1,18 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.pyc
4
+
5
+ # Environments
6
+ .env
7
+ .venv
8
+ env/
9
+ venv/
10
+ ENV/
11
+ env.bak/
12
+ venv.bak/
13
+
14
+ # Build / packaging artifacts
15
+ build/
16
+ dist/
17
+ *.egg-info/
18
+ *.spec