Skip to content

Commit

Permalink
fix: Final touches (#151)
Browse files Browse the repository at this point in the history
* fix: build and doc fixes

* fix: merging dev versions

* fix: typos

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix: restore overwritten setup.cfg

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix: remove unneded steps

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix: setup is at root now

* fix: restore deleted content

* fix: restore deleted content

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
engelke and gcf-owl-bot[bot] committed Feb 8, 2023
1 parent 62ce8ff commit 16d8413
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/generate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ jobs:
env:
GOOGLE_EVENTS_TESTDATA: ../${{env.DATA_SOURCE_CHECKOUT_PATH}}/testdata
run: |
pip install -r requirements-dev.txt
pip install ./src
pip install .
pip install -r ./tests/requirements.txt
pytest -v .
- name: View generator output
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ jobs:
env:
GOOGLE_EVENTS_TESTDATA: ../${{env.DATA_SOURCE_CHECKOUT_PATH}}/testdata
run: |
pip install -r requirements-dev.txt
pip install ./src
pip install .
pip install -r ./tests/requirements.txt
pytest -v .
- name: View generator output
Expand Down
44 changes: 44 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Building the google-events Python library

## Installing the current version

The library source in this repository can be installed and used as is:

1. Clone or download the repository contents
1. Instantiate a virtual Python environment if desired.
1. In a shell, change to the repository root.
1. Install with `pip install -e .`

## Building a distribution

A Python wheel can be created for the current contents of this repository as
follows:

1. Clone or download the repository contents
1. Instantiate a virtual Python environment if desired.
1. In a shell, change to the repository root.
1. Install the standard *build* library:
`pip install --upgrade build`
1. Build the distributions(s):
`python -m build .`
1. The *dist* folder will contain distributable packages in those formats
available to your installation.

## Updating the library

Whenever the *googleapis/cloudevents* proto definitions change, the matching
Python *google-events* library can be updated to match, as follows:

1. Clone or download the repository contents
1. Instantiate a virtual Python environment if desired.
1. In a shell, change to the repository root, then the *scripts* folder:
`cd scripts`
1. Install the required libraries to run the generator script:
`pip install -r requirements.txt`
1. For a test run, run the script, specifying a folder of your choice for the output:
`python generate-from-proto.py -o [OUTPUT_DIR]`
and examine the contents of *[OUTPUT_DIR]*.
1. Update the library by having the generator script replace the repository src folder:
`python generate-from-proto.py -o ../src`

You can install or distribute the updated library with the previous instructions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = [
"setuptools >= 40.9.0",
"setuptools >= 61.0",
]
build-backend = "setuptools.build_meta"
15 changes: 13 additions & 2 deletions scripts/generate-from-proto.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,19 @@ def generate_module(module_dir, proto_repo, branch, do_not_confirm_actions):
print(f"Fetching protobuf repo from {proto_repo}")
std_proto_path = fetch_repo("protocolbuffers/protobuf", "main", tempdir)

generate_code_for_protos(proto_path, std_proto_path, module_path)
generate_code_for_dependencies(proto_path, std_proto_path, module_path)
output_path = os.path.join(tempdir, "output_path")
os.mkdir(output_path)

generate_code_for_protos(proto_path, std_proto_path, output_path)
generate_code_for_dependencies(proto_path, std_proto_path, output_path)

os.mkdir(os.path.join(module_path, "google"))

shutil.move(
os.path.join(output_path, "google", "events"),
os.path.join(module_path, "google"),
)

return True


Expand Down
53 changes: 35 additions & 18 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
# -*- coding: utf-8 -*-
#
# Copyright 2020 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.
[metadata]
name = google.events
version = 0.3.0
author = Google LLC
author_email = googleapis-packages@google.com
description = Google Cloudevents library
long_description = file: README.md
url = url
license = Apache 2.0
platforms = Posix, MacOS X, Windows
classifiers =
Intended Audience :: Developers
License :: OSI Approved :: Apache Software License
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Operating System :: OS Independent
Topic :: Internet

# Generated by synthtool. DO NOT EDIT!
[bdist_wheel]
universal = 1

[options]
include_package_data = True
package_dir =
=src
packages = find_namespace:
python_requires = >=3.7
install_requires =
proto-plus >= 1.22.0
protobuf >= 4.21.5

[options.packages.find]
where=src
1 change: 1 addition & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest==7.2.1

0 comments on commit 16d8413

Please sign in to comment.