Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

standardize samples directory layout #790

Closed
tswast opened this issue Jul 21, 2021 · 1 comment · Fixed by #1727 or #1732
Closed

standardize samples directory layout #790

tswast opened this issue Jul 21, 2021 · 1 comment · Fixed by #1727 or #1732
Assignees
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. priority: p3 Desirable enhancement or fix. May not be included in next release. samples Issues that are directly related to samples. type: process A process-related concern. May include testing, release, or the like.

Comments

@tswast
Copy link
Contributor

tswast commented Jul 21, 2021

We have an odd mix of sample locations:

  • docs/snippets.py -- the original location, not very copy-pasteable / browsable
  • lots of samples in samples/*.py, but the test drivers are in samples/tests/
  • samples/snippets/*.py
  • samples/geography/*.py

To align with the infrastructure in https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/python_samples, the goal is to have:

  • samples/snippets/ -- these samples just require the google-cloud-bigquery library
  • samples/geography/ -- require extra dependencies for working with geography data
  • sample/pandas/ -- require extra dependencies for working with pandas dataframes
  • more??? -- possibly a directory for the user-based authentication samples

To avoid breaking cloud.google.com docs, this needs to be done in several steps:

  1. Copy samples to correct location
  2. Update docs (Googler must do this)
  3. Delete duplicate samples in old location

Towards: #366 (use templated noxfile) and #765 (blacken samples using templated noxfile(s))

@product-auto-label product-auto-label bot added api: bigquery Issues related to the googleapis/python-bigquery API. samples Issues that are directly related to samples. labels Jul 21, 2021
@tswast tswast added the type: process A process-related concern. May include testing, release, or the like. label Jul 21, 2021
@chalmerlowe chalmerlowe added the priority: p3 Desirable enhancement or fix. May not be included in next release. label Aug 24, 2022
@chalmerlowe
Copy link
Contributor

This is a comment from another open ticket. Consolidating here and closing that other ticket.

Ideally we'd have some code samples which only require the bare minimum dependencies (no pandas, no google-cloud-bigquery-storage, no protobuf, etc). The samples/snippets directory would be perfect for this, but:

There are a couple of pandas-related samples there which ideally should be moved to a samples/pandas directory.
Likewise, there is a "desktop application" sample https://github.com/googleapis/python-bigquery/blob/main/samples/snippets/user_credentials.py which ideally belongs in its own directory with its own noxfile.py and requirements.txt. This is because it's responsible for the google-auth-oauthlib dependency, which isn't required for any other samples. Maybe we call this directory samples/desktopapp or something?
Related issues:

There are still code samples that haven't been moved to subdirectories: #790

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. priority: p3 Desirable enhancement or fix. May not be included in next release. samples Issues that are directly related to samples. type: process A process-related concern. May include testing, release, or the like.
Projects
None yet
3 participants