从python包读取文件
pypifs的Python项目详细描述
它有助于在python包上执行file operations。 它安装python包并返回python文件系统2的OSFS实例。
这个想法源于moban,它使用python包作为 具有用于创建新python包的版本化模板的工具。当然,它可以实现 除moban v0.6.0外,其他任何方式都要求python文件系统2接口。因此,这个库被编写。
在python包中获取文件
>>>importfs>>>pypi_fs=fs.open_fs("pypi://pypi-mobans-pkg/resources/templates")>>>pypi_fs.read("_versions.py.jj2")'__version__ = "0.0.1"\n__author__ = "C.W."\n'
列出感兴趣的文件
>>>pypi_fs=fs.open_fs("pypi://pypi-mobans-pkg/resources")>>>forpathinpypi_fs.walk.files(filter=['*.jj2']):...print(path).../templates/requirements.txt.jj2/templates/installation.rst.jj2/templates/test.script.jj2/templates/conf.py.jj2/templates/_version.py.jj2/templates/Pipfile.jj2/templates/min_requirements.txt.jj2/templates/README.rst.jj2/templates/badges.rst.jj2/templates/__init__.py.jj2/templates/NEW_BSD_LICENSE.jj2/templates/MANIFEST.in.jj2/templates/CHANGELOG.rst.jj2/templates/travis.yml.jj2/templates/setup.py.jj2/templates/gitignore.jj2/templates/lint.script.jj2/templates/tests/requirements.txt.jj2/templates/docs/make.bat.jj2/templates/docs/Makefile.jj2/templates/docs/index.rst.jj2/templates/docs/source/conf.py.jj2/templates/docs/source/index.rst.jj2
写了吗?
是的,它将按您所能的方式编写,而不使用pypifs。但是,从来没有 Pypifs的意图。
安装
您可以通过pip安装pypifs:
$ pip install pypifs
或者克隆并安装:
$ git clone https://github.com/moremoban/pypifs.git
$ cd pypifs
$ python setup.py install
更改日志
0.0.1至18.8.2019
首次发布