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 support for reading from Shared with me #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 1 addition & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ version: 2.1
executors:
standard:
docker:
- image: circleci/python:3.9
- image: cimg/python:3.10
environment:
PIPENV_VENV_IN_PROJECT: true
working_directory: "~/lib"

# -----------------
# Reusable commands
Expand Down Expand Up @@ -41,14 +40,6 @@ commands:
paths:
- "./.git"

# todo: remove unixodbc when tentaclio 1.0 is released
install_unixodbc:
steps:
- run:
name: Instal UnixODBC
command: |
sudo apt-get install unixodbc-dev -y

update_virtualenv:
steps:
- restore_cache:
Expand All @@ -57,7 +48,6 @@ commands:
- pip-cache-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-
- pip-cache-{{ .Environment.CACHE_VERSION }}-
- configure_github
- install_unixodbc
- run:
name: Install Python packages
command: make sync
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.1.0] - 2025-01-03
### Changed
Upgraded to python 3.10
### Fixed
- Fix reading from shared drives

## [0.0.3] - 2022-08-12
### Fixed
- Fix writing to shared drives by using the appropriate non-deprecated API parameter
Expand All @@ -19,7 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Google drive client.

[Unreleased]: https://github.com/octoenergy/tentaclio-gdrive/compare/0.0.3...HEAD
[Unreleased]: https://github.com/octoenergy/tentaclio-gdrive/compare/0.1.0...HEAD
[0.1.0]: https://github.com/octoenergy/tentaclio-gdrive/compare/0.0.3...0.1.0
[0.0.3]: https://github.com/octoenergy/tentaclio-gdrive/compare/0.0.2...0.0.3
[0.0.2]: https://github.com/octoenergy/tentaclio-gdrive/compare/0.0.1...0.0.2
[0.0.1]: https://github.com/octoenergy/tentaclio-gdrive/releases/tag/0.0.1
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ format: ## Run black and isort
unit: ## Run unit tests
pipenv run pytest tests/unit

functional:
pipenv run pytest tests/functional/gdrive

# Release
package:
# create a source distribution
Expand Down
4 changes: 2 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ twine = "*"
[packages]

[requires]
python_version = "3.9"
python_version = "3.10"

[pipenv]
allow_prereleases = true
allow_prereleases = false
1,296 changes: 979 additions & 317 deletions Pipfile.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[tool.black]
line-length = 99
skip-numeric-underscore-normalization = "True"
target_version = ['py37']
target_version = ['py310']
include = '\.pyi?$'
exclude = '(\.mypy_cache)'

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))

VERSION = "0.0.3"
VERSION = "0.1.0"

REPO_ROOT = pathlib.Path(__file__).parent

Expand Down Expand Up @@ -63,6 +63,7 @@ def run(self):
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
],
cmdclass={"verify": VerifyVersionCommand},
)
Expand Down
1 change: 1 addition & 0 deletions src/tentaclio_gdrive/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This package implements the tentaclio gdrive client """

from tentaclio import * # noqa

from .clients.google_drive_client import GoogleDriveFSClient
Expand Down
6 changes: 5 additions & 1 deletion src/tentaclio_gdrive/clients/google_drive_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Google drive client."""

import abc
import functools
import json
Expand Down Expand Up @@ -125,6 +126,7 @@ class GoogleDriveFSClient(base_client.BaseClient["GoogleDriveFSClient"]):

DEFAULT_DRIVE_NAME = "My Drive"
DEFAULT_DRIVE_ID = "root"
DEFAULT_SHARED_DRIVE_NAME = "Shared with me"
DEFAULT_DRIVE_DESCRIPTOR = _GoogleDriveDescriptor(
id_=DEFAULT_DRIVE_ID,
name=DEFAULT_DRIVE_NAME,
Expand Down Expand Up @@ -164,7 +166,7 @@ def _drive(self):
drives = self._get_drives()
if self.drive_name not in drives:
names = [d for d in drives]
raise ValueError(f"Drive name (hostname) should be one of {names}")
raise ValueError(f"Drive name {self.drive_name} should be one of {names}")
return drives[self.drive_name]

def _connect(self) -> "GoogleDriveFSClient":
Expand Down Expand Up @@ -262,6 +264,8 @@ def _get_path_descriptors(self, ignore_tail=False) -> List[_GoogleFileDescriptor
parts = self.path_parts
if ignore_tail:
parts = parts[:-1]
if self.drive_name == self.DEFAULT_SHARED_DRIVE_NAME:
return [self._get_file_descriptor_by_name(parts[0])]
return list(self._path_parts_to_descriptors(self._drive, parts))

def _path_parts_to_descriptors(
Expand Down