Skip to content

docs(examples): add usage examples for get_backend and get_name #10449

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

Merged
merged 1 commit into from
Nov 10, 2024

Conversation

IndexSeek
Copy link
Member

Description of changes

Adds examples by creating a table using an in-memory duckdb connection for get_backend and get_name.

I did backend.name to get "duckdb" in the example for get_backend rather than backend to avoid getting something like "<ibis.backends.duckdb.Backend at 0x7fffd919b470>". I'm not sure if both that and the type usage are necessary; maybe we could use one or the other if we don't want to use both.

@cpcloud
Copy link
Member

cpcloud commented Nov 10, 2024

You can use # doctest: +ELLIPSIS (note the two spaces preceding the #) when dealing with values that can vary between invocations of Python:

>>> class Foo: pass  # doctest: +ELLIPSIS
>>> Foo()
<__main__.Foo at ...>

@cpcloud cpcloud added this to the 10.0 milestone Nov 10, 2024
@cpcloud cpcloud merged commit ae1bb20 into ibis-project:main Nov 10, 2024
77 checks passed
@cpcloud cpcloud added the docs Documentation related issues or PRs label Nov 10, 2024
@IndexSeek
Copy link
Member Author

You can use # doctest: +ELLIPSIS (note the two spaces preceding the #) when dealing with values that can vary between invocations of Python:

>>> class Foo: pass  # doctest: +ELLIPSIS
>>> Foo()
<__main__.Foo at ...>

This is super useful; thank you for sharing that trick! I will keep this in mind for future scenarios where it might be cleaner to show the instance of the class itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation related issues or PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants