-
Notifications
You must be signed in to change notification settings - Fork 2
feat: prepare PyMapGIS for PyPI publication #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ce1211d
feat: add file/SQLite cache layer (requests-cache)
nicholaskarlson 2736f73
feat: minimal ACS+TIGER helpers and choropleth util
nicholaskarlson 32a9553
feat: implement caching system and add examples
nicholaskarlson 29c0693
docs: prepare repository for PyPI publication
nicholaskarlson 9383e1e
feat: add PyPI trusted publishing workflow
nicholaskarlson af0dc9e
style: apply automated code formatting
nicholaskarlson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| data/** filter=lfs diff=lfs merge=lfs -text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| --- | ||
| name: Bug report | ||
| about: Create a report to help us improve | ||
| title: '[BUG] ' | ||
| labels: 'bug' | ||
| assignees: '' | ||
|
|
||
| --- | ||
|
|
||
| **Describe the bug** | ||
| A clear and concise description of what the bug is. | ||
|
|
||
| **To Reproduce** | ||
| Steps to reproduce the behavior: | ||
| 1. Go to '...' | ||
| 2. Click on '....' | ||
| 3. Scroll down to '....' | ||
| 4. See error | ||
|
|
||
| **Expected behavior** | ||
| A clear and concise description of what you expected to happen. | ||
|
|
||
| **Code Example** | ||
| ```python | ||
| # Minimal code example that reproduces the issue | ||
| import pymapgis as pmg | ||
| # Your code here | ||
| ``` | ||
|
|
||
| **Error Message** | ||
| ``` | ||
| Paste the full error message and stack trace here | ||
| ``` | ||
|
|
||
| **Environment (please complete the following information):** | ||
| - OS: [e.g. Windows 11, macOS 14, Ubuntu 22.04] | ||
| - Python version: [e.g. 3.10.5] | ||
| - PyMapGIS version: [e.g. 0.1.0] | ||
| - Other relevant package versions: [e.g. geopandas 1.1.0] | ||
|
|
||
| **Additional context** | ||
| Add any other context about the problem here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| --- | ||
| name: Feature request | ||
| about: Suggest an idea for this project | ||
| title: '[FEATURE] ' | ||
| labels: 'enhancement' | ||
| assignees: '' | ||
|
|
||
| --- | ||
|
|
||
| **Is your feature request related to a problem? Please describe.** | ||
| A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
|
||
| **Describe the solution you'd like** | ||
| A clear and concise description of what you want to happen. | ||
|
|
||
| **Describe alternatives you've considered** | ||
| A clear and concise description of any alternative solutions or features you've considered. | ||
|
|
||
| **Proposed API Design** | ||
| ```python | ||
| # Example of how you envision the feature would be used | ||
| import pymapgis as pmg | ||
|
|
||
| # Your proposed API here | ||
| ``` | ||
|
|
||
| **Use Case** | ||
| Describe the specific use case this feature would enable. | ||
|
|
||
| **Additional context** | ||
| Add any other context or screenshots about the feature request here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| ## Description | ||
|
|
||
| Brief description of the changes in this PR. | ||
|
|
||
| ## Type of Change | ||
|
|
||
| - [ ] Bug fix (non-breaking change which fixes an issue) | ||
| - [ ] New feature (non-breaking change which adds functionality) | ||
| - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
| - [ ] Documentation update | ||
| - [ ] Performance improvement | ||
| - [ ] Code refactoring | ||
|
|
||
| ## Related Issues | ||
|
|
||
| Closes #(issue number) | ||
|
|
||
| ## Changes Made | ||
|
|
||
| - [ ] Change 1 | ||
| - [ ] Change 2 | ||
| - [ ] Change 3 | ||
|
|
||
| ## Testing | ||
|
|
||
| - [ ] Tests pass locally | ||
| - [ ] New tests added for new functionality | ||
| - [ ] Manual testing completed | ||
|
|
||
| **Test Instructions:** | ||
| 1. Step 1 | ||
| 2. Step 2 | ||
| 3. Step 3 | ||
|
|
||
| ## Documentation | ||
|
|
||
| - [ ] Documentation updated (if applicable) | ||
| - [ ] README updated (if applicable) | ||
| - [ ] CHANGELOG updated (if applicable) | ||
|
|
||
| ## Code Quality | ||
|
|
||
| - [ ] Code follows project style guidelines | ||
| - [ ] Self-review of code completed | ||
| - [ ] Code is commented where necessary | ||
| - [ ] No new warnings introduced | ||
|
|
||
| ## Screenshots (if applicable) | ||
|
|
||
| Add screenshots to help explain your changes. | ||
|
|
||
| ## Additional Notes | ||
|
|
||
| Any additional information that reviewers should know. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| name: Examples smoke-test | ||
| on: | ||
| push: | ||
| paths: ["examples/**"] | ||
| pull_request: | ||
| paths: ["examples/**"] | ||
|
|
||
| jobs: | ||
| run-demo: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: "3.11" | ||
| - run: pip install -r labor_force_gap/after/requirements.txt | ||
| - run: python labor_force_gap/after/app.py --headless || true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| name: Publish to PyPI | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| permissions: | ||
| id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build distribution 📦 | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: "3.x" | ||
| - name: Install poetry | ||
| run: pip install poetry | ||
| - name: Build package | ||
| run: poetry build | ||
| - name: Store the distribution packages | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: python-package-distributions | ||
| path: dist/ | ||
|
|
||
| publish-to-pypi: | ||
| name: Publish Python 🐍 distribution 📦 to PyPI | ||
| if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | ||
| needs: | ||
| - build | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: pypi | ||
| url: https://pypi.org/p/pymapgis | ||
| permissions: | ||
| id-token: write # IMPORTANT: mandatory for trusted publishing | ||
|
|
||
| steps: | ||
| - name: Download all the dists | ||
| uses: actions/download-artifact@v3 | ||
| with: | ||
| name: python-package-distributions | ||
| path: dist/ | ||
| - name: Publish distribution 📦 to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
|
||
| github-release: | ||
| name: Sign the Python 🐍 distribution 📦 with Sigstore and upload them to GitHub Release | ||
| needs: | ||
| - publish-to-pypi | ||
| runs-on: ubuntu-latest | ||
|
|
||
| permissions: | ||
| contents: write # IMPORTANT: mandatory for making GitHub Releases | ||
| id-token: write # IMPORTANT: mandatory for sigstore | ||
|
|
||
| steps: | ||
| - name: Download all the dists | ||
| uses: actions/download-artifact@v3 | ||
| with: | ||
| name: python-package-distributions | ||
| path: dist/ | ||
| - name: Sign the dists with Sigstore | ||
| uses: sigstore/gh-action-sigstore-python@v1.2.3 | ||
| with: | ||
| inputs: >- | ||
| ./dist/*.tar.gz | ||
| ./dist/*.whl | ||
| - name: Create GitHub Release | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| run: >- | ||
| gh release upload | ||
| '${{ github.ref_name }}' dist/** | ||
| --repo '${{ github.repository }}' | ||
|
|
||
| publish-to-testpypi: | ||
| name: Publish Python 🐍 distribution 📦 to TestPyPI | ||
| needs: | ||
| - build | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
|
|
||
| environment: | ||
| name: testpypi | ||
| url: https://test.pypi.org/p/pymapgis | ||
|
|
||
| permissions: | ||
| id-token: write # IMPORTANT: mandatory for trusted publishing | ||
|
|
||
| steps: | ||
| - name: Download all the dists | ||
| uses: actions/download-artifact@v3 | ||
| with: | ||
| name: python-package-distributions | ||
| path: dist/ | ||
| - name: Publish distribution 📦 to TestPyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| repository-url: https://test.pypi.org/legacy/ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 10 months ago
To fix the issue, we need to add a
permissionsblock to the workflow. Since the workflow performs basic CI tasks, the minimal required permission iscontents: read. This ensures that theGITHUB_TOKENhas only read access to the repository contents, adhering to the principle of least privilege.The
permissionsblock should be added at the root level of the workflow, so it applies to all jobs. Alternatively, it can be added to the specific job (run-demo) if different jobs require different permissions.