Skip to content

Commit

Permalink
chore: update templates (#21)
Browse files Browse the repository at this point in the history
* changes without context

        autosynth cannot find the source of changes triggered by earlier changes in this
        repository, or by version upgrades to tools such as linters.

* chore: Add header checker config to python library synth

Now that we have it working in [python-docs-samples](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/.github/header-checker-lint.yml) we should consider adding it to the 🐍 libraries :)

Source-Author: Leah E. Cole <[email protected]>
Source-Date: Mon Jan 25 13:24:08 2021 -0800
Source-Repo: googleapis/synthtool
Source-Sha: 573f7655311b553a937f9123bee17bf78497db95
Source-Link: googleapis/synthtool@573f765

* chore: add noxfile parameters for extra dependencies

Also, add tests for some noxfile parameters for assurance that the
template generates valid Python.

Co-authored-by: Jeffrey Rennie <[email protected]>

Source-Author: Tim Swast <[email protected]>
Source-Date: Tue Jan 26 12:26:57 2021 -0600
Source-Repo: googleapis/synthtool
Source-Sha: 778d8beae28d6d87eb01fdc839a4b4d966ed2ebe
Source-Link: googleapis/synthtool@778d8be

* build: migrate to flakybot

Source-Author: Justin Beckwith <[email protected]>
Source-Date: Thu Jan 28 22:22:38 2021 -0800
Source-Repo: googleapis/synthtool
Source-Sha: d1bb9173100f62c0cfc8f3138b62241e7f47ca6a
Source-Link: googleapis/synthtool@d1bb917

* chore(python): include py.typed files in release

A py.typed file must be included in the released package for it to be considered typed by type checkers. https://www.python.org/dev/peps/pep-0561/#packaging-type-information. See googleapis/python-secret-manager#79

Source-Author: Bu Sun Kim <[email protected]>
Source-Date: Fri Feb 5 17:32:06 2021 -0700
Source-Repo: googleapis/synthtool
Source-Sha: 33366574ffb9e11737b3547eb6f020ecae0536e8
Source-Link: googleapis/synthtool@3336657

* docs: update python contributing guide

Adds details about blacken, updates version for system tests,
and shows how to pass through pytest arguments.

Source-Author: Chris Cotter <[email protected]>
Source-Date: Mon Feb 8 17:13:36 2021 -0500
Source-Repo: googleapis/synthtool
Source-Sha: 4679e7e415221f03ff2a71e3ffad75b9ec41d87e
Source-Link: googleapis/synthtool@4679e7e
  • Loading branch information
yoshi-automation authored Feb 12, 2021
1 parent d1ad756 commit ec3f40d
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 35 deletions.
15 changes: 15 additions & 0 deletions packages/google-cloud-compute/.github/header-checker-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{"allowedCopyrightHolders": ["Google LLC"],
"allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"],
"ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt"],
"sourceFileExtensions": [
"ts",
"js",
"java",
"sh",
"Dockerfile",
"yaml",
"py",
"html",
"txt"
]
}
8 changes: 4 additions & 4 deletions packages/google-cloud-compute/.kokoro/test-samples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ for file in samples/**/requirements.txt; do
python3.6 -m nox -s "$RUN_TESTS_SESSION"
EXIT=$?

# If this is a periodic build, send the test log to the Build Cop Bot.
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop.
# If this is a periodic build, send the test log to the FlakyBot.
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop
$KOKORO_GFILE_DIR/linux_amd64/buildcop
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
$KOKORO_GFILE_DIR/linux_amd64/flakybot
fi

if [[ $EXIT -ne 0 ]]; then
Expand Down
2 changes: 1 addition & 1 deletion packages/google-cloud-compute/.kokoro/trampoline_v2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then
"KOKORO_GITHUB_COMMIT"
"KOKORO_GITHUB_PULL_REQUEST_NUMBER"
"KOKORO_GITHUB_PULL_REQUEST_COMMIT"
# For Build Cop Bot
# For FlakyBot
"KOKORO_GITHUB_COMMIT_URL"
"KOKORO_GITHUB_PULL_REQUEST_URL"
)
Expand Down
22 changes: 18 additions & 4 deletions packages/google-cloud-compute/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,14 @@ 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-2.7
$ nox -s unit-3.7
$ nox -s unit-3.8
$ ...

- Args to pytest can be passed through the nox command separated by a `--`. For
example, to run a single test::

$ nox -s unit-3.8 -- -k <name of test>

.. note::

The unit tests and system tests are described in the
Expand All @@ -93,8 +98,12 @@ On Debian/Ubuntu::
************
Coding Style
************
- We use the automatic code formatter ``black``. You can run it using
the nox session ``blacken``. This will eliminate many lint errors. Run via::

$ nox -s blacken

- PEP8 compliance, with exceptions defined in the linter configuration.
- PEP8 compliance is required, with exceptions defined in the linter configuration.
If you have ``nox`` installed, you can test that you have not introduced
any non-compliant code via::

Expand Down Expand Up @@ -133,13 +142,18 @@ Running System Tests

- To run system tests, you can execute::

$ nox -s system-3.7
# Run all system tests
$ nox -s system-3.8
$ nox -s system-2.7

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


.. note::

System tests are only configured to run under Python 2.7 and
Python 3.7. For expediency, we do not run them in older versions
Python 3.8. For expediency, we do not run them in older versions
of Python 3.

This alone will not run the tests. You'll need to change some local
Expand Down
4 changes: 2 additions & 2 deletions packages/google-cloud-compute/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

# Generated by synthtool. DO NOT EDIT!
include README.rst LICENSE
recursive-include google *.json *.proto
recursive-include google *.json *.proto py.typed
recursive-include tests *
global-exclude *.py[co]
global-exclude __pycache__

# Exclude scripts for samples readmegen
prune scripts/readme-gen
prune scripts/readme-gen
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,7 @@
"DiskTypesClient",
"DiskTypesScopedList",
"DisksAddResourcePoliciesRequest",
"DisksClient",
"DisksRemoveResourcePoliciesRequest",
"DisksResizeRequest",
"DisksScopedList",
Expand Down Expand Up @@ -2225,7 +2226,6 @@
"UrlMapTest",
"UrlMapValidationResult",
"UrlMapsAggregatedList",
"UrlMapsClient",
"UrlMapsScopedList",
"UrlMapsValidateRequest",
"UrlMapsValidateResponse",
Expand Down Expand Up @@ -2271,5 +2271,5 @@
"ZoneSetLabelsRequest",
"ZoneSetPolicyRequest",
"ZonesClient",
"DisksClient",
"UrlMapsClient",
)
1 change: 1 addition & 0 deletions packages/google-cloud-compute/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def default(session):
session.install(
"mock", "pytest", "pytest-cov",
)

session.install("-e", ".")

# Run py.test against the unit tests.
Expand Down
38 changes: 19 additions & 19 deletions packages/google-cloud-compute/scripts/fixup_compute_v1_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class computeCallTransformer(cst.CSTTransformer):
'attach_network_endpoints': ('network_endpoint_group', 'network_endpoint_groups_attach_endpoints_request_resource', 'project', 'zone', 'request_id', ),
'create_instances': ('instance_group_manager', 'instance_group_managers_create_instances_request_resource', 'project', 'zone', 'request_id', ),
'create_snapshot': ('disk', 'project', 'snapshot_resource', 'zone', 'guest_flush', 'request_id', ),
'delete': ('disk', 'project', 'zone', 'request_id', ),
'delete': ('project', 'url_map', 'request_id', ),
'delete_access_config': ('access_config', 'instance', 'network_interface', 'project', 'zone', 'request_id', ),
'delete_instances': ('instance_group_manager', 'instance_group_managers_delete_instances_request_resource', 'project', 'zone', 'request_id', ),
'delete_nodes': ('node_group', 'node_groups_delete_nodes_request_resource', 'project', 'zone', 'request_id', ),
Expand All @@ -71,12 +71,12 @@ class computeCallTransformer(cst.CSTTransformer):
'enable_xpn_host': ('project', 'request_id', ),
'enable_xpn_resource': ('project', 'projects_enable_xpn_resource_request_resource', 'request_id', ),
'expand_ip_cidr_range': ('project', 'region', 'subnetwork', 'subnetworks_expand_ip_cidr_range_request_resource', 'request_id', ),
'get': ('disk', 'project', 'zone', ),
'get': ('project', 'url_map', ),
'get_diagnostics': ('interconnect', 'project', ),
'get_from_family': ('family', 'project', ),
'get_guest_attributes': ('instance', 'project', 'zone', 'query_path', 'variable_key', ),
'get_health': ('backend_service', 'project', 'region', 'resource_group_reference_resource', ),
'get_iam_policy': ('project', 'resource', 'zone', 'options_requested_policy_version', ),
'get_health': ('backend_service', 'project', 'resource_group_reference_resource', ),
'get_iam_policy': ('project', 'region', 'resource', 'options_requested_policy_version', ),
'get_nat_mapping_info': ('project', 'region', 'router', 'filter', 'max_results', 'order_by', 'page_token', 'return_partial_success', ),
'get_router_status': ('project', 'region', 'router', ),
'get_rule': ('project', 'security_policy', 'priority', ),
Expand All @@ -86,12 +86,12 @@ class computeCallTransformer(cst.CSTTransformer):
'get_status': ('project', 'region', 'vpn_gateway', ),
'get_xpn_host': ('project', ),
'get_xpn_resources': ('project', 'filter', 'max_results', 'order_by', 'page_token', 'return_partial_success', ),
'insert': ('disk_resource', 'project', 'zone', 'request_id', 'source_image', ),
'insert': ('project', 'url_map_resource', 'request_id', ),
'invalidate_cache': ('cache_invalidation_rule_resource', 'project', 'url_map', 'request_id', ),
'list': ('project', 'zone', 'filter', 'max_results', 'order_by', 'page_token', 'return_partial_success', ),
'list': ('project', 'filter', 'max_results', 'order_by', 'page_token', 'return_partial_success', ),
'list_available_features': ('project', 'filter', 'max_results', 'order_by', 'page_token', 'return_partial_success', ),
'list_errors': ('instance_group_manager', 'project', 'zone', 'filter', 'max_results', 'order_by', 'page_token', 'return_partial_success', ),
'list_instances': ('instance_group', 'instance_groups_list_instances_request_resource', 'project', 'zone', 'filter', 'max_results', 'order_by', 'page_token', 'return_partial_success', ),
'list_instances': ('instance_group', 'project', 'region', 'region_instance_groups_list_instances_request_resource', 'filter', 'max_results', 'order_by', 'page_token', 'return_partial_success', ),
'list_managed_instances': ('instance_group_manager', 'project', 'zone', 'filter', 'max_results', 'order_by', 'page_token', 'return_partial_success', ),
'list_network_endpoints': ('network_endpoint_group', 'network_endpoint_groups_list_endpoints_request_resource', 'project', 'zone', 'filter', 'max_results', 'order_by', 'page_token', 'return_partial_success', ),
'list_nodes': ('node_group', 'project', 'zone', 'filter', 'max_results', 'order_by', 'page_token', 'return_partial_success', ),
Expand All @@ -103,7 +103,7 @@ class computeCallTransformer(cst.CSTTransformer):
'list_xpn_hosts': ('project', 'projects_list_xpn_hosts_request_resource', 'filter', 'max_results', 'order_by', 'page_token', 'return_partial_success', ),
'move_disk': ('disk_move_request_resource', 'project', 'request_id', ),
'move_instance': ('instance_move_request_resource', 'project', 'request_id', ),
'patch': ('autoscaler_resource', 'project', 'zone', 'autoscaler', 'request_id', ),
'patch': ('project', 'url_map', 'url_map_resource', 'request_id', ),
'patch_per_instance_configs': ('instance_group_manager', 'instance_group_managers_patch_per_instance_configs_req_resource', 'project', 'zone', 'request_id', ),
'patch_rule': ('project', 'security_policy', 'security_policy_rule_resource', 'priority', ),
'preview': ('project', 'region', 'router', 'router_resource', ),
Expand All @@ -115,21 +115,21 @@ class computeCallTransformer(cst.CSTTransformer):
'remove_resource_policies': ('disk', 'disks_remove_resource_policies_request_resource', 'project', 'zone', 'request_id', ),
'remove_rule': ('project', 'security_policy', 'priority', ),
'reset': ('instance', 'project', 'zone', 'request_id', ),
'resize': ('disk', 'disks_resize_request_resource', 'project', 'zone', 'request_id', ),
'resize': ('project', 'reservation', 'reservations_resize_request_resource', 'zone', 'request_id', ),
'set_backend_service': ('project', 'target_ssl_proxies_set_backend_service_request_resource', 'target_ssl_proxy', 'request_id', ),
'set_backup': ('project', 'region', 'target_pool', 'target_reference_resource', 'failover_ratio', 'request_id', ),
'set_common_instance_metadata': ('metadata_resource', 'project', 'request_id', ),
'set_default_network_tier': ('project', 'projects_set_default_network_tier_request_resource', 'request_id', ),
'set_deletion_protection': ('project', 'resource', 'zone', 'deletion_protection', 'request_id', ),
'set_disk_auto_delete': ('auto_delete', 'device_name', 'instance', 'project', 'zone', 'request_id', ),
'set_iam_policy': ('project', 'resource', 'zone', 'zone_set_policy_request_resource', ),
'set_iam_policy': ('project', 'region', 'region_set_policy_request_resource', 'resource', ),
'set_instance_template': ('instance_group_manager', 'instance_group_managers_set_instance_template_request_resource', 'project', 'zone', 'request_id', ),
'set_labels': ('project', 'resource', 'zone', 'zone_set_labels_request_resource', 'request_id', ),
'set_labels': ('project', 'region', 'region_set_labels_request_resource', 'resource', 'request_id', ),
'set_machine_resources': ('instance', 'instances_set_machine_resources_request_resource', 'project', 'zone', 'request_id', ),
'set_machine_type': ('instance', 'instances_set_machine_type_request_resource', 'project', 'zone', 'request_id', ),
'set_metadata': ('instance', 'metadata_resource', 'project', 'zone', 'request_id', ),
'set_min_cpu_platform': ('instance', 'instances_set_min_cpu_platform_request_resource', 'project', 'zone', 'request_id', ),
'set_named_ports': ('instance_group', 'instance_groups_set_named_ports_request_resource', 'project', 'zone', 'request_id', ),
'set_named_ports': ('instance_group', 'project', 'region', 'region_instance_groups_set_named_ports_request_resource', 'request_id', ),
'set_node_template': ('node_group', 'node_groups_set_node_template_request_resource', 'project', 'zone', 'request_id', ),
'set_private_ip_google_access': ('project', 'region', 'subnetwork', 'subnetworks_set_private_ip_google_access_request_resource', 'request_id', ),
'set_proxy_header': ('project', 'target_ssl_proxies_set_proxy_header_request_resource', 'target_ssl_proxy', 'request_id', ),
Expand All @@ -138,28 +138,28 @@ class computeCallTransformer(cst.CSTTransformer):
'set_security_policy': ('backend_service', 'project', 'security_policy_reference_resource', 'request_id', ),
'set_service_account': ('instance', 'instances_set_service_account_request_resource', 'project', 'zone', 'request_id', ),
'set_shielded_instance_integrity_policy': ('instance', 'project', 'shielded_instance_integrity_policy_resource', 'zone', 'request_id', ),
'set_ssl_certificates': ('project', 'target_https_proxies_set_ssl_certificates_request_resource', 'target_https_proxy', 'request_id', ),
'set_ssl_policy': ('project', 'ssl_policy_reference_resource', 'target_https_proxy', 'request_id', ),
'set_ssl_certificates': ('project', 'region', 'region_target_https_proxies_set_ssl_certificates_request_resource', 'target_https_proxy', 'request_id', ),
'set_ssl_policy': ('project', 'ssl_policy_reference_resource', 'target_ssl_proxy', 'request_id', ),
'set_tags': ('instance', 'project', 'tags_resource', 'zone', 'request_id', ),
'set_target': ('forwarding_rule', 'project', 'target_reference_resource', 'request_id', ),
'set_target': ('forwarding_rule', 'project', 'region', 'target_reference_resource', 'request_id', ),
'set_target_pools': ('instance_group_manager', 'instance_group_managers_set_target_pools_request_resource', 'project', 'zone', 'request_id', ),
'set_url_map': ('project', 'target_https_proxy', 'url_map_reference_resource', 'request_id', ),
'set_url_map': ('project', 'target_http_proxy', 'url_map_reference_resource', 'request_id', ),
'set_usage_export_bucket': ('project', 'usage_export_location_resource', 'request_id', ),
'simulate_maintenance_event': ('instance', 'project', 'zone', ),
'start': ('instance', 'project', 'zone', 'request_id', ),
'start_with_encryption_key': ('instance', 'instances_start_with_encryption_key_request_resource', 'project', 'zone', 'request_id', ),
'stop': ('instance', 'project', 'zone', 'request_id', ),
'switch_to_custom_mode': ('network', 'project', 'request_id', ),
'test_iam_permissions': ('project', 'resource', 'test_permissions_request_resource', 'zone', ),
'update': ('autoscaler_resource', 'project', 'zone', 'autoscaler', 'request_id', ),
'test_iam_permissions': ('project', 'region', 'resource', 'test_permissions_request_resource', ),
'update': ('project', 'url_map', 'url_map_resource', 'request_id', ),
'update_access_config': ('access_config_resource', 'instance', 'network_interface', 'project', 'zone', 'request_id', ),
'update_display_device': ('display_device_resource', 'instance', 'project', 'zone', 'request_id', ),
'update_network_interface': ('instance', 'network_interface', 'network_interface_resource', 'project', 'zone', 'request_id', ),
'update_peering': ('network', 'networks_update_peering_request_resource', 'project', 'request_id', ),
'update_per_instance_configs': ('instance_group_manager', 'instance_group_managers_update_per_instance_configs_req_resource', 'project', 'zone', 'request_id', ),
'update_shielded_instance_config': ('instance', 'project', 'shielded_instance_config_resource', 'zone', 'request_id', ),
'validate': ('project', 'url_map', 'url_maps_validate_request_resource', ),
'wait': ('operation', 'project', 'region', ),
'wait': ('operation', 'project', 'zone', ),

}

Expand Down
7 changes: 4 additions & 3 deletions packages/google-cloud-compute/synth.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/python-compute.git",
"sha": "16e7294cd536af9a8bf8e4e99219a883339aa955"
"sha": "80bf3527cb9697e6f1a07b3a5ab8130cb77a7674"
}
},
{
Expand All @@ -18,14 +18,14 @@
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "b259489b06b25f399768b74b8baa943991f38ea7"
"sha": "4679e7e415221f03ff2a71e3ffad75b9ec41d87e"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "b259489b06b25f399768b74b8baa943991f38ea7"
"sha": "4679e7e415221f03ff2a71e3ffad75b9ec41d87e"
}
}
],
Expand All @@ -48,6 +48,7 @@
".github/ISSUE_TEMPLATE/feature_request.md",
".github/ISSUE_TEMPLATE/support_request.md",
".github/PULL_REQUEST_TEMPLATE.md",
".github/header-checker-lint.yml",
".github/release-please.yml",
".github/snippet-bot.yml",
".gitignore",
Expand Down

0 comments on commit ec3f40d

Please sign in to comment.