Skip to main content
https://api.travis-ci.org/moremoban/gitfs2.svg https://codecov.io/github/moremoban/gitfs2/coverage.png https://badge.fury.io/py/gitfs2.svg https://pepy.tech/badge/gitfs2/month https://img.shields.io/github/stars/moremoban/gitfs2.svg?style=social&maxAge=3600&label=Star https://img.shields.io/static/v1?label=continuous%20templating&message=%E6%A8%A1%E7%89%88%E6%9B%B4%E6%96%B0&color=blue&style=flat-square https://img.shields.io/static/v1?label=coding%20style&message=black&color=black&style=flat-square https://dev.azure.com/moremoban/gitfs2/_apis/build/status/moremoban.gitfs2?branchName=master

It helps perform file operations over a git repository. It clones the git repository and returns python file system 2’s OSFS instance.

The idea originates from moban, which uses git repositories 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
>>> git_fs = fs.open_fs("git://github.com/moremobans/pypi-mobans.git!/templates")
>>> git_fs.readtext("_version.py.jj2")
'__version__ = "0.0.5"\n__author__ = "C.W."\n'

Get from a different branch

>>> import fs
>>> git_fs = fs.open_fs("git://github.com/moremobans/pypi-mobans.git?branch=master!/templates")
>>> git_fs.read("_version.py.jj2")
'__version__ = "0.0.5"\n__author__ = "C.W."\n'

Checkout submodules recursively

>>> git_fs = fs.open_fs("git://github.com/moremobans/pypi-mobans.git?branch=master&submodule=true!/templates")

Does it write?

Yes locally, it will write as you can do so without using gitfs2. And no, it does not help commit and push the changes for you.

Plus, the intention is never to write to a repository.

Primary use case

You can do the following with moban:

$ moban -t 'git://github.com/moremoban/pypi-mobans.git!/templates/_version.py.jj2' \
        -c 'git://github.com/moremoban/pypi-mobans.git!/config/data.yml' \
        -o _version.py
Info: Found repo in /Users/jaska/Library/Caches/gitfs2/repos/pypi-mobans
Templating git://github.com/moremoban/pypi-mobans.git!/templates/_version.py.jj2 to _version.py
Templated 1 file.
$ cat _version.py
__version__ = "0.1.1rc3"
__author__ = "C.W."

License

MIT

Installation

You can install gitfs2 via pip:

$ pip install gitfs2

or clone it and install it:

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

Change log

0.0.5 - 09.11.2024

Added

  1. #12:fix github protocol timeout problem

0.0.4 - 11.10.2024

Added

  1. #12:fix github protocol timeout problem

0.0.3 - 11.12.2019

Added

  1. #5: support offline

  2. #7: add license text

0.0.2 - 2.10.2019

Fixed

  1. #4: failed to checkout more than one git repo.

0.0.1 - 19.08.2019

first release

  1. what a feat!

Release files for gitfs2 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gitfs2 0.0.5
File Size Uploaded
gitfs2-0.0.5.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gitfs2 0.0.5
File Interpreter ABI Platform
gitfs2-0.0.5-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size:16.4 kB

Release files / gitfs2-0.0.5.tar.gz

Download URL gitfs2-0.0.5.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
dbf4190be02e019dc1e134232871ca920029ba3b6f7bf8570a259cfdb60ccc35
BLAKE2b-256 checksum
How to use checksums
98c26118c9a1e0757087e7293acffe29e37667df7474da00711ad7470f58c3f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2024.

Transparency log

Release files / gitfs2-0.0.5-py2.py3-none-any.whl

Download URL gitfs2-0.0.5-py2.py3-none-any.whl
Size 6.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d6a3c197e2609039edbcde87df97560dada17d7d4a66491487c74a05d814924a
BLAKE2b-256 checksum
How to use checksums
cda1354faf9b8cabaf7865c654c2522aabf46b1a3d63b7c620afb7eecb7d392d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2024.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page