File: gcs.py

package info (click to toggle)
dulwich 1.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 7,388 kB
  • sloc: python: 99,991; makefile: 163; sh: 67
file content (15 lines) | stat: -rw-r--r-- 421 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/python3
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later

import tempfile

from google.cloud import storage  # type: ignore[attr-defined]

from dulwich.cloud.gcs import GcsObjectStore
from dulwich.repo import Repo

client = storage.Client()
bucket = client.get_bucket("mybucket")

gcs_object_store = GcsObjectStore(bucket, "path")
r = Repo.init_bare(tempfile.mkdtemp(), object_store=gcs_object_store)