Skip to content

Fix handling of _version.py file #187

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 2 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion .github/workflows/release-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,44 @@
name: dist-${{ github.run_id }}
path: ./dist/*.*

test_dist:
needs: [build_dist]
name: Test Distribution Files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- uses: actions/setup-python@v5
with:
# Build sdist on lowest supported Python
python-version: '3.9'

- name: Download the dists
uses: actions/download-artifact@v4
with:
name: dist-${{ github.run_id }}
path: dist/

- name: Test the sdist
run: |
cd dist
pip install *.tar.gz
python -c "import flask_pymongo"
pip uninstall -y flask_pymongo

- name: Test the wheel
run: |
cd dist
pip install *.whl
python -c "import flask_pymongo"
pip uninstall -y flask_pymongo
Comment on lines +49 to +82

Check warning

Code scanning / zizmor

overly broad permissions Warning

overly broad permissions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this alert for?


publish:
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#publishing-the-distribution-to-pypi
needs: [build_dist]
needs: [test_dist]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
environment: release
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ _build
dist/
*.pyc
.pytest_cache/
_version.py
version.txt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So these files are untracked but expected to be included in the distribution? How do we prevent committing them?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repo used to use setuptools-scm. Now that we use hatch, we want the version file to be there.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this PR be adding the file in that case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file was already there, hatch uses .gitignore to determine what goes into the dist by default, unless you override it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see the file already exists. I forgot you could commit a .gitignore file.

.eggs/
.tox/
build/
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- TDB

## 3.0.1 Jan 29, 2005

- Fix inclusion of `_version.py` file.

## 3.0.0: Jan 29, 2025

- Support Flask 3.0+ and PyMongo 4.0+.
Expand Down