Skip to main content

Quick packaging of python resource files

Project description

python 资源文件快捷打包
===========================

version 1.1


使用场景
-----------------------------


用 Pyinstaller 可以将 Python 程序打包为单个 exe 文件,发送到没有安装 Python 环境的电脑上直接运行,十分方便好用。

可是一旦你的程序中要用到一些资源文件,比如图片、字体等。你发送给对方的文件就不能只是一个 exe 文件了,必须将这些资源文件一起给对方才能正常使用。

这样一来原来的便捷简洁的特点就不复存在了,所以请使用 respack 来帮你解决这一困扰。

原理其实很简单,首先在开发过程中将资源文件的二进制编码以字符串形式保存在一个 .py 文件中。然后程序中调用资源文件时,将上述编码释放为一个实际文件。



使用说明
-----------------------------


```
$ pip install respack

>>> import respack
>>> respack.set('pic.jpg')
>>> # 可以删除 pic.jpg 文件
>>> respack.get('pic.jpg')
C:\packresources\pic.jpg
```


具体见 `demo.py` 中应用示例

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

respack-1.1.tar.gz (2.5 kB view details)

Uploaded Source

File details

Details for the file respack-1.1.tar.gz.

File metadata

  • Download URL: respack-1.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for respack-1.1.tar.gz
Algorithm Hash digest
SHA256 b5113561a831ed1141475a971a8fd4cbf9f972ae383846674584f8f8a13309c1
MD5 7a81fcfe20b1eb05249175f3c4865241
BLAKE2b-256 1b0d4ed876b1d0dd41332ab2d412095d3658b6a705f00e7bbd570b69d58fdbcd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page