Skip to content

Commit c10b75f

Browse files
committed
relative conf
1 parent 7eaacb5 commit c10b75f

File tree

6 files changed

+74
-17
lines changed

6 files changed

+74
-17
lines changed

fsspec-proxy/LICENSE

Lines changed: 0 additions & 1 deletion
This file was deleted.

fsspec-proxy/LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2024, Jupyter fsspec contributors
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

fsspec-proxy/fsspec_proxy/file_manager.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
from fsspec.implementations.asyn_wrapper import AsyncFileSystemWrapper
22
import fsspec.utils
3+
import io
34
import os
4-
import sys
5+
import pkgutil
56
import yaml
67
import logging
78

8-
logging.basicConfig(level=logging.WARNING, stream=sys.stdout)
9-
logger = logging.getLogger(__name__)
10-
logger.setLevel(logging.INFO)
11-
fsspec.utils.setup_logging(logger_name="fsspec.memoryfs")
12-
this_dir = os.path.abspath(os.path.dirname(__file__))
9+
logger = logging.getLogger("fsspec_proxy")
1310

1411

1512
class FileSystemManager:
16-
def __init__(self):
13+
def __init__(self, config_path=None):
1714
self.filesystems = {}
18-
if "FSSPEC_PROXY_CONFIG" in os.environ:
15+
if config_path is None and "FSSPEC_PROXY_CONFIG" in os.environ:
1916
self.config = self.load_config(os.getenv("FSSPEC_PROXY_CONFIG"))
2017
else:
2118
self.config = self.load_config()
2219
self.initialize_filesystems()
2320

24-
def load_config(self, config_path=os.path.join(this_dir, "config.yaml")):
25-
if not os.path.exists(config_path):
21+
def load_config(self, config_path=None):
22+
if config_path is None:
23+
data = pkgutil.get_data(__name__, "config.yaml")
24+
elif not os.path.exists(config_path):
2625
return {}
27-
with open(config_path, "r") as file:
28-
config_content = yaml.safe_load(file)
26+
else:
27+
with open(config_path, "rb") as file:
28+
data = file.read()
29+
config_content = yaml.safe_load(io.BytesIO(data))
2930
logger.info("new config: %s", config_content)
3031
return config_content
3132

fsspec-proxy/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ authors = [
88
{name = "martindurant"},
99
]
1010
readme = "../README.md"
11-
license = { file = "../LICENSE" }
11+
license = { file = "LICENSE" }
1212
requires-python = ">=3.9"
1313
classifiers = [
1414
# "Framework :: PyScript",

pyscript-fsspec-client/LICENSE

Lines changed: 0 additions & 1 deletion
This file was deleted.

pyscript-fsspec-client/LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2024, Jupyter fsspec contributors
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

pyscript-fsspec-client/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ authors = [
88
{name = "martindurant"},
99
]
1010
readme = "../README.md"
11-
license = { file = "../LICENSE" }
11+
license = { file = "LICENSE" }
1212
requires-python = ">=3.9"
1313
classifiers = [
1414
"License :: OSI Approved :: BSD License",

tests/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from pyscript_fsspec_client import client
88

99

10-
@pytest.fixture()
10+
@pytest.fixture(scope="session")
1111
def server():
1212
# TODO: test config in "FSSPEC_PROXY_CONFIG" location
1313
P = subprocess.Popen(["fsspec-proxy", "dev"])

0 commit comments

Comments
 (0)