Skip to content

Commit

Permalink
feat: add v1beta (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored Feb 25, 2021
1 parent a599d73 commit 10cbb1e
Show file tree
Hide file tree
Showing 43 changed files with 6,905 additions and 478 deletions.
15 changes: 15 additions & 0 deletions packages/google-analytics-data/.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"
]
}
4 changes: 3 additions & 1 deletion packages/google-analytics-data/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ docs.metadata

# Virtual environment
env/

# Test logs
coverage.xml
sponge_log.xml
*sponge_log.xml

# System test environment variables.
system_tests/local_test_setup
Expand Down
26 changes: 20 additions & 6 deletions packages/google-analytics-data/.kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@

set -eo pipefail

cd github/python-analytics-data
if [[ -z "${PROJECT_ROOT:-}" ]]; then
PROJECT_ROOT="github/python-analytics-data"
fi

cd "${PROJECT_ROOT}"

# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1
Expand All @@ -30,16 +34,26 @@ export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")

# Remove old nox
python3.6 -m pip uninstall --yes --quiet nox-automation
python3 -m pip uninstall --yes --quiet nox-automation

# Install nox
python3.6 -m pip install --upgrade --quiet nox
python3.6 -m nox --version
python3 -m pip install --upgrade --quiet nox
python3 -m nox --version

# If this is a continuous 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 = *"continuous"* ]]; then
cleanup() {
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
$KOKORO_GFILE_DIR/linux_amd64/flakybot
}
trap cleanup EXIT HUP
fi

# If NOX_SESSION is set, it only runs the specified session,
# otherwise run all the sessions.
if [[ -n "${NOX_SESSION:-}" ]]; then
python3.6 -m nox -s "${NOX_SESSION:-}"
python3 -m nox -s ${NOX_SESSION:-}
else
python3.6 -m nox
python3 -m nox
fi
11 changes: 11 additions & 0 deletions packages/google-analytics-data/.kokoro/docs/docs-presubmit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ env_vars: {
key: "TRAMPOLINE_IMAGE_UPLOAD"
value: "false"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-analytics-data/.kokoro/build.sh"
}

# Only run this nox session.
env_vars: {
key: "NOX_SESSION"
value: "docs docfx"
}
2 changes: 1 addition & 1 deletion packages/google-analytics-data/.repo-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"product_documentation": "https://developers.google.com/analytics/",
"client_documentation": "https://googleapis.dev/python/analyticsdata/latest",
"issue_tracker": "https://issuetracker.google.com/issues?q=componentid:187400%2B%20",
"release_level": "alpha",
"release_level": "beta",
"language": "python",
"repo": "googleapis/python-analytics-data",
"distribution_name": "google-analytics-data",
Expand Down
1 change: 1 addition & 0 deletions packages/google-analytics-data/.trampolinerc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ required_envvars+=(
pass_down_envvars+=(
"STAGING_BUCKET"
"V2_STAGING_BUCKET"
"NOX_SESSION"
)

# Prevent unintentional override on the default image.
Expand Down
22 changes: 18 additions & 4 deletions packages/google-analytics-data/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
7 changes: 4 additions & 3 deletions packages/google-analytics-data/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Apache License

Apache License
Version 2.0, January 2004
https://www.apache.org/licenses/
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

Expand Down Expand Up @@ -192,7 +193,7 @@
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
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,
Expand Down
4 changes: 2 additions & 2 deletions packages/google-analytics-data/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
6 changes: 3 additions & 3 deletions packages/google-analytics-data/README.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Python Client for Analytics Data
=================================================

|alpha| |pypi| |versions|
|beta| |pypi| |versions|

`Analytics Data API`_: Access report data in Google Analytics.

- `Client Library Documentation`_
- `Product Documentation`_

.. |alpha| image:: https://img.shields.io/badge/support-alpha-orange.svg
:target: https://github.com/googleapis/google-cloud-python/blob/master/README.rst#alpha-support
.. |beta| image:: https://img.shields.io/badge/support-beta-orange.svg
:target: https://github.com/googleapis/google-cloud-python/blob/master/README.rst#beta-support
.. |pypi| image:: https://img.shields.io/pypi/v/google-analytics-data.svg
:target: https://pypi.org/project/google-analytics-data/
.. |versions| image:: https://img.shields.io/pypi/pyversions/google-analytics-data.svg
Expand Down
7 changes: 6 additions & 1 deletion packages/google-analytics-data/docs/_static/custom.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
div#python2-eol {
border-color: red;
border-width: medium;
}
}

/* Ensure minimum width for 'Parameters' / 'Returns' column */
dl.field-list > dt {
min-width: 100px
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
BetaAnalyticsData
-----------------------------------

.. automodule:: google.analytics.data_v1beta.services.beta_analytics_data
:members:
:inherited-members:


.. automodule:: google.analytics.data_v1beta.services.beta_analytics_data.pagers
:members:
:inherited-members:
6 changes: 6 additions & 0 deletions packages/google-analytics-data/docs/data_v1beta/services.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Services for Google Analytics Data v1beta API
=============================================
.. toctree::
:maxdepth: 2

beta_analytics_data
7 changes: 7 additions & 0 deletions packages/google-analytics-data/docs/data_v1beta/types.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Types for Google Analytics Data v1beta API
==========================================

.. automodule:: google.analytics.data_v1beta.types
:members:
:undoc-members:
:show-inheritance:
2 changes: 2 additions & 0 deletions packages/google-analytics-data/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ API Reference
.. toctree::
:maxdepth: 2

data_v1beta/services
data_v1beta/types
data_v1alpha/services
data_v1alpha/types

Expand Down
Empty file.
98 changes: 46 additions & 52 deletions packages/google-analytics-data/google/analytics/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,75 +15,70 @@
# limitations under the License.
#

from google.analytics.data_v1alpha.services.alpha_analytics_data.async_client import (
AlphaAnalyticsDataAsyncClient,
from google.analytics.data_v1beta.services.beta_analytics_data.async_client import (
BetaAnalyticsDataAsyncClient,
)
from google.analytics.data_v1alpha.services.alpha_analytics_data.client import (
AlphaAnalyticsDataClient,
from google.analytics.data_v1beta.services.beta_analytics_data.client import (
BetaAnalyticsDataClient,
)
from google.analytics.data_v1alpha.types.analytics_data_api import (
from google.analytics.data_v1beta.types.analytics_data_api import (
BatchRunPivotReportsRequest,
)
from google.analytics.data_v1alpha.types.analytics_data_api import (
from google.analytics.data_v1beta.types.analytics_data_api import (
BatchRunPivotReportsResponse,
)
from google.analytics.data_v1alpha.types.analytics_data_api import (
BatchRunReportsRequest,
)
from google.analytics.data_v1alpha.types.analytics_data_api import (
from google.analytics.data_v1beta.types.analytics_data_api import BatchRunReportsRequest
from google.analytics.data_v1beta.types.analytics_data_api import (
BatchRunReportsResponse,
)
from google.analytics.data_v1alpha.types.analytics_data_api import GetMetadataRequest
from google.analytics.data_v1alpha.types.analytics_data_api import Metadata
from google.analytics.data_v1alpha.types.analytics_data_api import RunPivotReportRequest
from google.analytics.data_v1alpha.types.analytics_data_api import (
RunPivotReportResponse,
)
from google.analytics.data_v1alpha.types.analytics_data_api import (
from google.analytics.data_v1beta.types.analytics_data_api import GetMetadataRequest
from google.analytics.data_v1beta.types.analytics_data_api import Metadata
from google.analytics.data_v1beta.types.analytics_data_api import RunPivotReportRequest
from google.analytics.data_v1beta.types.analytics_data_api import RunPivotReportResponse
from google.analytics.data_v1beta.types.analytics_data_api import (
RunRealtimeReportRequest,
)
from google.analytics.data_v1alpha.types.analytics_data_api import (
from google.analytics.data_v1beta.types.analytics_data_api import (
RunRealtimeReportResponse,
)
from google.analytics.data_v1alpha.types.analytics_data_api import RunReportRequest
from google.analytics.data_v1alpha.types.analytics_data_api import RunReportResponse
from google.analytics.data_v1alpha.types.data import Cohort
from google.analytics.data_v1alpha.types.data import CohortReportSettings
from google.analytics.data_v1alpha.types.data import CohortSpec
from google.analytics.data_v1alpha.types.data import CohortsRange
from google.analytics.data_v1alpha.types.data import DateRange
from google.analytics.data_v1alpha.types.data import Dimension
from google.analytics.data_v1alpha.types.data import DimensionExpression
from google.analytics.data_v1alpha.types.data import DimensionHeader
from google.analytics.data_v1alpha.types.data import DimensionMetadata
from google.analytics.data_v1alpha.types.data import DimensionValue
from google.analytics.data_v1alpha.types.data import Entity
from google.analytics.data_v1alpha.types.data import Filter
from google.analytics.data_v1alpha.types.data import FilterExpression
from google.analytics.data_v1alpha.types.data import FilterExpressionList
from google.analytics.data_v1alpha.types.data import Metric
from google.analytics.data_v1alpha.types.data import MetricAggregation
from google.analytics.data_v1alpha.types.data import MetricHeader
from google.analytics.data_v1alpha.types.data import MetricMetadata
from google.analytics.data_v1alpha.types.data import MetricType
from google.analytics.data_v1alpha.types.data import MetricValue
from google.analytics.data_v1alpha.types.data import NumericValue
from google.analytics.data_v1alpha.types.data import OrderBy
from google.analytics.data_v1alpha.types.data import Pivot
from google.analytics.data_v1alpha.types.data import PivotDimensionHeader
from google.analytics.data_v1alpha.types.data import PivotHeader
from google.analytics.data_v1alpha.types.data import PropertyQuota
from google.analytics.data_v1alpha.types.data import QuotaStatus
from google.analytics.data_v1alpha.types.data import ResponseMetaData
from google.analytics.data_v1alpha.types.data import Row
from google.analytics.data_v1beta.types.analytics_data_api import RunReportRequest
from google.analytics.data_v1beta.types.analytics_data_api import RunReportResponse
from google.analytics.data_v1beta.types.data import Cohort
from google.analytics.data_v1beta.types.data import CohortReportSettings
from google.analytics.data_v1beta.types.data import CohortSpec
from google.analytics.data_v1beta.types.data import CohortsRange
from google.analytics.data_v1beta.types.data import DateRange
from google.analytics.data_v1beta.types.data import Dimension
from google.analytics.data_v1beta.types.data import DimensionExpression
from google.analytics.data_v1beta.types.data import DimensionHeader
from google.analytics.data_v1beta.types.data import DimensionMetadata
from google.analytics.data_v1beta.types.data import DimensionValue
from google.analytics.data_v1beta.types.data import Filter
from google.analytics.data_v1beta.types.data import FilterExpression
from google.analytics.data_v1beta.types.data import FilterExpressionList
from google.analytics.data_v1beta.types.data import Metric
from google.analytics.data_v1beta.types.data import MetricAggregation
from google.analytics.data_v1beta.types.data import MetricHeader
from google.analytics.data_v1beta.types.data import MetricMetadata
from google.analytics.data_v1beta.types.data import MetricType
from google.analytics.data_v1beta.types.data import MetricValue
from google.analytics.data_v1beta.types.data import NumericValue
from google.analytics.data_v1beta.types.data import OrderBy
from google.analytics.data_v1beta.types.data import Pivot
from google.analytics.data_v1beta.types.data import PivotDimensionHeader
from google.analytics.data_v1beta.types.data import PivotHeader
from google.analytics.data_v1beta.types.data import PropertyQuota
from google.analytics.data_v1beta.types.data import QuotaStatus
from google.analytics.data_v1beta.types.data import ResponseMetaData
from google.analytics.data_v1beta.types.data import Row

__all__ = (
"AlphaAnalyticsDataAsyncClient",
"AlphaAnalyticsDataClient",
"BatchRunPivotReportsRequest",
"BatchRunPivotReportsResponse",
"BatchRunReportsRequest",
"BatchRunReportsResponse",
"BetaAnalyticsDataAsyncClient",
"BetaAnalyticsDataClient",
"Cohort",
"CohortReportSettings",
"CohortSpec",
Expand All @@ -94,7 +89,6 @@
"DimensionHeader",
"DimensionMetadata",
"DimensionValue",
"Entity",
"Filter",
"FilterExpression",
"FilterExpressionList",
Expand Down
Loading

0 comments on commit 10cbb1e

Please sign in to comment.