annot8 0.12.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.
@@ -0,0 +1,66 @@
1
+ # File: .github/workflows/publish.yml
2
+
3
+ name: Publish to PyPI
4
+
5
+ on:
6
+ release:
7
+ types: [published]
8
+ workflow_dispatch:
9
+ inputs:
10
+ version:
11
+ description: 'Version to publish (e.g., 0.10.0)'
12
+ required: true
13
+ type: string
14
+ test_pypi:
15
+ description: 'Publish to TestPyPI instead'
16
+ required: false
17
+ default: false
18
+ type: boolean
19
+
20
+ jobs:
21
+ build-and-publish:
22
+ runs-on: ubuntu-latest
23
+ environment:
24
+ name: pypi
25
+ permissions:
26
+ contents: read
27
+ id-token: write # For trusted publishing
28
+
29
+ steps:
30
+ - name: Checkout code
31
+ uses: actions/checkout@v4
32
+ with:
33
+ fetch-depth: 0 # Required for setuptools_scm
34
+
35
+ - name: Set up Python
36
+ uses: actions/setup-python@v5
37
+ with:
38
+ python-version: "3.11"
39
+
40
+ - name: Install build dependencies
41
+ run: |
42
+ python -m pip install --upgrade pip
43
+ pip install build twine
44
+
45
+ - name: Build package
46
+ run: |
47
+ python -m build
48
+
49
+ - name: Check package
50
+ run: |
51
+ twine check dist/*
52
+
53
+ - name: Publish to TestPyPI (if requested)
54
+ if: github.event.inputs.test_pypi == 'true'
55
+ uses: pypa/gh-action-pypi-publish@release/v1
56
+ with:
57
+ repository-url: https://test.pypi.org/legacy/
58
+ # For TestPyPI, you may need to use an API token
59
+ # Set TEST_PYPI_API_TOKEN in repository secrets
60
+ password: ${{ secrets.TEST_PYPI_API_TOKEN }}
61
+
62
+ - name: Publish to PyPI
63
+ if: github.event.inputs.test_pypi != 'true'
64
+ uses: pypa/gh-action-pypi-publish@release/v1
65
+ # Uses trusted publishing (OIDC) - no password needed
66
+ # Configure in PyPI account settings → Account settings → Trusted publishers
@@ -0,0 +1,56 @@
1
+ # File: .github/workflows/python-package.yml
2
+
3
+ name: Python Package
4
+
5
+ on:
6
+ push:
7
+ branches: [main, master]
8
+ pull_request:
9
+ branches: [main, master]
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - name: Set up Python ${{ matrix.python-version }}
22
+ uses: actions/setup-python@v4
23
+ with:
24
+ python-version: ${{ matrix.python-version }}
25
+
26
+ - name: Install dependencies
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ python -m pip install flake8 pytest pytest-cov black pylint
30
+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
31
+ if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
32
+ pip install -e .
33
+
34
+ - name: Format with black
35
+ run: |
36
+ black --check .
37
+
38
+ - name: Lint with flake8
39
+ run: |
40
+ # stop the build if there are Python syntax errors or undefined names
41
+ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
42
+ # exit-zero treats all errors as warnings
43
+ flake8 . --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics
44
+
45
+ - name: Lint with pylint
46
+ run: |
47
+ pylint src tests --disable=C0111,R0913,R0914,C0103
48
+
49
+ - name: Test with pytest
50
+ run: |
51
+ pytest --cov=annot8 tests/
52
+
53
+ - name: Upload coverage report
54
+ uses: codecov/codecov-action@v3
55
+ with:
56
+ fail_ci_if_error: false
@@ -0,0 +1,120 @@
1
+ # File: .github/workflows/workflow.yml
2
+
3
+ name: CI/CD Workflow
4
+
5
+ on:
6
+ push:
7
+ branches: [main, master]
8
+ pull_request:
9
+ branches: [main, master]
10
+ release:
11
+ types: [published]
12
+ workflow_dispatch:
13
+ inputs:
14
+ version:
15
+ description: 'Version to publish (e.g., 0.11.0)'
16
+ required: false
17
+ type: string
18
+ test_pypi:
19
+ description: 'Publish to TestPyPI instead'
20
+ required: false
21
+ default: false
22
+ type: boolean
23
+
24
+ jobs:
25
+ test:
26
+ name: Test and Lint
27
+ runs-on: ubuntu-latest
28
+ strategy:
29
+ fail-fast: false
30
+ matrix:
31
+ python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
32
+
33
+ steps:
34
+ - name: Checkout code
35
+ uses: actions/checkout@v4
36
+
37
+ - name: Set up Python ${{ matrix.python-version }}
38
+ uses: actions/setup-python@v5
39
+ with:
40
+ python-version: ${{ matrix.python-version }}
41
+
42
+ - name: Install dependencies
43
+ run: |
44
+ python -m pip install --upgrade pip
45
+ python -m pip install flake8 pytest pytest-cov black pylint
46
+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
47
+ if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
48
+ pip install -e .
49
+
50
+ - name: Format with black
51
+ run: |
52
+ black --check .
53
+
54
+ - name: Lint with flake8
55
+ run: |
56
+ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
57
+ flake8 . --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics
58
+
59
+ - name: Lint with pylint
60
+ run: |
61
+ pylint src tests --disable=C0111,R0913,R0914,C0103
62
+
63
+ - name: Test with pytest
64
+ run: |
65
+ pytest --cov=annot8 tests/
66
+
67
+ - name: Upload coverage report
68
+ uses: codecov/codecov-action@v3
69
+ with:
70
+ fail_ci_if_error: false
71
+
72
+ publish:
73
+ name: Publish to PyPI
74
+ runs-on: ubuntu-latest
75
+ needs: test
76
+ if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.version)
77
+ environment:
78
+ name: pypi
79
+ permissions:
80
+ contents: read
81
+ id-token: write # For trusted publishing
82
+
83
+ steps:
84
+ - name: Checkout code
85
+ uses: actions/checkout@v4
86
+ with:
87
+ fetch-depth: 0 # Required for setuptools_scm
88
+
89
+ - name: Set up Python
90
+ uses: actions/setup-python@v5
91
+ with:
92
+ python-version: "3.11"
93
+
94
+ - name: Install build dependencies
95
+ run: |
96
+ python -m pip install --upgrade pip
97
+ pip install build twine
98
+
99
+ - name: Build package
100
+ run: |
101
+ python -m build
102
+
103
+ - name: Check package
104
+ run: |
105
+ twine check dist/*
106
+
107
+ - name: Publish to TestPyPI (if requested)
108
+ if: github.event.inputs.test_pypi == 'true'
109
+ uses: pypa/gh-action-pypi-publish@release/v1
110
+ with:
111
+ repository-url: https://test.pypi.org/legacy/
112
+ # For TestPyPI, you may need to use an API token
113
+ # Set TEST_PYPI_API_TOKEN in repository secrets
114
+ password: ${{ secrets.TEST_PYPI_API_TOKEN }}
115
+
116
+ - name: Publish to PyPI
117
+ if: github.event.inputs.test_pypi != 'true'
118
+ uses: pypa/gh-action-pypi-publish@release/v1
119
+ # Uses trusted publishing (OIDC) - no password needed
120
+ # Configure in PyPI account settings → Account settings → Trusted publishers
@@ -0,0 +1,212 @@
1
+ # File: .gitignore
2
+ # Byte-compiled / optimized / DLL files
3
+
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+
8
+ # C extensions
9
+ *.so
10
+
11
+ # Distribution / packaging
12
+ .Python
13
+ build/
14
+ develop-eggs/
15
+ dist/
16
+ downloads/
17
+ eggs/
18
+ .eggs/
19
+ lib/
20
+ lib64/
21
+ parts/
22
+ sdist/
23
+ var/
24
+ wheels/
25
+ share/python-wheels/
26
+ *.egg-info/
27
+ .installed.cfg
28
+ *.egg
29
+ MANIFEST
30
+
31
+ # PyInstaller
32
+ # Usually these files are written by a python script from a template
33
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
34
+ *.manifest
35
+ *.spec
36
+
37
+ # Installer logs
38
+ pip-log.txt
39
+ pip-delete-this-directory.txt
40
+
41
+ # Unit test / coverage reports
42
+ htmlcov/
43
+ .tox/
44
+ .nox/
45
+ .coverage
46
+ .coverage.*
47
+ .cache
48
+ nosetests.xml
49
+ coverage.xml
50
+ *.cover
51
+ *.py,cover
52
+ .hypothesis/
53
+ .pytest_cache/
54
+ cover/
55
+
56
+ # Translations
57
+ *.mo
58
+ *.pot
59
+
60
+ # Django stuff:
61
+ *.log
62
+ local_settings.py
63
+ db.sqlite3
64
+ db.sqlite3-journal
65
+
66
+ # Flask stuff:
67
+ instance/
68
+ .webassets-cache
69
+
70
+ # Scrapy stuff:
71
+ .scrapy
72
+
73
+ # Sphinx documentation
74
+ docs/_build/
75
+
76
+ # PyBuilder
77
+ .pybuilder/
78
+ target/
79
+
80
+ # Jupyter Notebook
81
+ .ipynb_checkpoints
82
+
83
+ # IPython
84
+ profile_default/
85
+ ipython_config.py
86
+
87
+ # pyenv
88
+ # For a library or package, you might want to ignore these files since the code is
89
+ # intended to run in multiple environments; otherwise, check them in:
90
+ # .python-version
91
+
92
+ # pipenv
93
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
94
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
95
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
96
+ # install all needed dependencies.
97
+ #Pipfile.lock
98
+
99
+ # UV
100
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
101
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
102
+ # commonly ignored for libraries.
103
+ #uv.lock
104
+
105
+ # poetry
106
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
107
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
108
+ # commonly ignored for libraries.
109
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
110
+ #poetry.lock
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ #pdm.lock
115
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
116
+ # in version control.
117
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
118
+ .pdm.toml
119
+ .pdm-python
120
+ .pdm-build/
121
+
122
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
123
+ __pypackages__/
124
+
125
+ # Celery stuff
126
+ celerybeat-schedule
127
+ celerybeat.pid
128
+
129
+ # SageMath parsed files
130
+ *.sage.py
131
+
132
+ # Environments
133
+ .env
134
+ .venv
135
+ env/
136
+ venv/
137
+ ENV/
138
+ env.bak/
139
+ venv.bak/
140
+
141
+ # Spyder project settings
142
+ .spyderproject
143
+ .spyproject
144
+
145
+ # Rope project settings
146
+ .ropeproject
147
+
148
+ # mkdocs documentation
149
+ /site
150
+
151
+ # mypy
152
+ .mypy_cache/
153
+ .dmypy.json
154
+ dmypy.json
155
+
156
+ # Pyre type checker
157
+ .pyre/
158
+
159
+ # pytype static type analyzer
160
+ .pytype/
161
+
162
+ # Cython debug symbols
163
+ cython_debug/
164
+
165
+ # PyCharm
166
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
167
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
168
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
169
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
170
+ #.idea/
171
+
172
+ # PyPI configuration file
173
+ .pypirc
174
+
175
+ # Custom
176
+ tree.txt
177
+ test.txt
178
+ pytest.txt
179
+ pylint.txt
180
+ # General
181
+ .DS_Store
182
+ .AppleDouble
183
+ .LSOverride
184
+
185
+ # Icon must end with two \r
186
+ Icon
187
+
188
+ # Thumbnails
189
+ ._*
190
+
191
+ # Files that might appear in the root of a volume
192
+ .DocumentRevisions-V100
193
+ .fseventsd
194
+ .Spotlight-V100
195
+ .TemporaryItems
196
+ .Trashes
197
+ .VolumeIcon.icns
198
+ .com.apple.timemachine.donotpresent
199
+
200
+ # Directories potentially created on remote AFP share
201
+ .AppleDB
202
+ .AppleDesktop
203
+ Network Trash Folder
204
+ Temporary Items
205
+ .apdisk
206
+
207
+ black.txt
208
+
209
+ .github/*.md
210
+
211
+ .cursor/
212
+ CLAUDE.md
@@ -0,0 +1,3 @@
1
+ {
2
+ "python-envs.defaultEnvManager": "ms-python.python:venv"
3
+ }
@@ -0,0 +1,100 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.12.1] - 2026-02-28
9
+
10
+ ### Added
11
+ - **Legacy package compatibility alias**: Added `src/pyannotate` as a compatibility shim that proxies to `annot8`.
12
+ - Enables legacy lint/test commands such as `pylint src/pyannotate tests`
13
+ - Preserves behavior through lazy proxy functions (`process_file`, `walk_directory`, `main`)
14
+
15
+ - **Pytest startup hook**: Added `tests/conftest.py` to centralize test marker registration and ensure compatibility imports for coverage workflows.
16
+
17
+ ### Changed
18
+ - **Development dependencies**: Added `PyYAML` to `requirements-dev.txt` so YAML template tests run by default in the dev environment.
19
+ - **Template test maintenance**: Refactored duplicated setup logic in template tests into shared utilities (`tests/test_utils.py`), reducing duplication and keeping lint score at `10.00/10`.
20
+
21
+ ### Fixed
22
+ - **Pylint fatal target mismatch**: Removed `F0001` failure when linting `src/pyannotate`.
23
+ - **Template test skip behavior in standard dev setup**: YAML-specific tests now run instead of being skipped once dev dependencies are installed.
24
+
25
+ ---
26
+
27
+ ## [0.12.0] - 2026-02-28
28
+
29
+ ### Added
30
+
31
+ #### Documentation
32
+ - **Comprehensive Template System Documentation**: Added extensive "Template System" section to README.md with 15+ practical examples
33
+ - Complete variable reference table with all 9 template variables
34
+ - Examples for YAML, JSON, and TOML configuration formats
35
+ - Comment style adaptation examples for Python, JavaScript, CSS, HTML, SQL
36
+ - Git metadata integration guide
37
+ - Best practices and advanced scenarios (corporate, open source templates)
38
+ - Different templates for different projects guide
39
+
40
+ - **Enhanced README**: Completely restructured Key Features section with categorized capabilities
41
+ - 🎯 Intelligent Header Management
42
+ - 🌍 Comprehensive Language Support (70+ Languages)
43
+ - 🛡️ Smart File Protection
44
+ - 🔧 Git Integration
45
+ - ⚙️ Flexible Configuration
46
+ - 🔒 Safety & Reliability
47
+ - 💻 Developer Experience
48
+ - Added Quick Start section for new users
49
+ - Enhanced Python API examples with all available options
50
+ - Expanded Protected Files & Directories section with detailed categorization
51
+
52
+ - **Development Guide**: Created CLAUDE.md with comprehensive development instructions
53
+ - Core architecture overview
54
+ - Module organization details
55
+ - Key design patterns (header detection, special declaration preservation, idempotent operations)
56
+ - Development commands (testing, linting, building)
57
+ - Testing patterns and organization
58
+ - Configuration system explanation
59
+ - CI/CD and code style guidelines
60
+
61
+ #### Testing
62
+ - **Comprehensive Template Test Suite**: Added 38 new tests in test_templates_comprehensive.py
63
+ - TestTemplateVariables (9 tests): All template variables
64
+ - TestTemplateFallbackValues (5 tests): Fallback syntax with various scenarios
65
+ - TestMultiLineTemplates (3 tests): Multi-line template rendering
66
+ - TestTemplateCommentStyles (7 tests): Adaptation to different comment styles
67
+ - TestTemplateWithSpecialCases (4 tests): Shebang, XML, DOCTYPE preservation
68
+ - TestTemplateConfigFormats (3 tests): YAML, JSON, TOML configurations
69
+ - TestTemplateEdgeCases (4 tests): Edge cases and error handling
70
+ - TestTemplateIntegration (3 tests): Integration with other features
71
+
72
+ - **Test Coverage**: Template system now has 100% test coverage
73
+ - 36 tests passing, 2 skipped (YAML tests when PyYAML not installed)
74
+ - Total project tests: 236+ tests
75
+
76
+ ### Fixed
77
+ - **Code Quality**: Resolved all pylint issues (10.00/10)
78
+ - Fixed implicit string concatenation
79
+ - Moved imports to module level
80
+ - Fixed long lines (>100 characters)
81
+
82
+ ### Changed
83
+ - Reorganized README.md structure for better user experience
84
+ - Enhanced Python API documentation with comprehensive examples
85
+ - Improved categorization of ignored files and directories
86
+
87
+ ---
88
+
89
+ ## [0.11.1] - Previous Release
90
+
91
+ ### Features
92
+ - Enhanced CommonJS and ES Module support
93
+ - Improved header detection and merging
94
+ - Git integration with pre-commit hooks
95
+
96
+ ---
97
+
98
+ [0.12.1]: https://github.com/soulwax/annot8/compare/v0.12.0...v0.12.1
99
+ [0.12.0]: https://github.com/soulwax/annot8/compare/v0.11.1...v0.12.0
100
+ [0.11.1]: https://github.com/soulwax/annot8/releases/tag/v0.11.1