Skip to content

Commit 5828977

Browse files
authored
Merge pull request #124 from isabelizimm/board-deparse-update
verbose allow_pickle_read for board_deparse
2 parents 4ea381e + 5951177 commit 5828977

File tree

6 files changed

+56
-7
lines changed

6 files changed

+56
-7
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
tests:
1717
name: "Tests"
1818
runs-on: ${{ matrix.os }}
19+
if: ${{ !github.event.pull_request.head.repo.fork }}
1920
strategy:
2021
fail-fast: false
2122
matrix:
@@ -60,6 +61,7 @@ jobs:
6061
test-rsconnect:
6162
name: "Test RSConnect"
6263
runs-on: ubuntu-latest
64+
if: ${{ !github.event.pull_request.head.repo.fork }}
6365
steps:
6466
- uses: actions/checkout@v2
6567
- uses: actions/setup-python@v2
@@ -83,6 +85,27 @@ jobs:
8385
run: |
8486
pytest pins -m 'fs_rsc and not skip_on_github'
8587
88+
89+
test-fork:
90+
name: "Test a fork PR (no secrets)"
91+
runs-on: ubuntu-latest
92+
if: ${{ github.event.pull_request.head.repo.fork }}
93+
steps:
94+
- uses: actions/checkout@v2
95+
- uses: actions/setup-python@v2
96+
with:
97+
python-version: "3.10"
98+
- name: Install dependencies
99+
run: |
100+
python -m pip install --upgrade pip
101+
102+
python -m pip install -e .[test]
103+
- name: Run tests
104+
run: |
105+
# TODO: better way to disable all cloud backend tests?
106+
pytest pins -m 'not fs_rsc and not fs_s3 and not skip_on_github'
107+
108+
86109
check-cross-compatibility:
87110
name: "Check cross lib compatibility"
88111
runs-on: ubuntu-latest

.github/workflows/code-checks.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Code Checks
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: ['main', 'dev-*']
7+
pull_request:
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
pre-commit:
13+
name: "Run pre-commit"
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions/setup-python@v2
18+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ repos:
1313
args: ["--unsafe"]
1414
- id: check-added-large-files
1515
- repo: https://github.com/psf/black
16-
rev: 19.10b0
16+
rev: 22.3.0
1717
hooks:
1818
- id: black

pins/constructors.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,21 @@ def board_deparse(board: BaseBoard):
4242
4343
>>> board_deparse(board_folder("a/b/c"))
4444
"board_folder('a/b/c')"
45+
46+
>>> board_deparse(board_folder(path="a/b/c", allow_pickle_read=True))
47+
"board_folder('a/b/c', allow_pickle_read=True)"
4548
"""
49+
if board.allow_pickle_read is not None:
50+
allow_pickle = f", allow_pickle_read={repr(board.allow_pickle_read)}"
51+
else:
52+
allow_pickle = ""
4653

4754
prot = board.fs.protocol
4855
if prot == "rsc":
4956
url = board.fs.api.server_url
50-
return f"board_rsconnect(server_url={repr(url)})"
57+
return f"board_rsconnect(server_url={repr(url)}{allow_pickle})"
5158
elif prot == "file":
52-
return f"board_folder({repr(board.board)})"
59+
return f"board_folder({repr(board.board)}{allow_pickle})"
5360
else:
5461
raise NotImplementedError(
5562
f"board deparsing currently not supported for protocol: {prot}"

pins/meta.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,7 @@ def to_pin_yaml(self, *args, **kwargs):
150150

151151

152152
class MetaFactory:
153-
"""Responsible for creating and loading (e.g. from yaml) of meta objects.
154-
155-
"""
153+
"""Responsible for creating and loading (e.g. from yaml) of meta objects."""
156154

157155
def get_meta_name(self, *args, **kwargs) -> str:
158156
return META_FILENAME

pins/tests/test_boards.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,10 @@ def test_board_pin_search_name(board, df, search, matches):
308308
def test_board_base_pin_meta_cache_touch(tmp_dir2, df):
309309

310310
cache = fsspec.filesystem(
311-
"pinscache", target_protocol="file", same_names=True, hash_prefix=str(tmp_dir2),
311+
"pinscache",
312+
target_protocol="file",
313+
same_names=True,
314+
hash_prefix=str(tmp_dir2),
312315
)
313316
board = BaseBoard(str(tmp_dir2), fs=cache)
314317

0 commit comments

Comments
 (0)