Skip to main content

Read files from python packages

Project description

https://api.travis-ci.org/moremoban/pypifs.svg https://codecov.io/github/moremoban/pypifs/coverage.png https://badge.fury.io/py/pypifs.svg https://pepy.tech/badge/pypifs/month https://img.shields.io/github/stars/moremoban/pypifs.svg?style=social&maxAge=3600&label=Star https://dev.azure.com/moremoban/pypifs/_apis/build/status/moremoban.pypifs?branchName=master

It helps perform file operations over the python package. It installs the python package and returns python file system 2’s OSFS instance.

The idea originates from moban, which uses python package as a vehicle to have versioned templates for the creation of a new python package. Surely, it can be implemented in any other ways but moban v0.6.0 mandates python file system 2 interface. Hence this library is written.

Get a file inside a python package

>>> import fs
>>> pypi_fs = fs.open_fs("pypi://pypi-mobans-pkg/resources/templates")
>>> pypi_fs.readtext("_version.py.jj2")
'__version__ = "0.0.2"\n__author__ = "C.W."\n'

List files of interest

>>> pypi_fs = fs.open_fs("pypi://pypi-mobans-pkg/resources")
>>> for path in pypi_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

Does it write?

Yes, it will write as you can do so without using pypifs. But, it is never the intention of pypifs.

Installation

You can install pypifs via pip:

$ pip install pypifs

or clone it and install it:

$ git clone https://github.com/moremoban/pypifs.git
$ cd pypifs
$ python setup.py install

Change log

0.0.2 - 13.5.2020

updated

  1. #8: suppress pip install std output

  2. #6: added license text in the package

0.0.1 - 18.8.2019

first release

  1. what a feat!

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

pypifs-0.0.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

pypifs-0.0.2-py2.py3-none-any.whl (3.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pypifs-0.0.2.tar.gz.

File metadata

  • Download URL: pypifs-0.0.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for pypifs-0.0.2.tar.gz
Algorithm Hash digest
SHA256 cb3e2bca4a4c370dd212691fa3fc560167d0cd1817013617cfb71e51b6ed4ecd
MD5 09f8ed3a717ec49bc37867fd9aba366b
BLAKE2b-256 4de264ff2e7e6a3facd5a124645c01a9dbed4bf1218ac151edc8fc41387f7bfd

See more details on using hashes here.

File details

Details for the file pypifs-0.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: pypifs-0.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for pypifs-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3d71ed935cdda504b8bae9637d90bfa3458c38997d59baa809b950d5771ade90
MD5 039b4d37ec6c6eeb5ceed4c0da722bc2
BLAKE2b-256 614420538d06dca7be4628642c5d846e72dcffe30d7940d12ae134b1bd510503

See more details on using hashes here.

Supported by

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