Skip to content

Commit eef8de9

Browse files
author
Rasmus Oscar Welander
committed
Updated project structure
1 parent 90129e7 commit eef8de9

31 files changed

+90
-82
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ dmypy.json
157157
# Cython debug symbols
158158
cython_debug/
159159

160+
# MacOS
161+
.DS_Store
162+
160163
# PyCharm
161164
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
162165
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
File renamed without changes.

src/app.py renamed to cs3client/app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
import cs3.app.provider.v1beta1.resources_pb2 as cs3apr
1414
from cs3.gateway.v1beta1.gateway_api_pb2_grpc import GatewayAPIStub
1515

16-
from cs3resource import Resource
17-
from statuscodehandler import StatusCodeHandler
18-
from config import Config
16+
from .cs3resource import Resource
17+
from .statuscodehandler import StatusCodeHandler
18+
from .config import Config
1919

2020

2121
class App:

src/auth.py renamed to cs3client/auth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
from cs3.gateway.v1beta1.gateway_api_pb2_grpc import GatewayAPIStub
1616
from cs3.rpc.v1beta1.code_pb2 import CODE_OK
1717

18-
from cs3client import CS3Client
19-
from exceptions.exceptions import AuthenticationException, SecretNotSetException
20-
from config import Config
18+
from .cs3client import CS3Client
19+
from .exceptions.exceptions import AuthenticationException, SecretNotSetException
20+
from .config import Config
2121

2222

2323
class Auth:

src/checkpoint.py renamed to cs3client/checkpoint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
import cs3.storage.provider.v1beta1.provider_api_pb2 as cs3spp
1313
from cs3.gateway.v1beta1.gateway_api_pb2_grpc import GatewayAPIStub
1414

15-
from config import Config
16-
from statuscodehandler import StatusCodeHandler
17-
from cs3resource import Resource
15+
from .config import Config
16+
from .statuscodehandler import StatusCodeHandler
17+
from .cs3resource import Resource
1818

1919

2020
class Checkpoint:
File renamed without changes.

src/cs3client.py renamed to cs3client/cs3client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
import cs3.gateway.v1beta1.gateway_api_pb2_grpc as cs3gw_grpc
1212
from configparser import ConfigParser
1313

14-
from file import File
15-
from user import User
16-
from share import Share
17-
from statuscodehandler import StatusCodeHandler
18-
from app import App
19-
from checkpoint import Checkpoint
20-
from config import Config
14+
from .file import File
15+
from .user import User
16+
from .share import Share
17+
from .statuscodehandler import StatusCodeHandler
18+
from .app import App
19+
from .checkpoint import Checkpoint
20+
from .config import Config
2121

2222

2323
class CS3Client:
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/file.py renamed to cs3client/file.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
Authors: Rasmus Welander, Diogo Castro, Giuseppe Lo Presti.
55
6-
Last updated: 29/08/2024
6+
Last updated: 30/08/2024
77
"""
88

99
import time
@@ -16,10 +16,10 @@
1616
from cs3.gateway.v1beta1.gateway_api_pb2_grpc import GatewayAPIStub
1717
import cs3.types.v1beta1.types_pb2 as types
1818

19-
from config import Config
20-
from exceptions.exceptions import AuthenticationException, FileLockedException
21-
from cs3resource import Resource
22-
from statuscodehandler import StatusCodeHandler
19+
from .config import Config
20+
from .exceptions.exceptions import AuthenticationException, FileLockedException
21+
from .cs3resource import Resource
22+
from .statuscodehandler import StatusCodeHandler
2323

2424

2525
class File:

src/share.py renamed to cs3client/share.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
import google.protobuf.field_mask_pb2 as field_masks
1919
import cs3.types.v1beta1.types_pb2 as cs3types
2020

21-
from cs3resource import Resource
22-
from config import Config
23-
from statuscodehandler import StatusCodeHandler
21+
from .cs3resource import Resource
22+
from .config import Config
23+
from .statuscodehandler import StatusCodeHandler
2424

2525

2626
class Share:

src/statuscodehandler.py renamed to cs3client/statuscodehandler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
import cs3.rpc.v1beta1.code_pb2 as cs3code
1111
import cs3.rpc.v1beta1.status_pb2 as cs3status
1212

13-
from exceptions.exceptions import AuthenticationException, NotFoundException, \
13+
from .exceptions.exceptions import AuthenticationException, NotFoundException, \
1414
UnknownException, AlreadyExistsException, FileLockedException, UnimplementedException
15-
from config import Config
15+
from .config import Config
1616

1717

1818
class StatusCodeHandler:

src/user.py renamed to cs3client/user.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import cs3.identity.user.v1beta1.user_api_pb2 as cs3iu
1212
from cs3.gateway.v1beta1.gateway_api_pb2_grpc import GatewayAPIStub
1313

14-
from config import Config
15-
from statuscodehandler import StatusCodeHandler
14+
from .config import Config
15+
from .statuscodehandler import StatusCodeHandler
1616

1717

1818
class User:

docs/.DS_Store

-6 KB
Binary file not shown.

examples/app_api_example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
import logging
1313
import configparser
14-
from cs3resource import Resource
15-
from cs3client import CS3Client
16-
from auth import Auth
14+
from cs3client.cs3resource import Resource
15+
from cs3client.cs3client import CS3Client
16+
from cs3client.auth import Auth
1717

1818
config = configparser.ConfigParser()
1919
with open("default.conf") as fdef:

examples/auth_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
import logging
1313
import configparser
14-
from cs3client import CS3Client
15-
from auth import Auth
14+
from cs3client.cs3client import CS3Client
15+
from cs3client.auth import Auth
1616

1717
config = configparser.ConfigParser()
1818
with open("default.conf") as fdef:

examples/checkpoints_api_example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
import logging
1313
import configparser
14-
from cs3resource import Resource
15-
from cs3client import CS3Client
16-
from auth import Auth
14+
from cs3client.cs3resource import Resource
15+
from cs3client.cs3client import CS3Client
16+
from cs3client.auth import Auth
1717

1818
config = configparser.ConfigParser()
1919
with open("default.conf") as fdef:

examples/file_api_example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
import logging
2020
import configparser
21-
from cs3client import CS3Client
22-
from cs3resource import Resource
23-
from auth import Auth
21+
from cs3client.cs3client import CS3Client
22+
from cs3client.cs3resource import Resource
23+
from cs3client.auth import Auth
2424

2525
config = configparser.ConfigParser()
2626
with open("default.conf") as fdef:

examples/shares_api_example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
import logging
1313
import configparser
14-
from cs3client import CS3Client
15-
from cs3resource import Resource
16-
from auth import Auth
14+
from cs3client.cs3client import CS3Client
15+
from cs3client.cs3resource import Resource
16+
from cs3client.auth import Auth
1717

1818
config = configparser.ConfigParser()
1919
with open("default.conf") as fdef:

examples/user_api_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
import logging
1313
import configparser
14-
from cs3client import CS3Client
15-
from auth import Auth
14+
from cs3client.cs3client import CS3Client
15+
from cs3client.auth import Auth
1616

1717
config = configparser.ConfigParser()
1818
with open("default.conf") as fdef:

setup.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
Authors: Rasmus Welander, Diogo Castro, Giuseppe Lo Presti.
77
8-
Last updated: 26/07/2024
8+
Last updated: 30/08/2024
99
"""
1010

1111
from setuptools import setup, find_packages
@@ -20,12 +20,10 @@
2020
name="cs3client",
2121
version=version,
2222
author="Rasmus Welander, Diogo Castro, Giuseppe Lo Presti",
23-
package_dir={"": "src"},
24-
packages=find_packages(where="src"),
25-
py_modules=["cs3client"],
2623
description="CS3 client for Python",
2724
long_description=long_description,
2825
long_description_content_type="text/markdown",
26+
packages=find_packages(exclude=['tests*']),
2927
url="https://github.com/cs3org/cs3-python-client",
3028
install_requires=[
3129
"grpcio>=1.47.0",
@@ -37,4 +35,15 @@
3735
"protobuf",
3836
"cryptography",
3937
],
38+
license="Apache 2.0",
39+
classifiers=[
40+
"Development Status :: 4 - Beta",
41+
"License :: OSI Approved :: Apache Software License",
42+
"Programming Language :: Python :: 3",
43+
"Programming Language :: Python :: 3.7",
44+
"Programming Language :: Python :: 3.8",
45+
"Programming Language :: Python :: 3.9",
46+
"Programming Language :: Python :: 3.10",
47+
"Operating System :: OS Independent",
48+
],
4049
)

tests/__init__.py

Whitespace-only changes.

tests/fixtures.py

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,18 @@
1212
import pytest
1313
from unittest.mock import Mock, patch
1414
from configparser import ConfigParser
15-
import cs3.rpc.v1beta1.code_pb2 as cs3code
1615
import base64
1716
import json
1817

19-
from cs3client import CS3Client
20-
from file import File
21-
from auth import Auth
22-
from user import User
23-
from statuscodehandler import StatusCodeHandler
24-
from share import Share
25-
from app import App
26-
from checkpoint import Checkpoint
27-
from config import Config
18+
from cs3client.cs3client import CS3Client
19+
from cs3client.file import File
20+
from cs3client.auth import Auth
21+
from cs3client.user import User
22+
from cs3client.statuscodehandler import StatusCodeHandler
23+
from cs3client.share import Share
24+
from cs3client.app import App
25+
from cs3client.checkpoint import Checkpoint
26+
from cs3client.config import Config
2827

2928

3029
@pytest.fixture
@@ -87,13 +86,6 @@ def mock_status_code_handler(mock_logger, mock_config):
8786
def mock_gateway(mock_gateway_stub_class):
8887
mock_gateway_stub = Mock()
8988
mock_gateway_stub_class.return_value = mock_gateway_stub
90-
# Set up mock response for Authenticate method
91-
mocked_token = create_mock_jwt()
92-
mock_authenticate_response = Mock()
93-
mock_authenticate_response.status.code = cs3code.CODE_OK
94-
mock_authenticate_response.status.message = ""
95-
mock_authenticate_response.token = mocked_token
96-
mock_gateway_stub.Authenticate.return_value = mock_authenticate_response
9789
return mock_gateway_stub
9890

9991

@@ -118,7 +110,6 @@ def cs3_client_secure(
118110

119111
# Create CS3Client instance
120112
client = CS3Client(mock_config, "cs3client", mock_logger)
121-
client.auth.set_client_secret("test")
122113

123114
assert mock_secure_channel.called
124115
assert mock_channel_ready_future.called
@@ -150,7 +141,6 @@ def cs3_client_insecure(
150141

151142
# Create CS3Client instance
152143
client = CS3Client(mock_config, "cs3client", mock_logger)
153-
client.auth.set_client_secret("test")
154144

155145
assert mock_insecure_channel.called
156146
assert mock_channel_ready_future.called

tests/test_app.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
import cs3.rpc.v1beta1.code_pb2 as cs3code
1212
from unittest.mock import Mock, patch
1313
import pytest
14-
from exceptions.exceptions import (
14+
15+
from cs3client.exceptions.exceptions import (
1516
AuthenticationException,
1617
NotFoundException,
1718
UnknownException,
1819
)
19-
from cs3resource import Resource
20-
from fixtures import ( # noqa: F401 (they are used, the framework is not detecting it)
20+
from cs3client.cs3resource import Resource
21+
from .fixtures import ( # noqa: F401 (they are used, the framework is not detecting it)
2122
mock_config,
2223
mock_logger,
2324
mock_gateway,

tests/test_checkpoint.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
from unittest.mock import Mock, patch
1212
import pytest
1313
import cs3.rpc.v1beta1.code_pb2 as cs3code
14-
from exceptions.exceptions import (
14+
15+
from cs3client.exceptions.exceptions import (
1516
AuthenticationException,
1617
NotFoundException,
1718
UnknownException,
1819
)
19-
from cs3resource import Resource
20-
from fixtures import ( # noqa: F401 (they are used, the framework is not detecting it)
20+
from cs3client.cs3resource import Resource
21+
from .fixtures import ( # noqa: F401 (they are used, the framework is not detecting it)
2122
mock_config,
2223
mock_logger,
2324
mock_gateway,

tests/test_cs3client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Last updated: 30/08/2024
99
"""
1010

11-
from fixtures import ( # noqa: F401, E402 (they are used, the framework is not detecting it)
11+
from .fixtures import ( # noqa: F401, E402 (they are used, the framework is not detecting it)
1212
cs3_client_insecure,
1313
cs3_client_secure,
1414
mock_config,

tests/test_file.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111
import pytest
1212
from unittest.mock import Mock, patch
1313
import cs3.rpc.v1beta1.code_pb2 as cs3code
14-
from cs3resource import Resource
15-
from exceptions.exceptions import (
14+
15+
from cs3client.cs3resource import Resource
16+
from cs3client.exceptions.exceptions import (
1617
AuthenticationException,
1718
NotFoundException,
1819
FileLockedException,
1920
UnknownException,
2021
)
21-
from fixtures import ( # noqa: F401 (they are used, the framework is not detecting it)
22+
from .fixtures import ( # noqa: F401 (they are used, the framework is not detecting it)
2223
mock_config,
2324
mock_logger,
2425
mock_gateway,

tests/test_resource.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
import unittest
1212
import cs3.storage.provider.v1beta1.resources_pb2 as cs3spr
13-
from cs3resource import Resource
13+
14+
from cs3client.cs3resource import Resource
1415

1516

1617
class TestResource(unittest.TestCase):

tests/test_share.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
import cs3.sharing.link.v1beta1.link_api_pb2 as cs3slapi
1515
import cs3.storage.provider.v1beta1.resources_pb2 as cs3spr
1616
import cs3.rpc.v1beta1.code_pb2 as cs3code
17-
from exceptions.exceptions import (
17+
18+
from cs3client.exceptions.exceptions import (
1819
AuthenticationException,
1920
NotFoundException,
2021
UnknownException,
2122
FileLockedException,
2223
AlreadyExistsException,
2324
)
24-
from fixtures import ( # noqa: F401 (they are used, the framework is not detecting it)
25+
from .fixtures import ( # noqa: F401 (they are used, the framework is not detecting it)
2526
mock_config,
2627
mock_logger,
2728
mock_gateway,

0 commit comments

Comments
 (0)