colab-assist


Namecolab-assist JSON
Version 0.2.2 PyPI version JSON
download
home_pageNone
SummaryGoogle Colab workflow utilities
upload_time2025-02-17 10:37:53
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseNone
keywords colab github google cloud utilities uv workflow
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  <h1><b>colab-assist</b></h1>
  <p>
    Google Colab workflow utilities
  </p>
</div>

---

[![Test PyPI][pypi-badge]][pypi]
[![Documentation][readthedocs-badge]][readthedocs]
[![Issues][issues-badge]][issues]

[![CI workflow status][ci-workflow-badge]][ci-workflow]
[![Release workflow status][release-workflow-badge]][release-workflow]
[![Test coverage][codecov-badge]][codecov]


## About

- __colab-assist__ is a small package that shares the utility functions that
  I find useful for my development workflows on [Google Colab](https://colab.google).

- Actually, this is also a semi-mock project that I use to learn Python open-source development.
  [Feedbacks, pointers, and feature suggestions](https://github.com/dd-n-kk/colab-assist/issues/)
  are much appreciated!


## Usage

### Experimenting your private Python package on Colab

1. Develop your package any way you like and push it to your private GitHub repo.

2. Make a repo-specific [personal access token (PAT)](https://is.gd/qWZkuT).

3. Store the PAT as a [Colab Secret](https://stackoverflow.com/a/77737451):

    ![Colab Secrets demo](assets/imgs/colab_secrets.png)

4. On Colab:
    ```py
    import colab_assist as A
    ```

    - Install → experiment → push → resintall:
      ```py
      # Install your private package
      A.install("$my_token@me/my_pkg@feat/foo")

      # Experiment
      from my_pkg import foo
      foo()

      # Update the repo

      # Reinstall updated package
      A.install("$my_token@me/my_pkg@feat/foo")

      # Reimport updated functions/classes without needing to restart Colab session
      foo = A.reload(foo)
      foo()
      ```

    - Or clone → experiment → push → pull:
      ```py
      # Clone your private package and automatically add it to `sys.path`
      A.clone("$my_token@me/my_pkg@feat/foo", x="p")

      # Experiment
      from my_pkg import foo
      foo()

      # Update the repo

      # Pull the update
      A.pull("my_pkg")

      # Reimport updated functions/classes without needing to restart Colab session
      foo = A.reload(foo)
      foo()

      # Or restart the Colab session with `sys.path` automatically recovered
      A.restart()

      import colab_assist as A  # Import `colab_assist` recovers previously extended `sys.path`
      from my_pkg import foo  # The clone is now again importable
      foo()

      # Terminate the Colab runtime with your clones automatically cleaned up
      A.end()
      ```

### Text file creation and editing

```py
# Create `foo.txt` at working directory and call `google.colab.files.view()` to edit it
A.edit("foo.txt", x="c")
```


## Dependencies & Installation

- Although currently colab-assist lists no dependencies,
  it is intended to __only be installed and used in a Google Colab environment__.
  The reason not to explicitly list dependencies for now is that
  at least one depedency ([`google-colab`](https://github.com/googlecolab/colabtools))
  is bespoke for Colab and not hosted on PyPI.
  However, colab-assist is designed to install and run just fine on a fresh Colab instance.

- You can install colab-assist very quickly with pre-installed uv on Colab:
  ``` { .yaml .copy }
  !uv pip install --system -q colab-assist
  ```
  Or with pip:
  ``` { .yaml .copy }
  %pip install -q colab-assist
  ```


## License

- [MIT license](https://github.com/dd-n-kk/colab-assist/blob/main/LICENSE)


## Acknowledgements

- [Google Colaboratory](https://github.com/googlecolab/colabtools)
- [uv](https://github.com/astral-sh/uv)
- [MkDocs](https://github.com/mkdocs/mkdocs)
- [Material for MkDocs](https://github.com/squidfunk/mkdocs-material)
- [mkdocstrings](https://github.com/mkdocstrings/mkdocstrings)
- [git-cliff](https://github.com/orhun/git-cliff)
- [shields](https://github.com/badges/shields)


[pypi-badge]: https://img.shields.io/pypi/v/colab-assist?style=for-the-badge&logo=pypi&logoColor=white&label=PYPI
[pypi]: https://pypi.org/project/colab-assist
[readthedocs-badge]: https://img.shields.io/readthedocs/colab-assist?style=for-the-badge&logo=readthedocs&logoColor=white
[readthedocs]: https://colab-assist.readthedocs.io
[issues-badge]: https://img.shields.io/github/issues/dd-n-kk/colab-assist?style=for-the-badge&logo=github&logoColor=white
[issues]: https://github.com/dd-n-kk/colab-assist/issues
[ci-workflow-badge]: https://img.shields.io/github/actions/workflow/status/dd-n-kk/colab-assist/ci.yaml?style=flat-square&logo=pytest&logoColor=white&label=CI
[ci-workflow]: https://github.com/dd-n-kk/colab-assist/actions/workflows/ci.yaml
[release-workflow-badge]: https://img.shields.io/github/actions/workflow/status/dd-n-kk/colab-assist/release.yaml?style=flat-square&logo=githubactions&logoColor=white&label=Build
[release-workflow]: https://github.com/dd-n-kk/colab-assist/actions/workflows/release.yaml
[codecov-badge]: https://img.shields.io/codecov/c/github/dd-n-kk/colab-assist?style=flat-square&logo=codecov&logoColor=white&label=Coverage
[codecov]: https://app.codecov.io/gh/dd-n-kk/colab-assist

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "colab-assist",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "Colab, GitHub, Google, cloud, utilities, uv, workflow",
    "author": null,
    "author_email": "dd-n-kk <djlstvn.cs03@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/17/87/c39518404c93f4d70671ecc62b9ba19afd2aa9fee9ade739dda13ced40a1/colab_assist-0.2.2.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  <h1><b>colab-assist</b></h1>\n  <p>\n    Google Colab workflow utilities\n  </p>\n</div>\n\n---\n\n[![Test PyPI][pypi-badge]][pypi]\n[![Documentation][readthedocs-badge]][readthedocs]\n[![Issues][issues-badge]][issues]\n\n[![CI workflow status][ci-workflow-badge]][ci-workflow]\n[![Release workflow status][release-workflow-badge]][release-workflow]\n[![Test coverage][codecov-badge]][codecov]\n\n\n## About\n\n- __colab-assist__ is a small package that shares the utility functions that\n  I find useful for my development workflows on [Google Colab](https://colab.google).\n\n- Actually, this is also a semi-mock project that I use to learn Python open-source development.\n  [Feedbacks, pointers, and feature suggestions](https://github.com/dd-n-kk/colab-assist/issues/)\n  are much appreciated!\n\n\n## Usage\n\n### Experimenting your private Python package on Colab\n\n1. Develop your package any way you like and push it to your private GitHub repo.\n\n2. Make a repo-specific [personal access token (PAT)](https://is.gd/qWZkuT).\n\n3. Store the PAT as a [Colab Secret](https://stackoverflow.com/a/77737451):\n\n    ![Colab Secrets demo](assets/imgs/colab_secrets.png)\n\n4. On Colab:\n    ```py\n    import colab_assist as A\n    ```\n\n    - Install \u2192 experiment \u2192 push \u2192 resintall:\n      ```py\n      # Install your private package\n      A.install(\"$my_token@me/my_pkg@feat/foo\")\n\n      # Experiment\n      from my_pkg import foo\n      foo()\n\n      # Update the repo\n\n      # Reinstall updated package\n      A.install(\"$my_token@me/my_pkg@feat/foo\")\n\n      # Reimport updated functions/classes without needing to restart Colab session\n      foo = A.reload(foo)\n      foo()\n      ```\n\n    - Or clone \u2192 experiment \u2192 push \u2192 pull:\n      ```py\n      # Clone your private package and automatically add it to `sys.path`\n      A.clone(\"$my_token@me/my_pkg@feat/foo\", x=\"p\")\n\n      # Experiment\n      from my_pkg import foo\n      foo()\n\n      # Update the repo\n\n      # Pull the update\n      A.pull(\"my_pkg\")\n\n      # Reimport updated functions/classes without needing to restart Colab session\n      foo = A.reload(foo)\n      foo()\n\n      # Or restart the Colab session with `sys.path` automatically recovered\n      A.restart()\n\n      import colab_assist as A  # Import `colab_assist` recovers previously extended `sys.path`\n      from my_pkg import foo  # The clone is now again importable\n      foo()\n\n      # Terminate the Colab runtime with your clones automatically cleaned up\n      A.end()\n      ```\n\n### Text file creation and editing\n\n```py\n# Create `foo.txt` at working directory and call `google.colab.files.view()` to edit it\nA.edit(\"foo.txt\", x=\"c\")\n```\n\n\n## Dependencies & Installation\n\n- Although currently colab-assist lists no dependencies,\n  it is intended to __only be installed and used in a Google Colab environment__.\n  The reason not to explicitly list dependencies for now is that\n  at least one depedency ([`google-colab`](https://github.com/googlecolab/colabtools))\n  is bespoke for Colab and not hosted on PyPI.\n  However, colab-assist is designed to install and run just fine on a fresh Colab instance.\n\n- You can install colab-assist very quickly with pre-installed uv on Colab:\n  ``` { .yaml .copy }\n  !uv pip install --system -q colab-assist\n  ```\n  Or with pip:\n  ``` { .yaml .copy }\n  %pip install -q colab-assist\n  ```\n\n\n## License\n\n- [MIT license](https://github.com/dd-n-kk/colab-assist/blob/main/LICENSE)\n\n\n## Acknowledgements\n\n- [Google Colaboratory](https://github.com/googlecolab/colabtools)\n- [uv](https://github.com/astral-sh/uv)\n- [MkDocs](https://github.com/mkdocs/mkdocs)\n- [Material for MkDocs](https://github.com/squidfunk/mkdocs-material)\n- [mkdocstrings](https://github.com/mkdocstrings/mkdocstrings)\n- [git-cliff](https://github.com/orhun/git-cliff)\n- [shields](https://github.com/badges/shields)\n\n\n[pypi-badge]: https://img.shields.io/pypi/v/colab-assist?style=for-the-badge&logo=pypi&logoColor=white&label=PYPI\n[pypi]: https://pypi.org/project/colab-assist\n[readthedocs-badge]: https://img.shields.io/readthedocs/colab-assist?style=for-the-badge&logo=readthedocs&logoColor=white\n[readthedocs]: https://colab-assist.readthedocs.io\n[issues-badge]: https://img.shields.io/github/issues/dd-n-kk/colab-assist?style=for-the-badge&logo=github&logoColor=white\n[issues]: https://github.com/dd-n-kk/colab-assist/issues\n[ci-workflow-badge]: https://img.shields.io/github/actions/workflow/status/dd-n-kk/colab-assist/ci.yaml?style=flat-square&logo=pytest&logoColor=white&label=CI\n[ci-workflow]: https://github.com/dd-n-kk/colab-assist/actions/workflows/ci.yaml\n[release-workflow-badge]: https://img.shields.io/github/actions/workflow/status/dd-n-kk/colab-assist/release.yaml?style=flat-square&logo=githubactions&logoColor=white&label=Build\n[release-workflow]: https://github.com/dd-n-kk/colab-assist/actions/workflows/release.yaml\n[codecov-badge]: https://img.shields.io/codecov/c/github/dd-n-kk/colab-assist?style=flat-square&logo=codecov&logoColor=white&label=Coverage\n[codecov]: https://app.codecov.io/gh/dd-n-kk/colab-assist\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Google Colab workflow utilities",
    "version": "0.2.2",
    "project_urls": {
        "Documentation": "https://colab-assist.readthedocs.io",
        "Homepage": "https://github.com/dd-n-kk/colab-assist",
        "Issues": "https://github.com/dd-n-kk/colab-assist/issues"
    },
    "split_keywords": [
        "colab",
        " github",
        " google",
        " cloud",
        " utilities",
        " uv",
        " workflow"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "697a18bab8fb5dbc7a8ca18480779199d0ac35e1f7189bffbddb27c09e9e87bf",
                "md5": "5c22e1064993d5fa8c84c113eeb32089",
                "sha256": "f981e1f22949f2a44c52e4f0aad91be0baf5a4ec4aae2fd3576ab628bdb557e6"
            },
            "downloads": -1,
            "filename": "colab_assist-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5c22e1064993d5fa8c84c113eeb32089",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 11677,
            "upload_time": "2025-02-17T10:37:51",
            "upload_time_iso_8601": "2025-02-17T10:37:51.864027Z",
            "url": "https://files.pythonhosted.org/packages/69/7a/18bab8fb5dbc7a8ca18480779199d0ac35e1f7189bffbddb27c09e9e87bf/colab_assist-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1787c39518404c93f4d70671ecc62b9ba19afd2aa9fee9ade739dda13ced40a1",
                "md5": "7e3882dda4978d257a3111f6191225d2",
                "sha256": "47a4f8570a2ab6719ad6a835ca9ce33cb3f77f309a53e45c3fbd6fe4373bef22"
            },
            "downloads": -1,
            "filename": "colab_assist-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "7e3882dda4978d257a3111f6191225d2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 59400,
            "upload_time": "2025-02-17T10:37:53",
            "upload_time_iso_8601": "2025-02-17T10:37:53.334529Z",
            "url": "https://files.pythonhosted.org/packages/17/87/c39518404c93f4d70671ecc62b9ba19afd2aa9fee9ade739dda13ced40a1/colab_assist-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-17 10:37:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dd-n-kk",
    "github_project": "colab-assist",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "colab-assist"
}
        
Elapsed time: 0.44453s