Skip to content

Commit 9809930

Browse files
Migrate package metadata to pyproject.toml.
PiperOrigin-RevId: 829082204
1 parent b833375 commit 9809930

File tree

12 files changed

+155
-148
lines changed

12 files changed

+155
-148
lines changed

.bazelversion

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
7.7.0
2+
# TODO: b/390391579 - Upgrade once bazel 8+ works.

kokoro/github/ubuntu/cpu/build.sh

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,18 @@ cd "${KOKORO_ARTIFACTS_DIR}/github/gnn/"
3636

3737
PIP_TEST_PREFIX=bazel_pip
3838

39-
python -m venv venv
40-
source venv/bin/activate
39+
python -m venv build_venv
40+
source build_venv/bin/activate
4141

4242
# Check the python version
4343
python --version
44-
python3 --version
4544

4645
# update pip
4746
pip install --upgrade pip
4847

48+
# Install build
49+
pip install build
50+
4951
TEST_ROOT=$(pwd)/${PIP_TEST_PREFIX}
5052
rm -rf "$TEST_ROOT"
5153
mkdir -p "$TEST_ROOT"
@@ -59,14 +61,20 @@ if [[ -n "${USE_BAZEL_VERSION}" && $(bazel --version) != *${USE_BAZEL_VERSION}*
5961
fi
6062

6163
bazel clean
62-
pip install -r requirements-dev.txt --progress-bar off
63-
pip install tf-keras-nightly tf-nightly --progress-bar off --upgrade
64-
# We need to remove the dependency on tensorflow to test nightly
65-
# The dependencies will be provided by tf-nightly
66-
perl -i -lpe '$k+= s/tensorflow>=2\.[0-9]+\.[0-9]+(,<=?[0-9.]+)?;/tf-nightly;/g; END{exit($k != 1)}' setup.py
67-
python3 setup.py bdist_wheel
68-
pip uninstall -y tensorflow_gnn
64+
pip install --group test-nightly --progress-bar off --upgrade
65+
python3 -m build --wheel
66+
deactivate
67+
68+
# Start the test environment.
69+
python3 -m venv test_venv
70+
source test_venv/bin/activate
71+
72+
# Check the python version
73+
python --version
74+
75+
pip install --upgrade pip
6976
pip install dist/tensorflow_gnn-*.whl
77+
pip install --group test-nightly --progress-bar off --upgrade
7078

7179
echo "Final packages after all pip commands:"
7280
pip list

kokoro/github/ubuntu/cpu/build_versioned.sh

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ set -x
1919
PYENV_ROOT="/home/kbuilder/.pyenv"
2020
PYTHON_VERSION=${PYTHON_VERSION:-"3.11"}
2121

22+
function force_tensorflow_version() {
23+
if [[ -z "${TF_VERSION}" ]]; then
24+
echo "TF_VERSION is not set. Not forcing tensorflow version."
25+
return
26+
fi
27+
28+
pip install tensorflow=="${TF_VERSION}" --progress-bar off --upgrade
29+
if [[ "$TF_USE_LEGACY_KERAS" == 1 ]]; then
30+
pip install tf-keras=="${TF_VERSION}" --progress-bar off --upgrade
31+
fi
32+
}
33+
2234
echo "Installing pyenv.."
2335
git clone https://github.com/pyenv/pyenv.git "$PYENV_ROOT"
2436
export PATH="/home/kbuilder/.local/bin:$PYENV_ROOT/bin:$PATH"
@@ -32,16 +44,18 @@ cd "${KOKORO_ARTIFACTS_DIR}/github/gnn/"
3244

3345
PIP_TEST_PREFIX=bazel_pip
3446

35-
python -m venv venv
36-
source venv/bin/activate
47+
python -m venv build_venv
48+
source build_venv/bin/activate
3749

3850
# Debug messages to indicate the python version
3951
python --version
40-
python3 --version
4152

4253
# update pip
4354
pip install --upgrade pip
4455

56+
# Install build
57+
pip install build
58+
4559
TEST_ROOT=$(pwd)/${PIP_TEST_PREFIX}
4660
rm -rf "$TEST_ROOT"
4761
mkdir -p "$TEST_ROOT"
@@ -62,13 +76,27 @@ if [[ -n "${USE_BAZEL_VERSION}" && $(bazel --version) != *${USE_BAZEL_VERSION}*
6276
fi
6377

6478
bazel clean
65-
pip install -r requirements-dev.txt --progress-bar off
66-
pip install tensorflow=="${TF_VERSION}" --progress-bar off --upgrade
79+
force_tensorflow_version
80+
python3 -m build --wheel
81+
deactivate
82+
83+
# Start the test environment.
84+
python3 -m venv test_venv
85+
source test_venv/bin/activate
86+
87+
# Check the python version
88+
python --version
89+
90+
# update pip
91+
pip install --upgrade pip
92+
force_tensorflow_version
93+
6794
if [[ "$TF_USE_LEGACY_KERAS" == 1 ]]; then
68-
pip install tf-keras=="${TF_VERSION}" --progress-bar off --upgrade
95+
pip install group test-tf216plus --progress-bar off --upgrade
96+
else
97+
pip install group test-pre-tf216 --progress-bar off --upgrade
6998
fi
70-
python3 setup.py bdist_wheel
71-
pip uninstall -y tensorflow_gnn
99+
72100
pip install dist/tensorflow_gnn-*.whl
73101

74102
echo "Final packages after all pip commands:"

kokoro/github/ubuntu/cpu/continuous.cfg

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
build_file: "gnn/kokoro/github/ubuntu/cpu/build.sh"
22

3-
env_vars: {
4-
key: "USE_BAZEL_VERSION"
5-
value: "7.4.1" # TODO - b/390391579: Unpin once bazel 8 works.
6-
}
73
env_vars: {
84
key: "PYTHON_VERSION"
95
value: "3.11"

kokoro/github/ubuntu/cpu/newest_stable/continuous.cfg

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
build_file: "gnn/kokoro/github/ubuntu/cpu/build_versioned.sh"
22

3-
env_vars: {
4-
key: "USE_BAZEL_VERSION"
5-
value: "7.4.1" # TODO - b/390391579: Unpin once bazel 8 works.
6-
}
73
env_vars: {
84
key: "PYTHON_VERSION"
95
value: "3.11"

kokoro/github/ubuntu/cpu/newest_stable/presubmit.cfg

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
build_file: "gnn/kokoro/github/ubuntu/cpu/build_versioned.sh"
22

3-
env_vars: {
4-
key: "USE_BAZEL_VERSION"
5-
value: "7.4.1" # TODO - b/390391579: Unpin once bazel 8 works.
6-
}
73
env_vars: {
84
key: "PYTHON_VERSION"
95
value: "3.11"

kokoro/github/ubuntu/cpu/oldest/continuous.cfg

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
build_file: "gnn/kokoro/github/ubuntu/cpu/build_versioned.sh"
22

3-
env_vars: {
4-
key: "USE_BAZEL_VERSION"
5-
value: "7.4.1" # TODO - b/390391579: Unpin once bazel 8 works.
6-
}
73
env_vars: {
84
key: "PYTHON_VERSION"
95
value: "3.11"

kokoro/github/ubuntu/cpu/oldest/presubmit.cfg

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
build_file: "gnn/kokoro/github/ubuntu/cpu/build_versioned.sh"
22

3-
env_vars: {
4-
key: "USE_BAZEL_VERSION"
5-
value: "7.4.1" # TODO - b/390391579: Unpin once bazel 8 works.
6-
}
73
env_vars: {
84
key: "PYTHON_VERSION"
95
value: "3.11"

kokoro/github/ubuntu/cpu/presubmit.cfg

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
build_file: "gnn/kokoro/github/ubuntu/cpu/build.sh"
22

3-
env_vars: {
4-
key: "USE_BAZEL_VERSION"
5-
value: "7.4.1" # TODO - b/390391579: Unpin once bazel 8 works.
6-
}
73
env_vars: {
84
key: "PYTHON_VERSION"
95
value: "3.11"

pyproject.toml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
[project]
2+
name = "tensorflow_gnn"
3+
description = "A library for building scalable graph neural networks in TensorFlow."
4+
readme = "README.md"
5+
keywords = ["tensorflow", "gnn", "graph"]
6+
dynamic = ["version"]
7+
license = "Apache-2.0"
8+
requires-python = ">=3.9, <4"
9+
dependencies = [
10+
"google-vizier>=0.0.13, !=0.1.23, !=0.1.24", # b/394062744
11+
"ml-collections>=1.1.0",
12+
"networkx>=3.6.1",
13+
"pyarrow>=18.1.0",
14+
"tensorflow>=2.12.0, <3; platform_machine != 'arm64' or platform_system != 'Darwin'",
15+
"tensorflow-macos>=2.12.0, <3; platform_machine == 'arm64' and platform_system == 'Darwin'",
16+
"apache-beam>=2.54",
17+
"crcmod>=1.7, <2",
18+
]
19+
authors = [
20+
{name = "Google LLC", email = "tensorflow-gnn@googlegroups.com"},
21+
]
22+
classifiers = [
23+
"Development Status :: 5 - Production/Stable",
24+
"Intended Audience :: Developers",
25+
"Intended Audience :: Science/Research",
26+
"Operating System :: MacOS :: MacOS X",
27+
"Operating System :: POSIX :: Linux",
28+
"Operating System :: Microsoft :: Windows",
29+
"Programming Language :: Python",
30+
"Programming Language :: Python :: 3",
31+
"Programming Language :: Python :: 3.9",
32+
"Programming Language :: Python :: 3 :: Only",
33+
"Topic :: Scientific/Engineering",
34+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
35+
"Topic :: Scientific/Engineering :: Mathematics",
36+
"Topic :: Software Development",
37+
"Topic :: Software Development :: Libraries",
38+
"Topic :: Software Development :: Libraries :: Python Modules",
39+
]
40+
41+
[project.urls]
42+
homepage = "https://github.com/tensorflow/gnn"
43+
source = "https://github.com/tensorflow/gnn.git"
44+
45+
[dependency-groups]
46+
test-base = [
47+
"mock",
48+
]
49+
test-pre-tf216 = [
50+
"ai-edge-litert",
51+
{include-group = "test-base"},
52+
]
53+
test-tf216plus = [
54+
"tf-keras",
55+
{include-group = "test-pre-tf216"},
56+
]
57+
test-nightly = [
58+
"tf-nightly",
59+
"tf-keras-nightly",
60+
"ai-edge-litert-nightly",
61+
{include-group = "test-base"},
62+
]
63+
64+
[project.scripts]
65+
tfgnn_convert_ogb_dataset = 'tensorflow_gnn.converters.ogb.convert_ogb_dataset:main'
66+
tfgnn_sampler = 'tensorflow_gnn.experimental.sampler.beam.sampler:main'
67+
# copybara:comment_begin(NetworkX utils)
68+
tfgnn_nx_converter = 'tensorflow_gnn.sampler.nx_converter:main'
69+
tfgnn_nx_generator = 'tensorflow_gnn.sampler.nx_generator:main'
70+
# copybara:comment_end
71+
tfgnn_generate_training_data = 'tensorflow_gnn.tools.generate_training_data:main'
72+
tfgnn_print_training_data = 'tensorflow_gnn.tools.print_training_data:main'
73+
tfgnn_sampled_stats = 'tensorflow_gnn.tools.sampled_stats:main'
74+
tfgnn_validate_graph_schema = 'tensorflow_gnn.tools.validate_graph_schema:main'
75+
76+
[build-system]
77+
requires = ["setuptools", "numpy"]
78+
build-backend = "setuptools.build_meta"
79+
80+
[tool.setuptools.dynamic]
81+
version = {attr = "tensorflow_gnn.version.__version__"}
82+
83+
[tool.setuptools.packages.find]
84+
exclude = ["examples*", "package*", "testdata*", "build*", "bazel*"]
85+
86+
[tool.setuptools.package-data]
87+
tensorflow_gnn = ["*.proto"]
88+

0 commit comments

Comments
 (0)