I am using Github API to create an issue (specifically, with requests module in python).
I need to include the picture in the issue content, but I could't find any way that worked for me.
Could you please suggest something that works from python?
Thanks
Edit: It could be really easily done by Github markdowns for linking the pictures that I stored at Amazon S3.
Assuming you are already able to post things to the Issues Page of a given repository then follow these steps to post the image.
I too at first found it annoying to post pictures to github... Github uses markdown and with markdown you can theoretically use an image sourced on your computer (this I believe only works on markdown that you host) but you can also provide a link or image source which is on the internet... particularly convenient for posting pictures to github... is github or you can use dropbox, picasa, photobucket, instagram, or flixster or 20 other image hosting services on the internet, but the point is you then once the image has an href="http://photobucket.com/myimage/3549604690" you can now host that into your markdown file.
Like so:
![Alt text](/path/to/img.jpg)
![Alt text](/path/to/img.jpg "Optional title")
![GitHub Logo](/images/logo.png)
Format: ![Alt Text](url)
Meaning in my case:
![Screen shot of Python stuff](http://photobucket.com/myimage/3549604690 "Screen Shot")
Screen shot of Python stuff http://photobucket.com/myimage/3549604690
Notice that it works on stackOverflow as well.
For guides on markdown syntax:
http://daringfireball.net/projects/markdown/syntax#img
https://guides.github.com/features/mastering-markdown/
So STEP BY STEP (if you want to do it all through Github) and not apply any other APIs then have the user:
Create a new Github Repo or use their existing repo. (Your choice).
Make a post request to insert the image inside the repository's files.
Post the issue to the repository and now use the url of the image
where it was hosted. From what I've seen when images are added to a
repository they go to the path:
https://github.com/myUser/PictureHoster/blob/master/myscreenshot.jpg.
Python should brush my teeth! I tried to get it to work and here: ![Screen shot of Python
stuff](https://github.com/myUser/PictureHoster/blob/master/myscreenshot.jpg
"Screen Shot") it is not working.
.
(Or something like that to find out I would go to your github page click on repositories click on the image inside your repo then right click on it once it's open and do copy Image URL).
Basically to use a different picture hosting service you do the same right click on it inside your flixster account and copy/paste that image url.
Related
I want to link 2 web pages made using streamlit and hosted using Heroku. One of them removes the image background and the other does an image classification task. (They could not be made into one due to slug size limits of Heroku). At present, the user has to manually download the segmented image from one webpage and upload it to the second webpage.
The 2 can be shown together using an HTML iframe tag but I am not able to figure out how to transfer the segmented image from one webpage to other.
Any suggestion or help will be appreciated
Also please prefer solutions using python and its frameworks as the whole project is in python and learning javascript, HTTP, etc will take some time.
(but if it's not possible using python, answers using other methods will also be welcome)
One of my seniors advised me to explore other hosting options. (I had seen an online tutorial using Heroku , and did not know much about others). It turns out that streamlit cloud provides a much larger slug size and allows you to host it for free if you open source your project(I had no issue doing so), so I have combined the two parts and am now hosting using streamlit cloud.
Here is an example page of the Tensorflow documentation:
https://www.tensorflow.org/probability/examples/A_Tour_of_TensorFlow_Probability
Here is the source of that page: Link
How is the Jupyter notebook converted into the HTML website? I think the collapsible code blocks and the table of contents on the right look really nice. I want to do the same thing with my Jupyter notebooks (or at least get some inspiration).
I couldn't find the script which converts the notebooks nor the CSS or template, which Tensorflow uses.
The "flag" which created the collapsible code cell is ##title Import { display-mode: "form" }, but I could not find reference for that.
Some ressources:
Description of the usage of the script which generates the API documentation: Link
There is tool called nbfmt, which can format notebook, but as I understand it can only update the code style, but does not convert it: Link
I've found _book.yaml and _index.yaml in some repositories, which might indicate bookdown.
Note that I'm not looking for an answer on how to create a collapsible code cell or a table of contents, but how Tensorflow did it. I know that there are already answers for the other two questions out there.
Thanks in advance!
As you've discovered, the tools the TF docs team use are all available on GitHub, including nbconvert, nbfmt, etc. There are also some localisation tools.
Mostly, the system works at the notebook -> markdown level, but it also generates reference docs for code -> html. These are all un-styled, "plain" content. Some YAML is also generated for navigation. In theory, these outputs can be published anywhere.
Once the content is generated, the hosting/publishing platform it's served from is a proprietary system unfortunately. You can see the same system is used on developers.google.com, firebase.google.com, cloud.google.com, quantumai.google, developer.android.com and many more (check out the page layouts, custom HTML elements, etc), but it's not available outside of Google.
If you have any specific questions about the tooling, you can find us over on GitHub in the tensorflow/docs repo. Feel free to ask, we'll help if we can!
Im currently performing a migration of data from Box to Google drive. Most of these files contain links that reference, and then take the user to, other files within the box drive.
However, when i do eventually migrate the files to google drive, the old links will break and become obsolete as the previous location in Box will no longer exist.
Writing a find/replace script that updates the strings wont work as although the string changes the URL_link attached to it stays the same, does anybody have any suggestions? I can't seem to find anything about this in the google API.
I had the idea of breaking the link, updating the string, and then making it a link again. But once again, i can't seem to find how to create a link from a string in the API.
Any help would be really appreciated, thanks
Solution / Workaround
You can automate this using the Google APIs. These are the following steps I would follow to achieve what you are aiming for here:
Migrate the files to Google Drive (this will convert your documents into Google Doc files that then you can access with the Gooogle Docs API. Do this by specifying the MIME type in the metadata when doing the migration. Here you can see how to specify this and upload using the Google Drive API.
Once you have all your desired files uploaded to Drive as docs, you will get their body and look for the links in order to replace them. You can access the links by accessing the body element inside the document element, for more information with regards to this check this link and explore the nested objects. Perform a find replace on the body to change the URL of the document.
If you have issues regarding the change of attached links as you mentioned in your question, check out this other Stack Overflow answer that addresses this problems.
Change the link by updating the document following the instructions stated in the above Stack Overflow Question and the documentation.
I hope this has helped you. Let me know if you need anything else or if you did not understood something. :)
I have been checking out some terminal to svg recorders like termtosvg written in Python and svg-term-cli in Typescript.
I installed termtosvg and recorded a small terminal session to keep in my README as a demo. However github doesn't render it. Strangely it renders all the svg animations that termtosvg has.
svg-term-cli is using Rawgit to render, but I don't want to use it as it will be taken down.
I made a small repository for testing purposes here. I downloaded one svg from termtosvg, one from svg-term-cli and one of my own and put it in docs folder in the repo. And linked to them from my README.md.
Issue
The svg animation from svg-term-cli renders in README however the other two don't.
NOTE:
Inside docs folder I can clearly see Github rendering the animated svgs.
I'd like to use termtosvg and not svg-term-cli.
Why is this happening? How do I make README render my animated svg.
I had a chat with the creators of termtosvg and found out that termtosvg uses animation tags which GitHub considers as scripts thereby removing them. That's why we see just a black screen and no animation when we try to link svgs output by termtosvg.
svg-term-cli and the shark animation on the other hand uses CSS to achieve the same thing which GitHub doesn't seem to have an issue with. That's why they get rendered.
Possible workarounds:
Using github.io to host the images and link that to README as that seems to work.
Using Rawgit. But keeping in mind that it will be taken down soon.
In my readme on GitHub I have several images that are present there in my project's source tree which I reference successfully with directives like
.. image:: ./doc/source/_static/figs/moon_probe.png
I would also like to have these images appear when this same readme is generated in PyPi.
How do I (a) ensure that images are present on PyPi for the readme to access and (b) formulate the .. image:: directive to access them?
PyPI will not read your package distributions for the image. You have to use the image's external link, for example:
.. image:: https://raw.githubusercontent.com/greyli/flask-share/master/images/demo.png
If you are using Markdown description, use this:
![](https://raw.githubusercontent.com/greyli/flask-share/master/images/demo.png)
Be sure to replace the URL in the above examples with your image URL, here I use the image hosted by GitHub, the real demo is on PyPI.
P.S. To get the image's raw link on GitHub, right-click the image and choose Copy image address.
Go to the image address in the Github repository. The path shown will be like this:
https://github.com/tensorbored/kds/blob/master/docs/_static/readme_lift.png
Change the blob term in the image address to raw
https://github.com/tensorbored/kds/raw/master/docs/_static/readme_lift.png
If you have your images on Github, navigate to the image then right click on download button and copy link address:
Then you can add it in your README.md file:
![](https://github.com/your_username/your_repository/raw/master/images/img2.png)
It should be rendered properly both on Github and PyPi.
Setting ?raw=True at the end of GitHub image link seems to work.
example:
![Sample image](https://github.com/usename/reponame/blob/master/sample.png?raw=True)
I had found this somewhere on the internet previously, but couldn't find it now. I'll credit the original author when I find it again.
The long_description_content_type should be text/x-rst if you use restructured text syntax (README.rst). Assuming that is what you are using based on ".. image::". If you save the image on GitHub and use that external link for the image then it works (typically something like raw.githubusercontent.com.... as described in one of the above answers).
It does work as shown in this pypi package:
https://pypi.org/project/gammath-spot/