Python file system 2 over GitPython
Project description
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
#12:fix github protocol timeout problem
0.0.4 - 11.10.2024
Added
#12:fix github protocol timeout problem
0.0.3 - 11.12.2019
Added
0.0.2 - 2.10.2019
Fixed
#4: failed to checkout more than one git repo.
0.0.1 - 19.08.2019
first release
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gitfs2-0.0.5.tar.gz.
File metadata
- Download URL: gitfs2-0.0.5.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbf4190be02e019dc1e134232871ca920029ba3b6f7bf8570a259cfdb60ccc35
|
|
| MD5 |
c4bcad98e0c59dcf262cae29ead62a28
|
|
| BLAKE2b-256 |
98c26118c9a1e0757087e7293acffe29e37667df7474da00711ad7470f58c3f2
|
Provenance
The following attestation bundles were made for gitfs2-0.0.5.tar.gz:
Publisher:
pythonpublish.yml on moremoban/gitfs2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gitfs2-0.0.5.tar.gz -
Subject digest:
dbf4190be02e019dc1e134232871ca920029ba3b6f7bf8570a259cfdb60ccc35 - Sigstore transparency entry: 147788809
- Sigstore integration time:
-
Permalink:
moremoban/gitfs2@f4196b926614202a8369578d6e212d13732c7651 -
Branch / Tag:
refs/tags/v0.0.5 - Owner: https://github.com/moremoban
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pythonpublish.yml@f4196b926614202a8369578d6e212d13732c7651 -
Trigger Event:
release
-
Statement type:
File details
Details for the file gitfs2-0.0.5-py2.py3-none-any.whl.
File metadata
- Download URL: gitfs2-0.0.5-py2.py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6a3c197e2609039edbcde87df97560dada17d7d4a66491487c74a05d814924a
|
|
| MD5 |
8901309f3631861f8a69d68965f14317
|
|
| BLAKE2b-256 |
cda1354faf9b8cabaf7865c654c2522aabf46b1a3d63b7c620afb7eecb7d392d
|
Provenance
The following attestation bundles were made for gitfs2-0.0.5-py2.py3-none-any.whl:
Publisher:
pythonpublish.yml on moremoban/gitfs2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gitfs2-0.0.5-py2.py3-none-any.whl -
Subject digest:
d6a3c197e2609039edbcde87df97560dada17d7d4a66491487c74a05d814924a - Sigstore transparency entry: 147788810
- Sigstore integration time:
-
Permalink:
moremoban/gitfs2@f4196b926614202a8369578d6e212d13732c7651 -
Branch / Tag:
refs/tags/v0.0.5 - Owner: https://github.com/moremoban
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pythonpublish.yml@f4196b926614202a8369578d6e212d13732c7651 -
Trigger Event:
release
-
Statement type: