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

Conversation

blink1073
Copy link
Member

@blink1073 blink1073 commented Jan 29, 2025

Fixes #186. Hatch was using the .gitignore file to determine which files to include in the dists.

Comment on lines +49 to +82
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

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?

Comment on lines +49 to +82
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
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?

@@ -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.

@blink1073 blink1073 merged commit 8796a8c into mongodb-labs:main Jan 29, 2025
22 checks passed
@blink1073 blink1073 deleted the fix-version-file-inclusion branch January 29, 2025 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ModuleNotFoundError: No module named 'flask_pymongo._version' with new Pymongo Version
2 participants