Skip to content

Commit 06e51e7

Browse files
committed
adapt server repository structure
1 parent 66f3320 commit 06e51e7

7 files changed

Lines changed: 21 additions & 8 deletions

File tree

sdk/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ The BaSyx Python SDK requires the following Python packages to be installed for
4242
* `lxml` (BSD 3-clause License, using `libxml2` under MIT License)
4343
* `python-dateutil` (BSD 3-clause License)
4444
* `pyecma376-2` (Apache License v2.0)
45-
* `urllib3` (MIT License)
46-
* `Werkzeug` (BSD 3-clause License)
45+
4746

4847
Development/testing/documentation/example dependencies:
4948
* `mypy` (MIT License)

server/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ COPY ./sdk /sdk
4444
COPY ./server/app /app
4545
WORKDIR /app
4646
RUN pip install ../sdk
47+
RUN pip install .
4748

4849
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.ini"]

server/app/interfaces/__init__.py

Whitespace-only changes.

server/app/interfaces/base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@
2525
from basyx.aas.adapter.json import StrictStrippedAASFromJsonDecoder, StrictAASFromJsonDecoder, AASToJsonEncoder
2626
from basyx.aas.adapter.xml import xml_serialization, XMLConstructables, read_aas_xml_element
2727
from basyx.aas.model import AbstractObjectStore
28-
from server.app.util.converters import base64url_decode
28+
# Test if we are in the docker file. If so server and app do not exist.
29+
try:
30+
from app.util.converters import base64url_decode
31+
except ImportError:
32+
from util.converters import base64url_decode
33+
2934

3035

3136
T = TypeVar("T")

server/app/interfaces/repository.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@
4848

4949
from basyx.aas import model
5050
from basyx.aas.adapter import aasx
51-
from server.app.util.converters import Base64URLConverter, IdShortPathConverter, base64url_decode
51+
# Test if we are in the docker file. If so app is our working directory.
52+
try:
53+
from app.util.converters import Base64URLConverter, IdShortPathConverter, base64url_decode
54+
except ImportError:
55+
from util.converters import Base64URLConverter, IdShortPathConverter, base64url_decode
5256
from .base import ObjectStoreWSGIApp, APIResponse, is_stripped_request, HTTPApiDecoder, T
5357

5458

server/app/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from basyx.aas.adapter import aasx
77

88
from basyx.aas.backend.local_file import LocalFileObjectStore
9-
from server.app.interfaces.repository import WSGIApp
9+
from interfaces.repository import WSGIApp
1010

1111
storage_path = os.getenv("STORAGE_PATH", "/storage")
1212
storage_type = os.getenv("STORAGE_TYPE", "LOCAL_FILE_READ_ONLY")
@@ -44,3 +44,6 @@
4444
else:
4545
print(f"STORAGE_TYPE must be either LOCAL_FILE or LOCAL_FILE_READ_ONLY! Current value: {storage_type}",
4646
file=sys.stderr)
47+
48+
49+
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ build-backend = "setuptools.build_meta"
1717
# print(f"Project version: {version}")
1818
# ```
1919
root = ".." # Defines the path to the root of the repository
20-
version_file = "app/version.py"
20+
version_file = "version.py"
2121

2222
[project]
2323
name = "basyx-python-server"
@@ -36,7 +36,8 @@ classifiers = [
3636
]
3737
requires-python = ">=3.9"
3838
dependencies = [
39-
"basyx-python-sdk", #TODO: Think about the version
39+
# While we install the sdk locally, this dependency needs to be commented out
40+
# "basyx-python-sdk>=1.2.0,<2", #TODO: Think about the version
4041
"urllib3>=1.26,<3",
4142
"Werkzeug>=3.0.3,<4",
4243
]
@@ -57,7 +58,7 @@ dev = [
5758
"Homepage" = "https://github.com/eclipse-basyx/basyx-python-sdk"
5859

5960
[tool.setuptools]
60-
packages = { find = { include = ["basyx*"], exclude = ["test*"] } }
61+
packages = { find = { exclude = ["test*"] } }
6162

6263
[tool.setuptools.package-data]
6364
app = ["py.typed"]

0 commit comments

Comments
 (0)