Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 10 additions & 0 deletions packages/help/.repo-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "help",
"name_pretty": "Client libraries help",
"client_documentation": "https://cloud.google.com/python/docs/reference/help/latest",
"language": "python",
"library_type": "OTHER",
"repo": "googleapis/google-cloud-python",
"distribution_name": "help",
"codeowner_team": "@googleapis/cloud-sdk-python-team"
}
3 changes: 3 additions & 0 deletions packages/help/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Google Cloud Python Help

Client libraries help documentation for common support issues and general information.
89 changes: 89 additions & 0 deletions packages/help/docfx_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Copyright 2026 Google LLC
#
# 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.

import os
Comment thread
bshaffer marked this conversation as resolved.
Outdated
import pathlib
import shutil
import sys
import yaml
import pypandoc

def build_docfx(current_dir, repo_root, docs_map):
current_dir = pathlib.Path(current_dir)
repo_root = pathlib.Path(repo_root)
Comment thread
bshaffer marked this conversation as resolved.
Outdated
output_dir = current_dir / "docs" / "_build"

if output_dir.exists():
shutil.rmtree(output_dir)
output_dir.mkdir(parents=True)

# Ensure pandoc is available (pypandoc will download it if not found in PATH)
try:
pypandoc.get_pandoc_version()
except OSError:
print("Pandoc not found. Downloading...")
pypandoc.download_pandoc()

toc = []

for title, source in docs_map.items():
source_path = pathlib.Path(source)
if not source_path.is_absolute():
source_path = current_dir / source_path

filename = source_path.name

if filename.endswith(".rst"):
target_filename = filename.replace(".rst", ".md")
print(f"Converting {filename} -> {target_filename} using pandoc")
if source_path.exists():
# Use pandoc to convert RST to GFM (GitHub Flavored Markdown)
output = pypandoc.convert_file(
str(source_path),
'gfm',
format='rst'
)
(output_dir / target_filename).write_text(output)
Comment thread
bshaffer marked this conversation as resolved.
Outdated
else:
print(f"Warning: Source {source_path} not found.")
(output_dir / target_filename).write_text(f"# {title}\n\nContent missing.")
href = target_filename
else:
print(f"Copying {filename}")
if source_path.exists():
shutil.copy(source_path, output_dir / filename)
else:
print(f"Warning: Source {source_path} not found.")
(output_dir / filename).write_text(f"# {title}\n\nContent missing.")
href = filename

toc.append({"name": title, "href": href})

# Write toc.yaml
toc_path = output_dir / "toc.yaml"
with open(toc_path, "w") as f:
yaml.dump(toc, f, default_flow_style=False)
Comment thread
bshaffer marked this conversation as resolved.
Outdated

print(f"DocFX build complete in {output_dir}")
print(f"Generated TOC: {toc}")

if __name__ == "__main__":
# Simple argument parsing: current_dir, repo_root, then pairs of Title,Source
curr = sys.argv[1]
root = sys.argv[2]
d_map = {}
for i in range(3, len(sys.argv), 2):
d_map[sys.argv[i]] = sys.argv[i+1]
Comment thread
bshaffer marked this conversation as resolved.
Outdated

build_docfx(curr, root, d_map)
19 changes: 19 additions & 0 deletions packages/help/help/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2022 Google LLC
#
# 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
#
# http://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.

__version__ = "1.0.0"

# {x-release-please-start-date}
__release_date__ = "2026-04-07"
# {x-release-please-end}
56 changes: 56 additions & 0 deletions packages/help/noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# -*- coding: utf-8 -*-
#
# Copyright 2026 Google LLC
#
# 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.

from __future__ import absolute_import
Comment thread
bshaffer marked this conversation as resolved.
Outdated

import pathlib
import nox

DEFAULT_PYTHON_VERSION = "3.14"
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
REPO_ROOT = CURRENT_DIRECTORY.parent.parent

# Hardcoded dictionary of documentation files.
# Format: {"Display Title": "filename.md" or absolute path}
DOCS_MAP = {
"Getting started": str(REPO_ROOT / "README.rst"),
}

nox.options.sessions = [
"lint",
"docfx",
]

# Error if a python version is missing
nox.options.error_on_missing_interpreters = True

@nox.session(python=DEFAULT_PYTHON_VERSION)
def lint(session):
"""Run linters."""
session.install("ruff")
session.run("ruff", "check", ".")

@nox.session(python="3.10")
def docfx(session):
"""Build the docfx yaml files for this library."""
session.install("PyYAML", "pypandoc")

# Construct arguments for the helper script
args = [str(CURRENT_DIRECTORY), str(REPO_ROOT)]
for title, source in DOCS_MAP.items():
args.extend([title, str(source)])

session.run("python", "docfx_helper.py", *args)
74 changes: 74 additions & 0 deletions packages/help/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Copyright 2026 Google LLC
#
# 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
#
# http://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.


import io
import os

import setuptools

# Package metadata.

name = "help"
Comment thread
bshaffer marked this conversation as resolved.
Outdated
description = "Client libraries help documentation"
release_status = "Development Status :: 5 - Production/Stable"
dependencies = []

# Setup boilerplate below this line.

package_root = os.path.abspath(os.path.dirname(__file__))

readme_filename = os.path.join(package_root, "README.md")
with io.open(readme_filename, encoding="utf-8") as readme_file:
readme = readme_file.read()

version = {}
with open(os.path.join(package_root, "help/version.py")) as fp:
exec(fp.read(), version)
version_id = version["__version__"]

setuptools.setup(
name=name,
version=version_id,
description=description,
long_description=readme,
long_description_content_type="text/markdown",
author="Google LLC",
author_email="cloud-sdk@google.com",
license="Apache 2.0",
url="https://github.com/googleapis/google-cloud-python/tree/main/packages/help",
project_urls={
"Source": "https://github.com/googleapis/google-cloud-python/tree/main/packages/help",
"Changelog": "https://github.com/googleapis/google-cloud-python/tree/main/packages/help/CHANGELOG.md",
"Issues": "https://github.com/googleapis/google-cloud-python/issues",
},
classifiers=[
release_status,
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Operating System :: OS Independent",
"Topic :: Internet",
],
install_requires=dependencies,
python_requires=">=3.10",
include_package_data=True,
zip_safe=False,
packages=["help"],
Comment thread
bshaffer marked this conversation as resolved.
Outdated
)
Loading