carefree-portable


Namecarefree-portable JSON
Version 0.1.2 PyPI version JSON
download
home_page
SummaryCreate portable (Python 🐍) projects on the fly 🚀 !
upload_time2023-12-22 10:22:54
maintainer
docs_urlNone
authorcarefree0910
requires_python
license
keywords python portable
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # carefree-portable 📦️

`carefree-portable` 📦️ aims to help you create portable (Python 🐍) projects of your codes / repo!

> 💡We are planning to:
> - ~~use `venv` as a fallback solution for Linux / MacOS.~~ (Done!)
> - support other programming languages in the future, after Python is fully supported.
> 
> See [Roadmap](https://carefree0910.me/carefree-portable-doc/docs/about/roadmap) for more details.


## Highlights

- **Portable**: The generated portable project can be used directly without any extra requirements.
  - For example, you can run a portable Python project even without Python installed!
- **Extensible**: You can easily extend the functionality of `carefree-portable` 📦️ by editing existing configurations, or adding brand new `block` / `preset` without much effort.
  - See the [Stable Diffusion Web UI](https://github.com/carefree0910/carefree-portable/blob/main/examples/sd_webui) example on how we hijack the famous SD webui repo with a custom `block` and make it portable out-of-the-box.
- **Integrable**: You can integrate `carefree-portable` 📦️ with (GitHub) CI to automatically generate a portable version of your project.
  - Basically, you only need to create a `cfport.json` file in the root directory of your project, and then run `cfport package` in your CI workflow (see [Usages](#usages) for more details).
  - [Here](https://github.com/carefree0910/carefree-portable/blob/main/.github/workflows/package.yml)'s an example of how `carefree-portable` 📦️ packages itself into a portable version in the GitHub CI workflow.


## Installation

`carefree-portable` 📦️ requires Python 3.8 or higher.

```bash
pip install carefree-portable
```

or

```bash
git clone https://github.com/carefree0910/carefree-portable.git
cd carefree-portable
pip install -e .
```


## Usages

> Detailed usages can be found in the [CLI](https://carefree0910.me/carefree-portable-doc/docs/user-guides/cli) & [Configurations](http://localhost:3000/carefree-portable-doc/docs/user-guides/configurations) documentation.

Go to the root directory of your project first:

```bash
cd <path/to/your/project>
```

### Generate Config

To generate a default config, run:

```bash
cfport config
```

This command will genearte a `cfport.json` file in the current directory. To make it work properly, you may need to edit the `python_requirements` field, which is a list of Python packages that your project depends on.

> - Don't forget to add your own project to this field as well!

### Packaging

After generating the config, you can package your project by running:

```bash
cfport package
```

### PyTorch

Since nowadays many fancy projects are built on top of `pytorch`, we provided a preset config for `pytorch` projects, which can be generated by:

```bash
cfport config --preset torch-2.1.0-cu118
# or
cfport config --preset torch-2.1.0-cpu
```

This will generate a `cfport.json` with a pre-defined `requirement` in the `python_requirements` field.

> You may notice that the pre-defined `requirement` starts with `$pip` instead of `pip`. This is important because it can tell `carefree-portable` 📦️ to use the correct `pip` executable when packaging your project.


## Examples

- [mixtral](https://github.com/carefree0910/carefree-portable/blob/main/examples/mixtral), which can generate a portable gradio demo for the famous [`Mixtral-8x7B` LLM](https://huggingface.co/docs/transformers/model_doc/mixtral).
- [Stable Diffusion Web UI](https://github.com/carefree0910/carefree-portable/blob/main/examples/sd_webui), which can generate a portable version of the famous [A1111 webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui).
- [Stable Diffusion - Playground v2](https://github.com/carefree0910/carefree-portable/blob/main/examples/sd_playground_v2), which can generate a portable version of the brilliant [Playground v2 HuggingFace Space](https://huggingface.co/spaces/playgroundai/playground-v2).
  - `Playground v2` itself is a fantastic SD model. It is said that images generated by `Playground v2` are favored **2.5** times more than those produced by SDXL. See their [user study](https://huggingface.co/playgroundai/playground-v2-1024px-aesthetic#user-study) for more details.


## Portable `carefree-portable` 📦️

You may also download the `carefree-portable-*.zip` from the assets of the latest [Releases](https://github.com/carefree0910/carefree-portable/releases). The zip files contain the portable versions of `carefree-portable` 📦️ that can be used directly:
- On Linux / MacOS, you still need to have Python installed (to activate the `venv`), but no extra packages are required.
- On Windows, you can even run it without Python installed!

If you are using this portable version, just make sure to:
- `cd` into the unzipped `carefree-portable-*` folder.
- Replace `cfport` with `.\run.bat` (Windows) / `bash run.sh` (Linux / MacOS) in the following commands.
- Replace `python` with `<path\to\portable\python>` in other python commands. The portable `python` locates at:
  - Windows: `.\carefree-portable-*\python_embeddables\python-3.10.11-embed-amd64\python`.
  - Linux / MacOS: `./carefree-portable-*/python_venv/bin/python3`.

Here's a step by step guide on how to use the portable `carefree-portable` 📦️ to run the [Stable Diffusion Web UI](https://github.com/carefree0910/carefree-portable/blob/main/examples/sd_webui) example:

1. Download the `carefree-portable-*.zip` from the assets of the latest [Releases](https://github.com/carefree0910/carefree-portable/releases).
2. Unzip the `carefree-portable-*.zip` to a folder (let's say, `./carefree-portable-*`), and `cd` into it.
3. Download the `run.py` from [here](https://github.com/carefree0910/carefree-portable/blob/main/examples/sd_webui/run.py), and put it into the unzipped folder (`./carefree-portable-*`).
4. Run the following command, and wait until the webui pops up:

```bash
.\python_embeddables\python-3.10.11-embed-amd64\python run.py
```

5. After these steps, you'll obtain a portable version of the SD webui (locates at `./carefree-portable-*/sd_webui_cfport`), which can be used directly without any extra requirements!


## Contributing

Contributions are truly welcomed!

See [CONTRIBUTING.md](https://github.com/carefree0910/carefree-portable/blob/main/CONTRIBUTING.md) for more details.


## License

`carefree-portable` 📦️ is MIT licensed, as found in the [`LICENSE`](https://github.com/carefree0910/carefree-portable/blob/main/LICENSE) file.

---

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "carefree-portable",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python portable",
    "author": "carefree0910",
    "author_email": "syameimaru.saki@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/14/99/918a99f3cb599cca18eaa7969f809272f81f1ad85086e7b8ae9c2d6de1ff/carefree-portable-0.1.2.tar.gz",
    "platform": null,
    "description": "# carefree-portable \ud83d\udce6\ufe0f\r\n\r\n`carefree-portable` \ud83d\udce6\ufe0f aims to help you create portable (Python \ud83d\udc0d) projects of your codes / repo!\r\n\r\n> \ud83d\udca1We are planning to:\r\n> - ~~use `venv` as a fallback solution for Linux / MacOS.~~ (Done!)\r\n> - support other programming languages in the future, after Python is fully supported.\r\n> \r\n> See [Roadmap](https://carefree0910.me/carefree-portable-doc/docs/about/roadmap) for more details.\r\n\r\n\r\n## Highlights\r\n\r\n- **Portable**: The generated portable project can be used directly without any extra requirements.\r\n  - For example, you can run a portable Python project even without Python installed!\r\n- **Extensible**: You can easily extend the functionality of `carefree-portable` \ud83d\udce6\ufe0f by editing existing configurations, or adding brand new `block` / `preset` without much effort.\r\n  - See the [Stable Diffusion Web UI](https://github.com/carefree0910/carefree-portable/blob/main/examples/sd_webui) example on how we hijack the famous SD webui repo with a custom `block` and make it portable out-of-the-box.\r\n- **Integrable**: You can integrate `carefree-portable` \ud83d\udce6\ufe0f with (GitHub) CI to automatically generate a portable version of your project.\r\n  - Basically, you only need to create a `cfport.json` file in the root directory of your project, and then run `cfport package` in your CI workflow (see [Usages](#usages) for more details).\r\n  - [Here](https://github.com/carefree0910/carefree-portable/blob/main/.github/workflows/package.yml)'s an example of how `carefree-portable` \ud83d\udce6\ufe0f packages itself into a portable version in the GitHub CI workflow.\r\n\r\n\r\n## Installation\r\n\r\n`carefree-portable` \ud83d\udce6\ufe0f requires Python 3.8 or higher.\r\n\r\n```bash\r\npip install carefree-portable\r\n```\r\n\r\nor\r\n\r\n```bash\r\ngit clone https://github.com/carefree0910/carefree-portable.git\r\ncd carefree-portable\r\npip install -e .\r\n```\r\n\r\n\r\n## Usages\r\n\r\n> Detailed usages can be found in the [CLI](https://carefree0910.me/carefree-portable-doc/docs/user-guides/cli) & [Configurations](http://localhost:3000/carefree-portable-doc/docs/user-guides/configurations) documentation.\r\n\r\nGo to the root directory of your project first:\r\n\r\n```bash\r\ncd <path/to/your/project>\r\n```\r\n\r\n### Generate Config\r\n\r\nTo generate a default config, run:\r\n\r\n```bash\r\ncfport config\r\n```\r\n\r\nThis command will genearte a `cfport.json` file in the current directory. To make it work properly, you may need to edit the `python_requirements` field, which is a list of Python packages that your project depends on.\r\n\r\n> - Don't forget to add your own project to this field as well!\r\n\r\n### Packaging\r\n\r\nAfter generating the config, you can package your project by running:\r\n\r\n```bash\r\ncfport package\r\n```\r\n\r\n### PyTorch\r\n\r\nSince nowadays many fancy projects are built on top of `pytorch`, we provided a preset config for `pytorch` projects, which can be generated by:\r\n\r\n```bash\r\ncfport config --preset torch-2.1.0-cu118\r\n# or\r\ncfport config --preset torch-2.1.0-cpu\r\n```\r\n\r\nThis will generate a `cfport.json` with a pre-defined `requirement` in the `python_requirements` field.\r\n\r\n> You may notice that the pre-defined `requirement` starts with `$pip` instead of `pip`. This is important because it can tell `carefree-portable` \ud83d\udce6\ufe0f to use the correct `pip` executable when packaging your project.\r\n\r\n\r\n## Examples\r\n\r\n- [mixtral](https://github.com/carefree0910/carefree-portable/blob/main/examples/mixtral), which can generate a portable gradio demo for the famous [`Mixtral-8x7B` LLM](https://huggingface.co/docs/transformers/model_doc/mixtral).\r\n- [Stable Diffusion Web UI](https://github.com/carefree0910/carefree-portable/blob/main/examples/sd_webui), which can generate a portable version of the famous [A1111 webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui).\r\n- [Stable Diffusion - Playground v2](https://github.com/carefree0910/carefree-portable/blob/main/examples/sd_playground_v2), which can generate a portable version of the brilliant [Playground v2 HuggingFace Space](https://huggingface.co/spaces/playgroundai/playground-v2).\r\n  - `Playground v2` itself is a fantastic SD model. It is said that images generated by `Playground v2` are favored **2.5** times more than those produced by SDXL. See their [user study](https://huggingface.co/playgroundai/playground-v2-1024px-aesthetic#user-study) for more details.\r\n\r\n\r\n## Portable `carefree-portable` \ud83d\udce6\ufe0f\r\n\r\nYou may also download the `carefree-portable-*.zip` from the assets of the latest [Releases](https://github.com/carefree0910/carefree-portable/releases). The zip files contain the portable versions of `carefree-portable` \ud83d\udce6\ufe0f that can be used directly:\r\n- On Linux / MacOS, you still need to have Python installed (to activate the `venv`), but no extra packages are required.\r\n- On Windows, you can even run it without Python installed!\r\n\r\nIf you are using this portable version, just make sure to:\r\n- `cd` into the unzipped `carefree-portable-*` folder.\r\n- Replace `cfport` with `.\\run.bat` (Windows) / `bash run.sh` (Linux / MacOS) in the following commands.\r\n- Replace `python` with `<path\\to\\portable\\python>` in other python commands. The portable `python` locates at:\r\n  - Windows: `.\\carefree-portable-*\\python_embeddables\\python-3.10.11-embed-amd64\\python`.\r\n  - Linux / MacOS: `./carefree-portable-*/python_venv/bin/python3`.\r\n\r\nHere's a step by step guide on how to use the portable `carefree-portable` \ud83d\udce6\ufe0f to run the [Stable Diffusion Web UI](https://github.com/carefree0910/carefree-portable/blob/main/examples/sd_webui) example:\r\n\r\n1. Download the `carefree-portable-*.zip` from the assets of the latest [Releases](https://github.com/carefree0910/carefree-portable/releases).\r\n2. Unzip the `carefree-portable-*.zip` to a folder (let's say, `./carefree-portable-*`), and `cd` into it.\r\n3. Download the `run.py` from [here](https://github.com/carefree0910/carefree-portable/blob/main/examples/sd_webui/run.py), and put it into the unzipped folder (`./carefree-portable-*`).\r\n4. Run the following command, and wait until the webui pops up:\r\n\r\n```bash\r\n.\\python_embeddables\\python-3.10.11-embed-amd64\\python run.py\r\n```\r\n\r\n5. After these steps, you'll obtain a portable version of the SD webui (locates at `./carefree-portable-*/sd_webui_cfport`), which can be used directly without any extra requirements!\r\n\r\n\r\n## Contributing\r\n\r\nContributions are truly welcomed!\r\n\r\nSee [CONTRIBUTING.md](https://github.com/carefree0910/carefree-portable/blob/main/CONTRIBUTING.md) for more details.\r\n\r\n\r\n## License\r\n\r\n`carefree-portable` \ud83d\udce6\ufe0f is MIT licensed, as found in the [`LICENSE`](https://github.com/carefree0910/carefree-portable/blob/main/LICENSE) file.\r\n\r\n---\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Create portable (Python \ud83d\udc0d) projects on the fly \ud83d\ude80 !",
    "version": "0.1.2",
    "project_urls": null,
    "split_keywords": [
        "python",
        "portable"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1499918a99f3cb599cca18eaa7969f809272f81f1ad85086e7b8ae9c2d6de1ff",
                "md5": "5e43f094c84e217d4280db0492019bf2",
                "sha256": "edd558ba8174cfbd5d6bc94dfb347a85700ec4e2c5df5491c66de753416d0910"
            },
            "downloads": -1,
            "filename": "carefree-portable-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "5e43f094c84e217d4280db0492019bf2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 14483,
            "upload_time": "2023-12-22T10:22:54",
            "upload_time_iso_8601": "2023-12-22T10:22:54.932238Z",
            "url": "https://files.pythonhosted.org/packages/14/99/918a99f3cb599cca18eaa7969f809272f81f1ad85086e7b8ae9c2d6de1ff/carefree-portable-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-22 10:22:54",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "carefree-portable"
}
        
Elapsed time: 0.15190s