Skip to content

Commit 3f974e7

Browse files
committed
added import_ppd function with credit to ThomasAkams Github
2 parents 22c0fd8 + ff0e220 commit 3f974e7

File tree

5 files changed

+80
-32
lines changed

5 files changed

+80
-32
lines changed

.git_archival.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node: $Format:%H$
2+
node-date: $Format:%cI$
3+
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
4+
ref-names: $Format:%D$

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.git_archival.txt export-subst

.github/workflows/test_package_build.yml

Lines changed: 64 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,91 +18,131 @@ jobs:
1818
build:
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: actions/checkout@v4
21+
- name: Checkout repo
22+
uses: actions/checkout@v4
2223
with:
2324
fetch-depth: 0
24-
- uses: actions/setup-python@v5
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
2528
with:
2629
python-version: 3
27-
- run: pip install --upgrade build twine
30+
2831
- name: Build sdist and wheel
29-
run: python -m build
30-
- run: twine check dist/*
32+
run: |
33+
pip install --upgrade build twine
34+
python -m build
35+
twine check dist/*
36+
3137
- name: Upload sdist and wheel artifacts
3238
uses: actions/upload-artifact@v4
3339
with:
3440
name: dist
3541
path: dist/
42+
3643
- name: Build git archive
3744
run: mkdir archive && git archive -v -o archive/archive.tgz HEAD
45+
3846
- name: Upload git archive artifact
3947
uses: actions/upload-artifact@v4
4048
with:
4149
name: archive
4250
path: archive/
51+
52+
- name: Download test data
53+
env:
54+
BOX_USERNAME: ${{ secrets.BOX_USERNAME }}
55+
BOX_PASSWORD: ${{ secrets.BOX_PASSWORD }}
56+
run: |
57+
python tests/download_test_data.py
58+
tree tests/test_data
59+
60+
- name: Upload test data artifact
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: test_data
64+
path: tests/test_data/downloaded
65+
4366
test-package:
4467
runs-on: ubuntu-latest
4568
needs: [build]
4669
strategy:
4770
matrix:
4871
package: ['wheel', 'sdist', 'archive', 'editable']
4972
steps:
73+
- name: Checkout repo
74+
# Used to access the tests. Only install from source if matrix.package == 'editable'.
75+
uses: actions/checkout@v4
76+
with:
77+
fetch-depth: 0
78+
5079
- name: Download sdist and wheel artifacts
51-
if: matrix.package != 'archive'
80+
if: matrix.package == 'wheel' || matrix.package == 'sdist'
5281
uses: actions/download-artifact@v4
5382
with:
5483
name: dist
5584
path: dist/
85+
5686
- name: Download git archive artifact
5787
if: matrix.package == 'archive'
5888
uses: actions/download-artifact@v4
5989
with:
6090
name: archive
6191
path: archive/
62-
- name: Checkout repo
63-
if: matrix.package == 'editable'
64-
uses: actions/checkout@v4
65-
with:
66-
fetch-depth: 0
67-
- uses: actions/setup-python@v5
92+
93+
- name: Set up Python
94+
uses: actions/setup-python@v5
6895
with:
6996
python-version: "3.12"
97+
7098
- name: Display Python version
7199
run: python -c "import sys; print(sys.version)"
100+
72101
- name: Update pip
73102
run: pip install --upgrade pip
103+
74104
- name: Install wheel
75105
if: matrix.package == 'wheel'
76106
run: pip install dist/*.whl
107+
77108
- name: Install sdist
78109
if: matrix.package == 'sdist'
79110
run: pip install dist/*.tar.gz
111+
80112
- name: Install archive
81113
if: matrix.package == 'archive'
82114
run: pip install archive/archive.tgz
115+
83116
- name: Install editable
84117
if: matrix.package == 'editable'
85118
run: pip install -e .
86-
- name: Install test extras
87-
run: pip install .[test]
88-
- name: Download test data
89-
env:
90-
BOX_USERNAME: ${{ secrets.BOX_USERNAME }}
91-
BOX_PASSWORD: ${{ secrets.BOX_PASSWORD }}
92-
run: |
93-
python tests/download_test_data.py
94-
tree tests/test_data
119+
120+
- name: Download test data artifact
121+
uses: actions/download-artifact@v4
122+
with:
123+
name: test_data
124+
path: tests/test_data/downloaded
125+
95126
- name: Run tests without coverage
96127
if: matrix.package != 'editable'
97-
run: pytest -v jdb_to_nwb
128+
run: |
129+
pip install pytest
130+
pip list
131+
pytest -v
132+
98133
- name: Run tests on editable install with coverage
99134
if: matrix.package == 'editable'
100-
run: pytest --cov=src --cov-report=xml -v jdb_to_nwb
135+
run: |
136+
pip install pytest-cov
137+
pip list
138+
pytest --cov=src --cov-report=xml --cov-report=term -v
139+
101140
- name: Upload coverage reports to Codecov
102141
if: matrix.package == 'editable'
103142
uses: codecov/codecov-action@v5
104143
env:
105144
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
145+
106146
# pypi-publish:
107147
# name: Upload release to PyPI
108148
# runs-on: ubuntu-latest
@@ -119,4 +159,4 @@ jobs:
119159
# name: dist
120160
# path: dist/
121161
# - name: Publish package distributions to PyPI
122-
# uses: pypa/gh-action-pypi-publish@release/v1
162+
# uses: pypa/gh-action-pypi-publish@release/v1

src/jdb_to_nwb/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from ._version import __version__

tests/download_test_data.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ def main():
2121
# Create test data directory if it doesn't exist
2222
test_data_dir.mkdir(parents=True, exist_ok=True)
2323

24-
# Read .env file and parse variables into environment variables
25-
with open('.env', 'r') as f:
26-
for line in f:
27-
# Skip empty lines and comments
28-
if line.strip() and not line.startswith('#'):
29-
key, value = line.strip().split('=', 1)
30-
os.environ[key] = value
24+
# Read .env file if present and parse variables into environment variables
25+
env_file_path = ".env"
26+
if os.path.exists(env_file_path):
27+
with open(env_file_path, 'r') as f:
28+
for line in f:
29+
# Skip empty lines and comments
30+
if line.strip() and not line.startswith('#'):
31+
key, value = line.strip().split('=', 1)
32+
os.environ[key] = value
3133

3234
# Get Box credentials
3335
box_username = os.environ.get('BOX_USERNAME')
@@ -95,4 +97,4 @@ def download_recursively(ftps: FTP_TLS, remote_dir: str, local_dir: Path):
9597
ftps.quit()
9698

9799
if __name__ == "__main__":
98-
main()
100+
main()

0 commit comments

Comments
 (0)