从python包读取文件

pypifs的Python项目详细描述


https://api.travis-ci.org/moremoban/pypifs.svghttps://codecov.io/github/moremoban/pypifs/coverage.pnghttps://dev.azure.com/moremoban/pypifs/_apis/build/status/moremoban.pypifs?branchName=master

它有助于在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

首次发布

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
返回数组无效的java方法   异步Java CompletableFuture获取其请求   java是否可以像RDBMS那样使用视图?   java如何在屏幕上只运行一个片段?   java无法从Vertex jdbc查询中获取结果   java从jtable获取对象的正确方法   java Spring 3数据设备替代方案   Java BigDecimal:四舍五入到客户首选的数字和增量   JAVA主窗口没有出现,我必须左键单击主窗口。java并单击run查看它   Eclipse RCP中的java进程自定义设备事件   JavaEclipse一次又一次地构建代码(没有任何更改)?   java如何实现对象合并