{"id":20760041,"url":"https://github.com/dexplo/jupyter_to_medium","last_synced_at":"2025-04-09T09:05:46.161Z","repository":{"id":37203695,"uuid":"262468599","full_name":"dexplo/jupyter_to_medium","owner":"dexplo","description":"Python package for publishing Jupyter Notebooks as Medium blogposts","archived":false,"fork":false,"pushed_at":"2023-08-23T00:26:39.000Z","size":34451,"stargazers_count":148,"open_issues_count":18,"forks_count":14,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-02T03:58:38.083Z","etag":null,"topics":["jupyter-notebooks","medium","python"],"latest_commit_sha":null,"homepage":"https://dexplo.org/jupyter_to_medium","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dexplo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://www.dunderdata.com"]}},"created_at":"2020-05-09T02:05:59.000Z","updated_at":"2025-03-06T16:50:40.000Z","dependencies_parsed_at":"2024-06-21T16:45:06.090Z","dependency_job_id":"fd5ed8b3-33a3-4e95-8545-a082ff832d0c","html_url":"https://github.com/dexplo/jupyter_to_medium","commit_stats":{"total_commits":200,"total_committers":3,"mean_commits":66.66666666666667,"dds":"0.18500000000000005","last_synced_commit":"ecaa333e1c632bd1319b01219647bf7cd4f7fc6a"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dexplo%2Fjupyter_to_medium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dexplo%2Fjupyter_to_medium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dexplo%2Fjupyter_to_medium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dexplo%2Fjupyter_to_medium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dexplo","download_url":"https://codeload.github.com/dexplo/jupyter_to_medium/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248008630,"owners_count":21032556,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jupyter-notebooks","medium","python"],"created_at":"2024-11-17T10:10:24.944Z","updated_at":"2025-04-09T09:05:46.132Z","avatar_url":"https://github.com/dexplo.png","language":"Jupyter Notebook","funding_links":["https://www.dunderdata.com"],"categories":[],"sub_categories":[],"readme":"# Jupyter to Medium\n\n[![](https://img.shields.io/pypi/v/jupyter_to_medium)](https://pypi.org/project/jupyter_to_medium)\n[![PyPI - License](https://img.shields.io/pypi/l/jupyter_to_medium)](LICENSE)\n[![codecov](https://codecov.io/gh/dexplo/jupyter_to_medium/branch/master/graph/badge.svg?token=948J8ECAQT)](https://codecov.io/gh/dexplo/jupyter_to_medium)\n\nPublish Jupyter Notebooks as Medium blog posts directly from your notebook with the help of jupyter_to_medium.\n\n![](https://raw.githubusercontent.com/dexplo/jupyter_to_medium/master/docs/images/social_share_small.png)\n\n## Target User\n\nDo you ....\n\n* Publish blog posts on Medium?\n* Use Jupyter Notebooks to write your posts?\n* Dislike the time and effort it takes to transfer your posts from Jupyter to Medium?\n* Get lost/bored when switching between the medium editor, gist etc to create well linted code?\n* Want to integrate LaTeX into your posts without manually screenshot-ing all your equation cells?\n\nIf so, jupyter_to_medium will automate the process of taking your Jupyter Notebook, as is, and publishing it as a Medium post in almost no time at all saving huge amounts of time.\n\n## Motivation\n\nI've [published dozens of blog posts on Medium][0] myself with all of them beginning as Jupyter Notebooks. Manually converting them to Medium posts was a fairly lengthy, painstaking process. One particularly painful process was inserting tables, which Medium does not support, into my posts. Nearly all of my posts contain numerous pandas DataFrames ([such as this one][1], which has 40! DataFrames) which are represented as HTML tables within a notebook. I'd take screenshots of each one to insert them into my Medium posts.\n\n[0]: http://medium.com/dunder-data\n[1]: https://medium.com/dunder-data/selecting-subsets-of-data-in-pandas-6fcd0170be9c\n\n## Installation\n\n`pip install jupyter_to_medium`\n\n### Automatically activated\n\nYou should be able to skip the next step, but if the extension is not showing up in your notebook, run the following command:\n\n`jupyter bundlerextension enable --py jupyter_to_medium._bundler --sys-prefix`\n\n## Get an Integration Token from Medium\n\nBefore using this package, you must request an integration token from Medium by emailing them at \u003ca href=\"mailto:yourfriends@medium.com\"\u003eyourfriends@medium.com\u003c/a\u003e allowing you to create a token in \u003ca href=\"https://medium.com/me/settings\"\u003eyour Medium settings.\u003c/a\u003e You can read the [entire instructions on how to get your integration token](https://github.com/Medium/medium-api-docs#21-self-issued-access-tokens).\n\n### Creating the integration token\n\nOnce your request to create integration tokens is accepted, navigate to \u003ca href=\"https://medium.com/me/settings\"\u003eyour Medium settings.\u003c/a\u003e In the 'Secuity \u0026 Apps' section at the bottom you'll see 'Integration tokens'. Enter a description for the token (`jupyter_to_medium` is a good choice) and then create the token.\n\n![png](https://raw.githubusercontent.com/dexplo/jupyter_to_medium/master/docs/images/integration_token.png)\n\n### Save your integration token\n\nOnce you have your integration token, create the folder and file `.jupyter_to_medium/integration_token` in your home directory and save the token there. If you don't save it, you'll need to access it every time you wish to make a new post.\n\n### Create / save your github PAT (only required for gist integration)\n\nWhen publishing, jtm can take unformatted code snippets and replace them with [linted gists](https://gist.github.com/mjam03/761d017e821b62c3adf2d4cf1b7477d3). In order to do this, it needs to create the gists which requires github access as well as a Personal Access Token (PAT). To create a github account, sign up [here](https://github.com/) and then follow [these instructions](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) to create a PAT - __ensure to select the option for creating gists__.\n\nOnce you have your Github PAT, similar to the integration token, create the folder and file `.jupyter_to_medium/github_token` in your home directory and save the token there. If you don't save it, you'll need to access it every time you wish to make a new post.\n\n## Usage\n\nThere are three ways to publish notebooks:\n\n* Within an active notebook\n* From the command line\n* Using a Python script\n\n### Publishing to Medium within a Notebook\n\nAfter installation, open the notebook you wish to publish and select the option `File -\u003e Deploy as -\u003e Medium Post`\n\n![png](https://raw.githubusercontent.com/dexplo/jupyter_to_medium/master/docs/images/menu_option.png)\n\nA new browser tab will open with a short form that needs to be completed.\n\n![png](https://raw.githubusercontent.com/dexplo/jupyter_to_medium/master/docs/images/form.png)\n\nAfter clicking publish, the notebook and all images will be uploaded to Medium. Any HTML tables (such as pandas DataFrames) will be converted to images (via chrome), as Medium has no ability to represent tables. This is a time consuming process, so be prepared to wait. Check your terminal for updates. If successful, you'll get the following response with a link to view the post.\n\n![png](https://raw.githubusercontent.com/dexplo/jupyter_to_medium/master/docs/images/success.png)\n\nClick the link to view the post.\n\n![png](https://raw.githubusercontent.com/dexplo/jupyter_to_medium/master/docs/images/post.png)\n\n### Finalize and publish on Medium\n\nCurrently, your post will be published as a draft. Review and publish the post on Medium.\n\n### Publishing to Medium from the Command Line\n\nUpon installation, you'll have access to the command line program `jupyter_to_medium` with the same options as the below function.\n\n```bash\njupyter_to_medium --pub-name=\"Dunder Data\" --tags=\"python, data science\" \"My Awesome Blog Post.ipynb\"\n```\n\n### Publishing to Medium with a Python Script\n\nIn a separate script/notebook, import `juptyer_to_medium` as a module. Pass the `publish` function the location of the Jupyter Notebook you would like to publish as a Medium blog post.\n\n```python\nimport jupyter_to_medium as jtm\njtm.publish('My Awesome Jupyter Notebook.ipynb',\n            integration_token=None,\n            pub_name=None,\n            title=None,\n            tags=None,\n            publish_status='draft',\n            notify_followers=False,\n            license='all-rights-reserved',\n            canonical_url=None,\n            chrome_path=None,\n            save_markdown=False,\n            table_conversion='chrome',\n            gistify=False,\n            gist_threshold=5,\n            public_gists=True\n            )\n```\n\nIf successful, a message will be printed with the URL to your post.  Additionally, JSON data will be returned as a dictionary containing the returned request from Medium.\n\n## Works for Classic Notebook not Jupyter Lab\n\nCurrently, this package only works for the \"classic\" Jupyter Notebook and is not available in Jupyter Lab. If you have experience making Jupyter Lab extensions, please let me know.\n\n## Troubleshooting\n\nIf your post is unsuccessful, a message with the error will be printed to the screen with information that might help you solve the issue.\n\n### Table conversion with Chrome or Matplotlib\n\nBy default, tables will be converted via Chrome web browser by taking screenshots of them. If you don't have Chrome installed or cannot \nget chrome to work, select 'matplotlib' for the table conversion.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdexplo%2Fjupyter_to_medium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdexplo%2Fjupyter_to_medium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdexplo%2Fjupyter_to_medium/lists"}