-
Notifications
You must be signed in to change notification settings - Fork 64
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
Add Python code to Connect preview HTML #806
Conversation
@@ -33,7 +33,7 @@ | |||
<h3>{{{pin_name}}}</h3> | |||
{{#pin_metadata}} | |||
<p> | |||
{{#date}}<b>Last updated:</b> {{{.}}} •{{/date}} | |||
{{#date}}<b>Last updated from R:</b> {{{.}}} •{{/date}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Python package can say:
Last updated from Python:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this format for a subtle way to be able to tell what language the data is coming from!
inst/preview/index.html
Outdated
<pre id="pin-python" class="pin-code"><code class="python">import pins | ||
board = pins.board_connect() | ||
board.pin_read(board, "{{pin_name}}")</code></pre> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the best option for Python code? I believe this is what people should use if they are publishing code to Connect, right? Because the env vars are provided?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you'll need to bring the environment variables into your session somehow, but once they are there, you won't have to add any special arguments. something like this would work ⏬
import pins
from dotenv import load_dotenv
load_dotenv()
board = pins.board_connect()
You can see the new version of Python code now here. |
This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue. |
Addresses #796
We discussed a button to switch between the R / Python code, but we need to not show the code at all for
.rds
pins so I think it's better to just do it with another<section>
. This is my current proposal:You can see a published version here.