Giter Site home page Giter Site logo

carefree0910 / carefree-portable Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 59 KB

Create portable (Python ๐Ÿ) projects on the fly ๐Ÿš€ !

Home Page: https://carefree0910.me/carefree-portable-doc

License: MIT License

Python 100.00%
python portable

carefree-portable's Introduction

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 for more details.

AI PC

AI PC is a 'new' concept that Intel proposed (see here). Since AI PC users often have zero knowledge about programming, it is important to provide them with a portable version of the AI project. This is where carefree-portable ๐Ÿ“ฆ๏ธ comes in handy!

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 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 for more details).
    • Here'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.

pip install carefree-portable

or

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

Usages

Detailed usages can be found in the CLI & Configurations documentation.

Go to the root directory of your project first:

cd <path/to/your/project>

Generate Config

To generate a default config, run:

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:

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:

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

Portable carefree-portable ๐Ÿ“ฆ๏ธ

You may also download the carefree-portable-*.zip from the assets of the latest 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 example:

  1. Download the carefree-portable-*.zip from the assets of the latest 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, and put it into the unzipped folder (./carefree-portable-*).
  4. Run the following command, and wait until the webui pops up:
.\python_embeddables\python-3.10.11-embed-amd64\python run.py
  1. 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 for more details.

License

carefree-portable ๐Ÿ“ฆ๏ธ is MIT licensed, as found in the LICENSE file.


carefree-portable's People

Contributors

carefree0910 avatar

Stargazers

Dylancer avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.