Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add git to filesystem source 301 #312

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6681b22
fix csv example
deanja Dec 13, 2023
3e21941
Add gitpythonfs fsspec implementation #301
deanja Dec 26, 2023
4a84bee
revert python version
deanja Dec 26, 2023
d3073b7
Make clear the implementation is read-only
deanja Dec 27, 2023
13a891e
Tighten expected types in listings
deanja Dec 27, 2023
1d425dc
Tighten expected types in listings
deanja Dec 27, 2023
4fec235
Merge remote-tracking branch 'refs/remotes/origin/add-git-to-filesyst…
deanja Dec 27, 2023
a6a34ac
Default repo location not supported yet
deanja Jan 1, 2024
6f13dc9
refer to commit sha as `hex`
deanja Jan 1, 2024
6714daa
Implement file `mode` like `git://` fsspec has
deanja Jan 1, 2024
90d3cd0
Implement git refs.
deanja Jan 2, 2024
bb3b76c
tidy code
deanja Jan 3, 2024
e2f2995
Tighten param name path --> repo_path.
deanja Jan 3, 2024
14eaa82
cache git root trees
deanja Jan 3, 2024
b2e2d5f
Expand use of tree cache
deanja Jan 3, 2024
bc35230
date not needed on directories
deanja Jan 4, 2024
9daaf9a
retrieve commited_date from git log cmd.
deanja Jan 4, 2024
b09f919
order fields with git-specific last
deanja Jan 4, 2024
3d3222c
add eager cache on git log.
deanja Jan 5, 2024
f3de00f
speed up cache loading for git log
deanja Jan 7, 2024
2c3c45f
reorganise tests
deanja Jan 8, 2024
9a2b573
name consistent with fsspec package
deanja Jan 8, 2024
e763f92
Merge remote-tracking branch 'origin/master'
deanja Jan 8, 2024
d4312ec
Test gitpythonfs filesystem source.
deanja Jan 10, 2024
6a8834b
Set local dlt dependency for development,
deanja Jan 10, 2024
fc839db
Reduce factory demands on FilteItemDict.
deanja Jan 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,976 changes: 1,976 additions & 0 deletions null

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ packages = [{include = "sources"}]

[tool.poetry.dependencies]
python = "^3.8.1"
dlt = {version = "^0.3.23", allow-prereleases = true, extras = ["redshift", "bigquery", "postgres", "duckdb", "s3", "gs"]}
# dlt = {version = "^0.3.23", allow-prereleases = true, extras = ["redshift", "bigquery", "postgres", "duckdb", "s3", "gs"]}
dlt = {path = "../dlt", extras = ["duckdb"], develop = true}
gitpythonfs = {path = "./sources/filesystem/gitpythonfs", develop = true}
deanja marked this conversation as resolved.
Show resolved Hide resolved

[tool.poetry.group.dev.dependencies]
mypy = "1.6.1"
Expand Down
2 changes: 1 addition & 1 deletion sources/filesystem/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def filesystem(

files_chunk: List[FileItem] = []
for file_model in glob_files(fs_client, bucket_url, file_glob):
file_dict = FileItemDict(file_model, credentials)
file_dict = FileItemDict(file_model, fs_client)
if extract_content:
file_dict["file_content"] = file_dict.read_bytes()
files_chunk.append(file_dict) # type: ignore
Expand Down
6 changes: 6 additions & 0 deletions sources/filesystem/gitpythonfs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# gitpythonfs

Builds on [GitPython](https://gitpython.readthedocs.io/) to provide a Python filesystem interface for git.

The initial use case is to load file contents from git repos into destinations using tools such as [dlt](https://dlthub.com)

9 changes: 9 additions & 0 deletions sources/filesystem/gitpythonfs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# file exists to make pytest work.
#
# pytest (or maybe just pytest discovery) expects all nested folders to be packages.
#
# This __init__.py file not required once gitpythonfs is a completely separate
# package to dlt-verified-sources or it's tests are moved to /tests.
#
# An alternative is to run pytest specifically on a subfolder, e.g.:
# pytest sources/filesystem/gitpythonfs
Loading