msiltop 0.2.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.
@@ -0,0 +1,100 @@
1
+ name: ๐Ÿงช CI Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: macos-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
15
+
16
+ steps:
17
+ - name: ๐Ÿ“ฅ Checkout repository
18
+ uses: actions/checkout@v4
19
+
20
+ - name: ๐Ÿ Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: โšก Install UV
26
+ uses: astral-sh/setup-uv@v6
27
+ with:
28
+ enable-cache: true
29
+
30
+ - name: ๐Ÿ”จ Build package
31
+ run: |
32
+ uv build
33
+ echo "โœ… Package built successfully"
34
+ ls -la dist/
35
+
36
+ - name: ๐Ÿงช Test package build
37
+ run: |
38
+ echo "๐Ÿงช Testing package functionality..."
39
+
40
+ # Test help command works
41
+ sudo uv run msiltop --help
42
+ echo "โœ… Help command works"
43
+
44
+ # Test package can be imported
45
+ uv run python -c "import msiltop.msiltop; print('โœ… Package imports successfully')"
46
+
47
+ # Test CLI entry point exists
48
+ if command -v msiltop >/dev/null 2>&1 || uv run which msiltop >/dev/null 2>&1; then
49
+ echo "โœ… CLI entry point found"
50
+ else
51
+ echo "โš ๏ธ CLI entry point not in PATH (expected in development)"
52
+ fi
53
+
54
+ - name: ๐Ÿ“ฆ Test wheel installation
55
+ run: |
56
+ echo "๐Ÿงช Testing wheel installation..."
57
+
58
+ # Create test environment and install wheel
59
+ python -m venv test_wheel
60
+ source test_wheel/bin/activate
61
+
62
+ # Install the built wheel
63
+ pip install dist/*.whl
64
+
65
+ # Test import in clean environment
66
+ python -c "import msiltop.msiltop; print('โœ… Wheel installs and imports correctly')"
67
+
68
+ # Clean up
69
+ deactivate
70
+ rm -rf test_wheel
71
+
72
+ lint:
73
+ runs-on: ubuntu-latest
74
+ steps:
75
+ - name: ๐Ÿ“ฅ Checkout repository
76
+ uses: actions/checkout@v4
77
+
78
+ - name: ๐Ÿ Set up Python
79
+ uses: actions/setup-python@v5
80
+ with:
81
+ python-version: "3.11"
82
+
83
+ - name: โšก Install UV
84
+ uses: astral-sh/setup-uv@v6
85
+
86
+ - name: ๐Ÿ” Check package metadata
87
+ run: |
88
+ echo "๐Ÿ” Checking package configuration..."
89
+
90
+ # Validate pyproject.toml syntax
91
+ python -c "import tomllib; tomllib.load(open('pyproject.toml', 'rb'))" 2>/dev/null && echo "โœ… pyproject.toml syntax valid" || echo "โŒ pyproject.toml syntax invalid"
92
+
93
+ # Check required fields exist
94
+ uv run python -c "import tomllib; config = tomllib.load(open('pyproject.toml', 'rb')); project = config.get('project', {}); required = ['name', 'version', 'description', 'authors']; [print(f'โœ… {field}: {project[field]}') for field in required if field in project]; exit(1) if not all(field in project for field in required) else print('โœ… All required package metadata present')"
95
+
96
+ - name: ๐Ÿ” Validate dependencies
97
+ run: |
98
+ echo "๐Ÿ” Checking dependencies..."
99
+ uv lock --check-hash || echo "โš ๏ธ Lock file may need updating"
100
+ echo "โœ… Dependencies check complete"
@@ -0,0 +1,296 @@
1
+ name: ๐Ÿš€ Release to PyPI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ bump_type:
7
+ description: "Type of version bump"
8
+ required: true
9
+ default: "patch"
10
+ type: choice
11
+ options:
12
+ - patch
13
+ - minor
14
+ - major
15
+ create_github_release:
16
+ description: "Create GitHub release"
17
+ required: true
18
+ default: true
19
+ type: boolean
20
+
21
+ jobs:
22
+ release:
23
+ runs-on: ubuntu-latest
24
+ environment: release
25
+ permissions:
26
+ contents: write
27
+ id-token: write # For PyPI trusted publishing
28
+
29
+ steps:
30
+ - name: ๐Ÿ“ฅ Checkout repository
31
+ uses: actions/checkout@v4
32
+ with:
33
+ fetch-depth: 0
34
+
35
+ - name: ๐Ÿ Set up Python
36
+ uses: actions/setup-python@v5
37
+ with:
38
+ python-version: "3.11"
39
+
40
+ - name: โšก Install UV
41
+ uses: astral-sh/setup-uv@v6
42
+ with:
43
+ enable-cache: true
44
+
45
+ - name: ๐Ÿ“ Calculate new version
46
+ id: version
47
+ run: |
48
+ BUMP_TYPE="${{ github.event.inputs.bump_type }}"
49
+ echo "Bump type: $BUMP_TYPE"
50
+
51
+ # Get current version from pyproject.toml
52
+ CURRENT_VERSION=$(grep "version = \".*\"" pyproject.toml | sed -n 's/version = "\(.*\)"/\1/p')
53
+ echo "Current version: $CURRENT_VERSION"
54
+
55
+ # Split version into components
56
+ IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
57
+
58
+ # Calculate new version based on bump type
59
+ case $BUMP_TYPE in
60
+ "major")
61
+ MAJOR=$((MAJOR + 1))
62
+ MINOR=0
63
+ PATCH=0
64
+ ;;
65
+ "minor")
66
+ MINOR=$((MINOR + 1))
67
+ PATCH=0
68
+ ;;
69
+ "patch")
70
+ PATCH=$((PATCH + 1))
71
+ ;;
72
+ *)
73
+ echo "โŒ Invalid bump type: $BUMP_TYPE"
74
+ exit 1
75
+ ;;
76
+ esac
77
+
78
+ NEW_VERSION="$MAJOR.$MINOR.$PATCH"
79
+ echo "New version will be: $NEW_VERSION"
80
+
81
+ # Store versions for later use
82
+ echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
83
+ echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
84
+ echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
85
+ echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
86
+
87
+ - name: ๐Ÿ“ Update version in pyproject.toml (local only)
88
+ run: |
89
+ # Update version in pyproject.toml locally (don't commit yet)
90
+ sed -i "s/version = \".*\"/version = \"$NEW_VERSION\"/" pyproject.toml
91
+
92
+ # Verify the version was updated
93
+ grep "version = \"$NEW_VERSION\"" pyproject.toml || exit 1
94
+ echo "โœ… Version updated locally from $CURRENT_VERSION to $NEW_VERSION"
95
+
96
+ - name: ๐Ÿงน Clean previous builds
97
+ run: |
98
+ rm -rf dist/
99
+ rm -rf build/
100
+ rm -rf *.egg-info/
101
+ echo "โœ… Cleaned previous builds"
102
+
103
+ - name: ๐Ÿ”จ Build package
104
+ run: |
105
+ uv build
106
+ echo "โœ… Package built successfully"
107
+
108
+ # List build artifacts
109
+ echo "๐Ÿ“ฆ Build artifacts:"
110
+ ls -la dist/
111
+
112
+ - name: ๐Ÿงช Test build
113
+ run: |
114
+ echo "๐Ÿงช Testing package build..."
115
+
116
+ # Test that the package can be imported and help works
117
+ uv run msiltop --help
118
+
119
+ # Verify the version in the built package
120
+ if ls dist/msiltop-${NEW_VERSION}-*.whl 1> /dev/null 2>&1; then
121
+ echo "โœ… Wheel file with correct version found"
122
+ else
123
+ echo "โŒ Wheel file with version $NEW_VERSION not found"
124
+ ls dist/
125
+ exit 1
126
+ fi
127
+
128
+ if ls dist/msiltop-${NEW_VERSION}.tar.gz 1> /dev/null 2>&1; then
129
+ echo "โœ… Source distribution with correct version found"
130
+ else
131
+ echo "โŒ Source distribution with version $NEW_VERSION not found"
132
+ ls dist/
133
+ exit 1
134
+ fi
135
+
136
+ - name: ๐Ÿ“ฆ Publish to PyPI
137
+ id: pypi_publish
138
+ uses: pypa/gh-action-pypi-publish@release/v1
139
+ with:
140
+ print-hash: true
141
+ verbose: true
142
+
143
+ - name: โœ… Verify PyPI publication
144
+ id: verify_pypi
145
+ run: |
146
+ echo "โณ Waiting for PyPI to update..."
147
+ sleep 30
148
+
149
+ # Check if package is available on PyPI
150
+ for i in {1..10}; do
151
+ if pip index versions msiltop | grep -q "$NEW_VERSION"; then
152
+ echo "โœ… Package version $NEW_VERSION found on PyPI"
153
+ echo "pypi_verified=true" >> $GITHUB_OUTPUT
154
+ break
155
+ else
156
+ echo "โณ Attempt $i: Package not yet available, waiting..."
157
+ sleep 30
158
+ fi
159
+
160
+ if [ $i -eq 10 ]; then
161
+ echo "โŒ Package not found on PyPI after 5 minutes"
162
+ echo "pypi_verified=false" >> $GITHUB_OUTPUT
163
+ exit 1
164
+ fi
165
+ done
166
+
167
+ - name: ๐Ÿงช Test PyPI installation
168
+ if: steps.verify_pypi.outputs.pypi_verified == 'true'
169
+ run: |
170
+ echo "๐Ÿงช Testing installation from PyPI..."
171
+
172
+ # Create a fresh virtual environment and test installation
173
+ python -m venv test_env
174
+ source test_env/bin/activate
175
+
176
+ # Install from PyPI
177
+ pip install "msiltop==$NEW_VERSION"
178
+
179
+ # Test that it works
180
+ echo "Testing msiltop --help (without sudo in CI)"
181
+ python -c "import msiltop.msiltop as mt; print('โœ… Package imports successfully')"
182
+
183
+ # Clean up
184
+ deactivate
185
+ rm -rf test_env
186
+ echo "โœ… PyPI installation test passed"
187
+
188
+ - name: ๐Ÿท๏ธ Create and push git tag
189
+ if: steps.verify_pypi.outputs.pypi_verified == 'true'
190
+ id: git_tag
191
+ run: |
192
+ git config user.name "github-actions[bot]"
193
+ git config user.email "github-actions[bot]@users.noreply.github.com"
194
+
195
+ # Commit version change
196
+ git add pyproject.toml
197
+ git commit -m "๐Ÿ”– Bump version to $NEW_VERSION"
198
+
199
+ # Create and push tag
200
+ git tag "v$NEW_VERSION"
201
+ git push origin main
202
+ git push origin "v$NEW_VERSION"
203
+ echo "โœ… Git tag v$NEW_VERSION created and pushed"
204
+ echo "git_tagged=true" >> $GITHUB_OUTPUT
205
+
206
+ - name: ๐Ÿ“‹ Generate release notes
207
+ if: steps.git_tag.outputs.git_tagged == 'true'
208
+ run: |
209
+ cat > release_notes.md << EOF
210
+ # MSILTOP v$NEW_VERSION
211
+
212
+ ## ๐Ÿš€ What's New
213
+
214
+ This release includes improvements and updates to MSILTOP.
215
+
216
+ ## ๐Ÿ“ฆ Installation
217
+
218
+ \`\`\`bash
219
+ # Install or upgrade via pip
220
+ pip install msiltop --upgrade
221
+
222
+ # Install or upgrade via UV
223
+ uv add msiltop
224
+
225
+ # Run directly with UV (on macOS, use sudo)
226
+ sudo uv run msiltop
227
+ \`\`\`
228
+
229
+ ## ๐Ÿ”ง System Requirements
230
+
231
+ - **Hardware:** Apple Silicon Mac (M1, M2, M3, M4+)
232
+ - **OS:** macOS Monterey (12.0) or later
233
+ - **Python:** 3.8+ (automatically managed with UV)
234
+ - **Privileges:** Root access required for powermetrics
235
+
236
+ ## ๐Ÿท๏ธ Package Information
237
+
238
+ - **PyPI:** https://pypi.org/project/msiltop/$NEW_VERSION/
239
+ - **Wheel:** \`msiltop-$NEW_VERSION-py3-none-any.whl\`
240
+ - **Source:** \`msiltop-$NEW_VERSION.tar.gz\`
241
+
242
+ ---
243
+
244
+ **Full Changelog:** https://github.com/pratikdevnani/msiltop/compare/v$(git describe --tags --abbrev=0 HEAD~1)...v$NEW_VERSION
245
+ EOF
246
+
247
+ - name: ๐ŸŽ‰ Create GitHub Release
248
+ if: ${{ github.event.inputs.create_github_release == 'true' && steps.git_tag.outputs.git_tagged == 'true' }}
249
+ uses: softprops/action-gh-release@v1
250
+ with:
251
+ tag_name: v${{ env.NEW_VERSION }}
252
+ name: "MSILTOP v${{ env.NEW_VERSION }}"
253
+ body_path: release_notes.md
254
+ files: |
255
+ dist/*.whl
256
+ dist/*.tar.gz
257
+ draft: false
258
+ prerelease: false
259
+ generate_release_notes: true
260
+ env:
261
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
262
+
263
+ - name: ๐ŸŽŠ Release Summary
264
+ if: steps.git_tag.outputs.git_tagged == 'true'
265
+ run: |
266
+ echo "## ๐ŸŽ‰ Release v$NEW_VERSION Complete! " >> $GITHUB_STEP_SUMMARY
267
+ echo "" >> $GITHUB_STEP_SUMMARY
268
+ echo "### โœ… Completed Tasks" >> $GITHUB_STEP_SUMMARY
269
+ echo "- [x] Calculated new version ($NEW_VERSION) from ${{ github.event.inputs.bump_type }} bump" >> $GITHUB_STEP_SUMMARY
270
+ echo "- [x] Updated version in pyproject.toml" >> $GITHUB_STEP_SUMMARY
271
+ echo "- [x] Built distribution packages" >> $GITHUB_STEP_SUMMARY
272
+ echo "- [x] Tested package build" >> $GITHUB_STEP_SUMMARY
273
+ echo "- [x] Published to PyPI" >> $GITHUB_STEP_SUMMARY
274
+ echo "- [x] Verified PyPI publication" >> $GITHUB_STEP_SUMMARY
275
+ echo "- [x] Tested PyPI installation" >> $GITHUB_STEP_SUMMARY
276
+ echo "- [x] Created and pushed git tag v$NEW_VERSION" >> $GITHUB_STEP_SUMMARY
277
+ echo "- [x] Created GitHub release" >> $GITHUB_STEP_SUMMARY
278
+ echo "" >> $GITHUB_STEP_SUMMARY
279
+ echo "### ๐Ÿ”— Links" >> $GITHUB_STEP_SUMMARY
280
+ echo "- **PyPI Package:** https://pypi.org/project/msiltop/$NEW_VERSION/" >> $GITHUB_STEP_SUMMARY
281
+ echo "- **GitHub Release:** https://github.com/pratikdevnani/msiltop/releases/tag/v$NEW_VERSION" >> $GITHUB_STEP_SUMMARY
282
+ echo "- **Install Command:** \`pip install msiltop==$NEW_VERSION\`" >> $GITHUB_STEP_SUMMARY
283
+
284
+ - name: โŒ Failure Summary
285
+ if: failure()
286
+ run: |
287
+ echo "## โŒ Release v$NEW_VERSION Failed" >> $GITHUB_STEP_SUMMARY
288
+ echo "" >> $GITHUB_STEP_SUMMARY
289
+ echo "The release process encountered an error. Check the logs above for details." >> $GITHUB_STEP_SUMMARY
290
+ echo "" >> $GITHUB_STEP_SUMMARY
291
+ if [[ "${{ steps.pypi_publish.outcome }}" == "success" ]]; then
292
+ echo "โš ๏ธ **Note:** Package was successfully published to PyPI but git tagging failed." >> $GITHUB_STEP_SUMMARY
293
+ echo "You may need to manually create the git tag or handle the published package." >> $GITHUB_STEP_SUMMARY
294
+ else
295
+ echo "โœ… No changes were committed to git since PyPI publication failed." >> $GITHUB_STEP_SUMMARY
296
+ fi
@@ -0,0 +1,136 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
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
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
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
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+
131
+ # idea
132
+ .idea/
133
+
134
+
135
+ .venv/
136
+ .vscode/
@@ -0,0 +1,12 @@
1
+ {
2
+ "scanSettings": {
3
+ "baseBranches": []
4
+ },
5
+ "checkRunSettings": {
6
+ "vulnerableCheckRunConclusionLevel": "failure",
7
+ "displayMode": "diff"
8
+ },
9
+ "issueSettings": {
10
+ "minSeverityLevel": "LOW"
11
+ }
12
+ }