Skip to content
Open
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
86 changes: 86 additions & 0 deletions .github/workflows/namespace-install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Namespace package installation

on:
push:
branches: [main]
paths:
- 'setup.py'
- 'setup.cfg'
- 'owlbot.py'
- 'MANIFEST.in'
- 'google/**'
- 'vertexai/**'
- 'agentplatform/**'
- 'tests/packaging/**'
- '.github/workflows/namespace-install.yml'
pull_request:
branches: [main]
paths:
- 'setup.py'
- 'setup.cfg'
- 'owlbot.py'
- 'MANIFEST.in'
- 'google/**'
- 'vertexai/**'
- 'agentplatform/**'
- 'tests/packaging/**'
- '.github/workflows/namespace-install.yml'

permissions:
contents: read

jobs:
namespace-install:
name: Namespace install (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- name: Checkout source
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
- name: Build and check installed namespace packages
run: |
set -euo pipefail
export UV_EXCLUDE_NEWER=$(date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%SZ)
uv venv --python '${{ matrix.python-version }}' .venv
uv pip install --python .venv/bin/python \
'build==1.3.0' 'setuptools==78.1.1' 'wheel==0.45.1' 'flit-core==3.12.0'
uv pip freeze --python .venv/bin/python | tee "$RUNNER_TEMP/namespace-build-dependencies.txt"
export SOURCE_DATE_EPOCH=946684800
PYTHONHASHSEED=1 PYTHONPATH= .venv/bin/python -B -m build \
--wheel --no-isolation --outdir dist/seed-1 .
PYTHONHASHSEED=2 PYTHONPATH= .venv/bin/python -B -m build \
--wheel --no-isolation --outdir dist/seed-2 .
.venv/bin/python -I -B - <<'PY'
import hashlib
from pathlib import Path
first, second = [list(Path(f"dist/seed-{seed}").glob("*.whl")) for seed in [1, 2]]
assert len(first) == len(second) == 1
assert first[0].name == second[0].name
assert first[0].read_bytes() == second[0].read_bytes(), "hash seed changed wheel bytes"
print("Hash-seed reproducibility:", hashlib.sha256(first[0].read_bytes()).hexdigest())
PY
.venv/bin/python -I -B tests/packaging/check_namespace_install.py dist/seed-1/*.whl
31 changes: 11 additions & 20 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.. Generated by synthtool. DO NOT EDIT!
############
Contributing
############
Expand All @@ -22,7 +21,7 @@ In order to add a feature:
documentation.

- The feature must work fully on the following CPython versions:
3.9, 3.10, 3.11, 3.12, and 3.13 on both UNIX and Windows.
3.10, 3.11, 3.12, 3.13, and 3.14 on both UNIX and Windows.

- The feature must not add unnecessary dependencies (where
"unnecessary" is of course subjective, but new dependencies should
Expand Down Expand Up @@ -68,6 +67,7 @@ Using ``nox``
We use `nox <https://nox.readthedocs.io/en/latest/>`__ to instrument our tests.

- To test your changes, run unit tests with ``nox``::

$ nox -s unit

- To run a single unit test::
Expand Down Expand Up @@ -143,13 +143,13 @@ Running System Tests
$ nox -s system

# Run a single system test
$ nox -s system-3.9 -- -k <name of test>
$ nox -s system-3.10 -- -k <name of test>


.. note::

System tests are only configured to run under Python 3.9.
For expediency, we do not run them in older versions of Python 3.
System tests are only configured to run under Python 3.10.
See ``SYSTEM_TEST_PYTHON_VERSIONS`` in ``noxfile.py``.

This alone will not run the tests. You'll need to change some local
auth settings and change some configuration in your project to
Expand Down Expand Up @@ -195,11 +195,11 @@ configure them just like the System Tests.

# Run all tests in a folder
$ cd samples/snippets
$ nox -s py-3.9
$ nox -s py-3.10

# Run a single sample test
$ cd samples/snippets
$ nox -s py-3.9 -- -k <name of test>
$ nox -s py-3.10 -- -k <name of test>

********************************************
Note About ``README`` as it pertains to PyPI
Expand All @@ -221,35 +221,26 @@ Supported Python Versions

We support:

- `Python 3.9`_
- `Python 3.10`_
- `Python 3.11`_
- `Python 3.12`_
- `Python 3.13`_
- `Python 3.14`_

.. _Python 3.9: https://docs.python.org/3.9/
.. _Python 3.10: https://docs.python.org/3.10/
.. _Python 3.11: https://docs.python.org/3.11/
.. _Python 3.12: https://docs.python.org/3.12/
.. _Python 3.13: https://docs.python.org/3.13/
.. _Python 3.14: https://docs.python.org/3.14/


Supported versions can be found in our ``noxfile.py`` `config`_.

.. _config: https://github.com/googleapis/python-aiplatform/blob/main/noxfile.py


We also explicitly decided to support Python 3 beginning with version 3.9.
Reasons for this include:

- Encouraging use of newest versions of Python 3
- Taking the lead of `prominent`_ open-source `projects`_
- `Unicode literal support`_ which allows for a cleaner codebase that
works in both Python 2 and Python 3

.. _prominent: https://docs.djangoproject.com/en/1.9/faq/install/#what-python-version-can-i-use-with-django
.. _projects: http://flask.pocoo.org/docs/0.10/python3/
.. _Unicode literal support: https://www.python.org/dev/peps/pep-0414/
The minimum supported Python version is defined by ``python_requires`` in
``setup.py``.

**********
Versioning
Expand Down
6 changes: 6 additions & 0 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
".pre-commit-config.yaml",
"setup.py",
"README.rst",
"CONTRIBUTING.rst",
"docs/index.rst",
"docs/summary_overview.md",
f"docs/definition_{library.name}/services.rst",
Expand Down Expand Up @@ -134,13 +135,18 @@
".github/PULL_REQUEST_TEMPLATE.md",
".github/workflows", # exclude gh actions as credentials are needed for tests
"README.rst",
"CONTRIBUTING.rst",
".github/release-please.yml", # use release please manifest
"noxfile.py",
"testing",
"docs/conf.py",
],
) # the microgenerator has a good coveragerc file

# This package requires Python 3.10 or later. Generated configuration
# must not advertise Python 2 compatibility.
s.replace("setup.cfg", r"^universal[ \t]*=[ \t]*1[ \t]*$", "universal = 0")

python.py_samples(skip_readmes=True)

python.configure_previous_major_version_branches()
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

# Generated by synthtool. DO NOT EDIT!
[bdist_wheel]
universal = 1
universal = 0
11 changes: 5 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
"aiohttp", # for ADK users to use aiohttp rather than httpx client
]

adk_testing_extra_require = list(
adk_testing_extra_require = sorted(
set(
adk_extra_require + reasoning_engine_extra_require + ["absl-py", "pytest-xdist"]
)
Expand Down Expand Up @@ -203,7 +203,7 @@
"openinference-instrumentation-langchain >= 0.1.19, < 0.2",
]

langchain_testing_extra_require = list(
langchain_testing_extra_require = sorted(
set(
langchain_extra_require
+ reasoning_engine_extra_require
Expand All @@ -216,7 +216,7 @@
"openinference-instrumentation-autogen >= 0.1.6, < 0.2",
]

ag2_testing_extra_require = list(
ag2_testing_extra_require = sorted(
set(
ag2_extra_require + reasoning_engine_extra_require + ["absl-py", "pytest-xdist"]
)
Expand All @@ -228,7 +228,7 @@
"openinference-instrumentation-llama-index >= 3.0, < 4.0",
]

llama_index_testing_extra_require = list(
llama_index_testing_extra_require = sorted(
set(
llama_index_extra_require
+ reasoning_engine_extra_require
Expand All @@ -239,7 +239,7 @@
tokenization_extra_require = ["sentencepiece >= 0.2.0"]
tokenization_testing_extra_require = tokenization_extra_require + ["nltk"]

full_extra_require = list(
full_extra_require = sorted(
set(
tensorboard_extra_require
+ metadata_extra_require
Expand Down Expand Up @@ -310,7 +310,6 @@
"tb-gcp-uploader=google.cloud.aiplatform.tensorboard.uploader_main:run_main"
],
},
namespace_packages=("google", "google.cloud"),
author="Google LLC",
author_email="googleapis-packages@google.com",
license="Apache 2.0",
Expand Down
Loading