Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mongodb-labs/flask-pymongo
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3.0.1
Choose a base ref
...
head repository: mongodb-labs/flask-pymongo
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 10 commits
  • 8 files changed
  • 3 contributors

Commits on Jan 29, 2025

  1. BUMP 3.1.0.dev0

    blink1073 committed Jan 29, 2025

    Verified

    This commit was signed with the committer’s verified signature.
    blink1073 Steven Silvester
    Copy the full SHA
    d38dfef View commit details

Commits on Mar 17, 2025

  1. Bump extractions/setup-just from 2 to 3 in the actions group (#194)

    Bumps the actions group with 1 update: [extractions/setup-just](https://github.com/extractions/setup-just).
    
    
    Updates `extractions/setup-just` from 2 to 3
    - [Release notes](https://github.com/extractions/setup-just/releases)
    - [Commits](extractions/setup-just@v2...v3)
    
    ---
    updated-dependencies:
    - dependency-name: extractions/setup-just
      dependency-type: direct:production
      update-type: version-update:semver-major
      dependency-group: actions
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Mar 17, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    3934fae View commit details
  2. Update pymongo docs link (#195)

    blink1073 authored Mar 17, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    c34f094 View commit details

Commits on Apr 21, 2025

  1. INTPYTHON-594 Add automated release workflow (#196)

    blink1073 authored Apr 21, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    4c58c91 View commit details

Commits on Apr 24, 2025

  1. INTPYTHON-589 Fix PyPI upload conditional (#197)

    * INTPYTHON-589 Fix PyPI upload conditional
    
    * INTPYTHON-589 Fix PyPI upload conditional
    blink1073 authored Apr 24, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    648b8fc View commit details

Commits on Apr 29, 2025

  1. INTPYTHON-608 Use pinned sources for GitHub Actions (#199)

    blink1073 authored Apr 29, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    11452d4 View commit details

Commits on May 6, 2025

  1. Bump the actions group with 2 updates (#200)

    Bumps the actions group with 2 updates: [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) and [github/codeql-action](https://github.com/github/codeql-action).
    
    
    Updates `astral-sh/setup-uv` from 5.4.2 to 6.0.1
    - [Release notes](https://github.com/astral-sh/setup-uv/releases)
    - [Commits](astral-sh/setup-uv@d4b2f3b...6b9c606)
    
    Updates `github/codeql-action` from 3.28.16 to 3.28.17
    - [Release notes](https://github.com/github/codeql-action/releases)
    - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
    - [Commits](github/codeql-action@28deaed...60168ef)
    
    ---
    updated-dependencies:
    - dependency-name: astral-sh/setup-uv
      dependency-version: 6.0.1
      dependency-type: direct:production
      update-type: version-update:semver-major
      dependency-group: actions
    - dependency-name: github/codeql-action
      dependency-version: 3.28.17
      dependency-type: direct:production
      update-type: version-update:semver-patch
      dependency-group: actions
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored May 6, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    879a760 View commit details

Commits on May 20, 2025

  1. Bump github/codeql-action from 3.28.17 to 3.28.18 in the actions group (

    #202)
    
    Bumps the actions group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).
    
    
    Updates `github/codeql-action` from 3.28.17 to 3.28.18
    - [Release notes](https://github.com/github/codeql-action/releases)
    - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
    - [Commits](github/codeql-action@60168ef...ff0a06e)
    
    ---
    updated-dependencies:
    - dependency-name: github/codeql-action
      dependency-version: 3.28.18
      dependency-type: direct:production
      update-type: version-update:semver-patch
      dependency-group: actions
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored May 20, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    bccf5ca View commit details
  2. Update CHANGELOG.md (#201)

    CarterPerez-dev authored May 20, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    f71b1ea View commit details

Commits on May 27, 2025

  1. Bump astral-sh/setup-uv from 6.0.1 to 6.1.0 in the actions group (#203)

    Bumps the actions group with 1 update: [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv).
    
    
    Updates `astral-sh/setup-uv` from 6.0.1 to 6.1.0
    - [Release notes](https://github.com/astral-sh/setup-uv/releases)
    - [Commits](astral-sh/setup-uv@6b9c606...f0ec1fc)
    
    ---
    updated-dependencies:
    - dependency-name: astral-sh/setup-uv
      dependency-version: 6.1.0
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: actions
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored May 27, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    6245e8b View commit details
Showing with 168 additions and 85 deletions.
  1. +75 −0 .github/workflows/dist-python.yml
  2. +77 −69 .github/workflows/release-python.yml
  3. +10 −10 .github/workflows/test-python.yml
  4. +2 −2 .github/workflows/zizmor.yml
  5. +1 −1 CHANGELOG.md
  6. +1 −1 docs/index.rst
  7. +1 −1 flask_pymongo/__init__.py
  8. +1 −1 flask_pymongo/_version.py
75 changes: 75 additions & 0 deletions .github/workflows/dist-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Python Dist

on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+.post[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+[a-b][0-9]+"
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
workflow_dispatch:
pull_request:
workflow_call:
inputs:
ref:
required: true
type: string

concurrency:
group: dist-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -eux {0}

jobs:
make_dist:
name: Make Dist
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

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

- name: Install python requirements
run: |
python -m pip install uv rust-just build twine
- name: Build Dist
run: |
python -m build .
- name: Test SDist
run: |
python -m twine check --strict dist/*.*
python -m pip install dist/*.gz
cd ..
python -c "from flask_pymongo import PyMongo"
- uses: actions/upload-artifact@v4
with:
name: "dist"
path: ./dist/*.*

collect_dist:
runs-on: ubuntu-latest
needs: [make_dist]
name: Download Dist
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v4
- name: Flatten directory
working-directory: .
run: |
find . -mindepth 2 -type f -exec mv {} . \;
find . -type d -empty -delete
- uses: actions/upload-artifact@v4
with:
name: all-dist-${{ github.run_id }}
path: "./*"
146 changes: 77 additions & 69 deletions .github/workflows/release-python.yml
Original file line number Diff line number Diff line change
@@ -1,99 +1,107 @@
name: Python Wheels
name: Release

on:
push:
branches: ["main"]
tags:
- "**"
pull_request:
workflow_dispatch:
inputs:
following_version:
description: "The post (dev) version to set"
dry_run:
description: "Dry Run?"
default: false
type: boolean
schedule:
- cron: '30 5 * * *'

env:
# Changes per repo
PRODUCT_NAME: Flask-PyMongo
# Constant
# inputs will be empty on a scheduled run. so, we only set dry_run
# to 'false' when the input is set to 'false'.
DRY_RUN: ${{ ! contains(inputs.dry_run, 'false') }}
FOLLOWING_VERSION: ${{ inputs.following_version || '' }}

concurrency:
group: wheels-${{ github.ref }}
group: release-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -eux {0}

jobs:

build_dist:
name: Build 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: Install build
run: |
python -m pip install build
- name: build the dist files
run: |
python -m build .
- name: Upload the dist files
uses: actions/upload-artifact@v4
with:
name: dist-${{ github.run_id }}
path: ./dist/*.*

test_dist:
needs: [build_dist]
name: Test Distribution Files
pre-publish:
environment: release
runs-on: ubuntu-latest
if: github.repository_owner == 'mongodb-labs' || github.event_name == 'workflow_dispatch'
permissions:
id-token: write
contents: write
outputs:
version: ${{ steps.pre-publish.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: mongodb-labs/drivers-github-tools/secure-checkout@v2
with:
fetch-depth: 0
persist-credentials: false

- uses: actions/setup-python@v5
app_id: ${{ vars.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: mongodb-labs/drivers-github-tools/setup@v2
with:
# Build sdist on lowest supported Python
python-version: '3.9'

- name: Download the dists
uses: actions/download-artifact@v4
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
aws_region_name: ${{ vars.AWS_REGION_NAME }}
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
artifactory_username: ${{ vars.ARTIFACTORY_USERNAME }}
- uses: mongodb-labs/drivers-github-tools/python-labs/pre-publish@v2
id: pre-publish
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
dry_run: ${{ env.DRY_RUN }}

- name: Test the wheel
run: |
cd dist
pip install *.whl
python -c "import flask_pymongo"
pip uninstall -y flask_pymongo
build-dist:
needs: [pre-publish]
uses: ./.github/workflows/dist-python.yml
with:
ref: ${{ needs.pre-publish.outputs.version }}

publish:
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#publishing-the-distribution-to-pypi
needs: [test_dist]
if: startsWith(github.ref, 'refs/tags/')
needs: [build-dist]
if: (github.repository_owner == 'mongodb-labs' && github.event_name != 'pull_request') || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- name: Download the dists
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: dist-${{ github.run_id }}
name: all-dist-${{ github.run_id }}
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: startsWith(env.DRY_RUN, 'false')
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1

post-publish:
needs: [publish]
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
contents: write
attestations: write
security-events: write
steps:
- uses: mongodb-labs/drivers-github-tools/secure-checkout@v2
with:
app_id: ${{ vars.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: mongodb-labs/drivers-github-tools/setup@v2
with:
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
aws_region_name: ${{ vars.AWS_REGION_NAME }}
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
artifactory_username: ${{ vars.ARTIFACTORY_USERNAME }}
- uses: mongodb-labs/drivers-github-tools/python-labs/post-publish@v2
with:
following_version: ${{ env.FOLLOWING_VERSION }}
product_name: ${{ env.PRODUCT_NAME }}
token: ${{ github.token }}
dry_run: ${{ env.DRY_RUN }}
20 changes: 10 additions & 10 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
@@ -27,11 +27,11 @@ jobs:
persist-credentials: false
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- uses: extractions/setup-just@v2
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
- run: just install
- run: just lint
- run: just docs
@@ -50,14 +50,14 @@ jobs:
persist-credentials: false
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- uses: extractions/setup-just@v2
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
- name: Start MongoDB on Linux
if: ${{ startsWith(runner.os, 'Linux') }}
uses: supercharge/mongodb-github-action@1.12.0
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
with:
mongodb-version: ${{ env.MAX_MONGODB }}
mongodb-replica-set: test-rs
@@ -86,18 +86,18 @@ jobs:
persist-credentials: false
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v5
with:
enable-cache: true
python-version: ${{ env.MIN_PYTHON }}
- uses: extractions/setup-just@v2
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v5
with:
enable-cache: true
python-version: ${{ env.MIN_PYTHON }}
- uses: extractions/setup-just@v2
- uses: supercharge/mongodb-github-action@1.12.0
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
- uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
with:
mongodb-version: ${{ env.MIN_MONGODB }}
mongodb-replica-set: test-rs
4 changes: 2 additions & 2 deletions .github/workflows/zizmor.yml
Original file line number Diff line number Diff line change
@@ -18,15 +18,15 @@ jobs:
with:
persist-credentials: false
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@9d7e65c320fdb52dcd45ffaa68deb6c02c8754d9 # v1
- name: Get zizmor
run: cargo install zizmor
- name: Run zizmor
run: zizmor --format sarif . > results.sarif
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v3
uses: github/codeql-action/upload-sarif@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3
with:
sarif_file: results.sarif
category: zizmor
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

- TDB

## 3.0.1 Jan 29, 2005
## 3.0.1 Jan 29, 2025

- Fix inclusion of `_version.py` file.

2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
@@ -114,7 +114,7 @@ constructor. These are passed directly through to the underlying
By default, Flask-PyMongo sets the ``connect`` keyword argument to
``False``, to prevent PyMongo from connecting immediately. PyMongo
itself `is not fork-safe
<https://www.mongodb.com/docs/languages/python/pymongo-driver/current/faq/#is-pymongo-fork-safe->`_,
<https://www.mongodb.com/docs/languages/python/pymongo-driver/current/connect/mongoclient/#forking-a-process-causes-a-deadlock>`_,
and delaying connection until the app is actually used is necessary to
avoid issues. If you wish to change this default behavior, pass
``connect=True`` as a keyword argument to ``PyMongo``.
2 changes: 1 addition & 1 deletion flask_pymongo/__init__.py
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@ def init_app(self, app: Flask, uri: str | None = None, *args: Any, **kwargs: Any
database_name = parsed_uri["database"]

# Try to delay connecting, in case the app is loaded before forking, per
# https://www.mongodb.com/docs/languages/python/pymongo-driver/current/faq/#is-pymongo-fork-safe-
# https://www.mongodb.com/docs/languages/python/pymongo-driver/current/connect/mongoclient/#forking-a-process-causes-a-deadlock
kwargs.setdefault("connect", False)
if DriverInfo is not None:
kwargs.setdefault("driver", DriverInfo("Flask-PyMongo", __version__))
2 changes: 1 addition & 1 deletion flask_pymongo/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.0.1"
__version__ = "3.1.0.dev0"