Skip to content

Commit c86fb8e

Browse files
committed
Merge remote-tracking branch 'remote.googleapis/python-ndb/main' into migration.python-ndb.migration.2025-11-24_21-55-24.migrate
2 parents 0737369 + 68a8dd1 commit c86fb8e

File tree

188 files changed

+53881
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+53881
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[run]
2+
branch = True
3+
4+
[report]
5+
fail_under = 100
6+
show_missing = True
7+
exclude_lines =
8+
# Re-enable the standard pragma
9+
pragma: NO COVER
10+
omit =
11+
.nox/*
12+
*/gapic/*.py
13+
*/proto/*.py
14+
tests/*/*.py

packages/google-cloud-ndb/.flake8

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Copyright 2020 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
[flake8]
18+
ignore = E203, E266, E501, W503
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Code owners file.
2+
# This file controls who is tagged for review for any given pull request.
3+
4+
# These are the default owners
5+
* @googleapis/api-datastore-sdk @googleapis/yoshi-python
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# How to Contribute
2+
3+
We'd love to accept your patches and contributions to this project. There are
4+
just a few small guidelines you need to follow.
5+
6+
## Contributor License Agreement
7+
8+
Contributions to this project must be accompanied by a Contributor License
9+
Agreement. You (or your employer) retain the copyright to your contribution;
10+
this simply gives us permission to use and redistribute your contributions as
11+
part of the project. Head over to <https://cla.developers.google.com/> to see
12+
your current agreements on file or to sign a new one.
13+
14+
You generally only need to submit a CLA once, so if you've already submitted one
15+
(even if it was for a different project), you probably don't need to do it
16+
again.
17+
18+
## Code reviews
19+
20+
All submissions, including submissions by project members, require review. We
21+
use GitHub pull requests for this purpose. Consult
22+
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
23+
information on using pull requests.
24+
25+
## Community Guidelines
26+
27+
This project follows [Google's Open Source Community
28+
Guidelines](https://opensource.google.com/conduct/).
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
5+
---
6+
7+
Thanks for stopping by to let us know something could be better!
8+
9+
**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response.
10+
11+
Please run down the following list and make sure you've tried the usual "quick fixes":
12+
13+
- Search the issues already opened: https://github.com/googleapis/google-cloud-python/issues
14+
- Check for answers on StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-python
15+
16+
If you are still having issues, please be sure to include as much information as possible:
17+
18+
#### Environment details
19+
20+
1. Specify the API at the beginning of the title (for example, "BigQuery: ...")
21+
General, Core, and Other are also allowed as types
22+
2. OS type and version
23+
3. Python version and virtual environment information: `python --version`
24+
4. google-cloud-<service> version: `pip show google-<service>` or `pip freeze`
25+
26+
#### Steps to reproduce
27+
28+
1. ?
29+
30+
#### Code example
31+
32+
```python
33+
# example
34+
```
35+
36+
#### Stack trace
37+
```
38+
# example
39+
```
40+
41+
Making sure to follow these steps will guarantee the quickest resolution possible.
42+
43+
Thanks!
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this library
4+
5+
---
6+
7+
Thanks for stopping by to let us know something could be better!
8+
9+
**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response.
10+
11+
**Is your feature request related to a problem? Please describe.**
12+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
**Describe alternatives you've considered**
16+
A clear and concise description of any alternative solutions or features you've considered.
17+
**Additional context**
18+
Add any other context or screenshots about the feature request here.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
name: Support request
3+
about: If you have a support contract with Google, please create an issue in the Google Cloud Support console.
4+
5+
---
6+
7+
**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- main
5+
name: unittest
6+
jobs:
7+
unit:
8+
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
9+
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
10+
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
11+
runs-on: ubuntu-22.04
12+
strategy:
13+
matrix:
14+
python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Setup Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: ${{ matrix.python }}
22+
- name: Install nox
23+
run: |
24+
python -m pip install --upgrade setuptools pip wheel
25+
python -m pip install nox
26+
- name: Run unit tests
27+
env:
28+
COVERAGE_FILE: .coverage-${{ matrix.python }}
29+
run: |
30+
nox -s unit-${{ matrix.python }}
31+
- name: Upload coverage results
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: coverage-artifact-${{ matrix.python }}
35+
path: .coverage-${{ matrix.python }}
36+
include-hidden-files: true
37+
38+
cover:
39+
runs-on: ubuntu-latest
40+
needs:
41+
- unit
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v4
45+
- name: Setup Python
46+
uses: actions/setup-python@v5
47+
with:
48+
python-version: "3.14"
49+
- name: Install coverage
50+
run: |
51+
python -m pip install --upgrade setuptools pip wheel
52+
python -m pip install coverage
53+
- name: Download coverage results
54+
uses: actions/download-artifact@v4
55+
with:
56+
path: .coverage-results/
57+
- name: Report coverage results
58+
run: |
59+
find .coverage-results -type f -name '*.zip' -exec unzip {} \;
60+
coverage combine .coverage-results/**/.coverage*
61+
coverage report --show-missing --fail-under=100
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
*.py[cod]
2+
*.sw[op]
3+
4+
# C extensions
5+
*.so
6+
7+
# Packages
8+
*.egg
9+
*.egg-info
10+
dist
11+
build
12+
eggs
13+
parts
14+
bin
15+
var
16+
sdist
17+
develop-eggs
18+
.installed.cfg
19+
lib
20+
lib64
21+
__pycache__
22+
23+
# Installer logs
24+
pip-log.txt
25+
26+
# Unit test / coverage reports
27+
.coverage
28+
.nox
29+
.tox
30+
.cache
31+
.pytest_cache
32+
htmlcov
33+
34+
# Translations
35+
*.mo
36+
37+
# Mac
38+
.DS_Store
39+
40+
# Mr Developer
41+
.mr.developer.cfg
42+
.project
43+
.pydevproject
44+
45+
# JetBrains
46+
.idea
47+
48+
# VS Code
49+
.vscode
50+
51+
# Built documentation
52+
docs/_build
53+
54+
# Test logs
55+
coverage.xml
56+
*sponge_log.xml
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/bash
2+
# Copyright 2024 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -eo pipefail
17+
18+
CURRENT_DIR=$(dirname "${BASH_SOURCE[0]}")
19+
20+
if [[ -z "${PROJECT_ROOT:-}" ]]; then
21+
PROJECT_ROOT=$(realpath "${CURRENT_DIR}/..")
22+
fi
23+
24+
pushd "${PROJECT_ROOT}"
25+
26+
# Disable buffering, so that the logs stream through.
27+
export PYTHONUNBUFFERED=1
28+
29+
# Debug: show build environment
30+
env | grep KOKORO
31+
32+
# Setup service account credentials.
33+
if [[ -f "${KOKORO_GFILE_DIR}/service-account.json" ]]
34+
then
35+
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
36+
fi
37+
38+
# Setup project id.
39+
if [[ -f "${KOKORO_GFILE_DIR}/project-id.json" ]]
40+
then
41+
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")
42+
43+
if [[ -f "${KOKORO_GFILE_DIR}/service-account.json" ]]; then
44+
# Configure local Redis to be used
45+
export REDIS_CACHE_URL=redis://localhost
46+
redis-server &
47+
48+
# Configure local memcached to be used
49+
export MEMCACHED_HOSTS=127.0.0.1
50+
service memcached start
51+
52+
# Some system tests require indexes. Use gcloud to create them.
53+
gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS --project=$PROJECT_ID
54+
gcloud --quiet --verbosity=debug datastore indexes create tests/system/index.yaml
55+
fi
56+
57+
fi
58+
59+
# If this is a continuous build, send the test log to the FlakyBot.
60+
# See https://github.com/googleapis/repo-automation-bots/tree/main/packages/flakybot.
61+
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then
62+
cleanup() {
63+
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
64+
$KOKORO_GFILE_DIR/linux_amd64/flakybot
65+
}
66+
trap cleanup EXIT HUP
67+
fi
68+
69+
# If NOX_SESSION is set, it only runs the specified session,
70+
# otherwise run all the sessions.
71+
if [[ -n "${NOX_SESSION:-}" ]]; then
72+
python3 -m nox -s ${NOX_SESSION:-}
73+
else
74+
python3 -m nox
75+
fi

0 commit comments

Comments
 (0)