From 17a8b8c0509fdd620633ae8f38f96f4aa25ac074 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 18 Dec 2024 13:07:09 -0800 Subject: [PATCH 01/11] Fix error detecting version --- src/jdb_to_nwb/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/jdb_to_nwb/__init__.py b/src/jdb_to_nwb/__init__.py index e69de29..d284d55 100644 --- a/src/jdb_to_nwb/__init__.py +++ b/src/jdb_to_nwb/__init__.py @@ -0,0 +1 @@ +from ._version import __version__ From e1767fb2e7156f1df4313db75bec3d92e8d61c79 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 18 Dec 2024 13:09:58 -0800 Subject: [PATCH 02/11] Create .git_archival.txt --- .git_archival.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .git_archival.txt diff --git a/.git_archival.txt b/.git_archival.txt new file mode 100644 index 0000000..8fb235d --- /dev/null +++ b/.git_archival.txt @@ -0,0 +1,4 @@ +node: $Format:%H$ +node-date: $Format:%cI$ +describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ +ref-names: $Format:%D$ From 025dd1fc39c41892c1145ae73a4c588f8f24384e Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 18 Dec 2024 13:10:16 -0800 Subject: [PATCH 03/11] Create .gitattributes --- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..a94cb2f --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.git_archival.txt export-subst From 82f02ca867ec6233936e71cf5474361ecff5b5f6 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 18 Dec 2024 13:13:53 -0800 Subject: [PATCH 04/11] Update pyproject.toml --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 4ed5dd0..9f66742 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,6 +52,7 @@ jdb_to_nwb = "jdb_to_nwb.convert:cli" [tool.hatch.version] source = "vcs" +fallback_version = "0.1.0.dev0" [tool.hatch.build.hooks.vcs] # this file is created/updated when the package is installed and used in From ffe6e021c51362f53dde8446b8a31aeb24064208 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 18 Dec 2024 13:20:49 -0800 Subject: [PATCH 05/11] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9f66742..a96445f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,7 +52,7 @@ jdb_to_nwb = "jdb_to_nwb.convert:cli" [tool.hatch.version] source = "vcs" -fallback_version = "0.1.0.dev0" +fallback-version = "0.1.0.dev0" [tool.hatch.build.hooks.vcs] # this file is created/updated when the package is installed and used in From 4199e66aca61d9442563a05ff8c17da4314f21d2 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 18 Dec 2024 13:30:01 -0800 Subject: [PATCH 06/11] Discard changes to pyproject.toml --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a96445f..4ed5dd0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,7 +52,6 @@ jdb_to_nwb = "jdb_to_nwb.convert:cli" [tool.hatch.version] source = "vcs" -fallback-version = "0.1.0.dev0" [tool.hatch.build.hooks.vcs] # this file is created/updated when the package is installed and used in From b2b618036acbb3d1599e961fd79158bff25bac49 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 18 Dec 2024 14:32:23 -0800 Subject: [PATCH 07/11] Update test_package_build.yml --- .github/workflows/test_package_build.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_package_build.yml b/.github/workflows/test_package_build.yml index 0657970..c9a418e 100644 --- a/.github/workflows/test_package_build.yml +++ b/.github/workflows/test_package_build.yml @@ -83,8 +83,6 @@ jobs: - name: Install editable if: matrix.package == 'editable' run: pip install -e . - - name: Install test extras - run: pip install .[test] - name: Download test data env: BOX_USERNAME: ${{ secrets.BOX_USERNAME }} @@ -94,10 +92,16 @@ jobs: tree tests/test_data - name: Run tests without coverage if: matrix.package != 'editable' - run: pytest -v jdb_to_nwb + run: | + pip install pytest + pip list + pytest -v jdb_to_nwb - name: Run tests on editable install with coverage if: matrix.package == 'editable' - run: pytest --cov=src --cov-report=xml -v jdb_to_nwb + run: | + pip install pytest-cov + pip list + pytest --cov=src --cov-report=xml -v jdb_to_nwb - name: Upload coverage reports to Codecov if: matrix.package == 'editable' uses: codecov/codecov-action@v5 @@ -119,4 +123,4 @@ jobs: # name: dist # path: dist/ # - name: Publish package distributions to PyPI - # uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file + # uses: pypa/gh-action-pypi-publish@release/v1 From 9bf81de6758733118817d855a98d0027c4a2b2ef Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 18 Dec 2024 14:47:13 -0800 Subject: [PATCH 08/11] Download test data once as artifact when script is available --- .github/workflows/test_package_build.yml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test_package_build.yml b/.github/workflows/test_package_build.yml index c9a418e..b5d5418 100644 --- a/.github/workflows/test_package_build.yml +++ b/.github/workflows/test_package_build.yml @@ -40,6 +40,18 @@ jobs: with: name: archive path: archive/ + - name: Download test data + env: + BOX_USERNAME: ${{ secrets.BOX_USERNAME }} + BOX_PASSWORD: ${{ secrets.BOX_PASSWORD }} + run: | + python tests/download_test_data.py + tree tests/test_data + - name: Upload test data artifact + uses: actions/upload-artifact@v4 + with: + name: test_data + path: tests/test_data/downloaded test-package: runs-on: ubuntu-latest needs: [build] @@ -83,13 +95,11 @@ jobs: - name: Install editable if: matrix.package == 'editable' run: pip install -e . - - name: Download test data - env: - BOX_USERNAME: ${{ secrets.BOX_USERNAME }} - BOX_PASSWORD: ${{ secrets.BOX_PASSWORD }} - run: | - python tests/download_test_data.py - tree tests/test_data + - name: Download test data artifact + uses: actions/download-artifact@v4 + with: + name: test_data + path: tests/test_data/downloaded - name: Run tests without coverage if: matrix.package != 'editable' run: | From 57926ca51cb9c0f49b107e1f7787d427160f7521 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 18 Dec 2024 14:52:01 -0800 Subject: [PATCH 09/11] Update download_test_data.py --- tests/download_test_data.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/download_test_data.py b/tests/download_test_data.py index 9f5f9fd..04ef13e 100644 --- a/tests/download_test_data.py +++ b/tests/download_test_data.py @@ -21,13 +21,15 @@ def main(): # Create test data directory if it doesn't exist test_data_dir.mkdir(parents=True, exist_ok=True) - # Read .env file and parse variables into environment variables - with open('.env', 'r') as f: - for line in f: - # Skip empty lines and comments - if line.strip() and not line.startswith('#'): - key, value = line.strip().split('=', 1) - os.environ[key] = value + # Read .env file if present and parse variables into environment variables + env_file_path = ".env" + if os.path.exists(env_file_path): + with open(env_file_path, 'r') as f: + for line in f: + # Skip empty lines and comments + if line.strip() and not line.startswith('#'): + key, value = line.strip().split('=', 1) + os.environ[key] = value # Get Box credentials box_username = os.environ.get('BOX_USERNAME') @@ -95,4 +97,4 @@ def download_recursively(ftps: FTP_TLS, remote_dir: str, local_dir: Path): ftps.quit() if __name__ == "__main__": - main() \ No newline at end of file + main() From 3b80e49ae12922fa3d80c2c04446807a98f615cc Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 18 Dec 2024 15:02:47 -0800 Subject: [PATCH 10/11] Update test_package_build.yml --- .github/workflows/test_package_build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_package_build.yml b/.github/workflows/test_package_build.yml index b5d5418..85ac4e2 100644 --- a/.github/workflows/test_package_build.yml +++ b/.github/workflows/test_package_build.yml @@ -105,13 +105,13 @@ jobs: run: | pip install pytest pip list - pytest -v jdb_to_nwb + pytest -v - name: Run tests on editable install with coverage if: matrix.package == 'editable' run: | pip install pytest-cov pip list - pytest --cov=src --cov-report=xml -v jdb_to_nwb + pytest --cov=src --cov-report=xml --cov-report=term -v - name: Upload coverage reports to Codecov if: matrix.package == 'editable' uses: codecov/codecov-action@v5 From 6881d21ef11ede369f9235a1d5bd960bb3c1317b Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 18 Dec 2024 15:51:23 -0800 Subject: [PATCH 11/11] Update test_package_build.yml --- .github/workflows/test_package_build.yml | 50 ++++++++++++++++++------ 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test_package_build.yml b/.github/workflows/test_package_build.yml index 85ac4e2..8614c76 100644 --- a/.github/workflows/test_package_build.yml +++ b/.github/workflows/test_package_build.yml @@ -18,28 +18,37 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout repo + uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-python@v5 + + - name: Set up Python + uses: actions/setup-python@v5 with: python-version: 3 - - run: pip install --upgrade build twine + - name: Build sdist and wheel - run: python -m build - - run: twine check dist/* + run: | + pip install --upgrade build twine + python -m build + twine check dist/* + - name: Upload sdist and wheel artifacts uses: actions/upload-artifact@v4 with: name: dist path: dist/ + - name: Build git archive run: mkdir archive && git archive -v -o archive/archive.tgz HEAD + - name: Upload git archive artifact uses: actions/upload-artifact@v4 with: name: archive path: archive/ + - name: Download test data env: BOX_USERNAME: ${{ secrets.BOX_USERNAME }} @@ -47,11 +56,13 @@ jobs: run: | python tests/download_test_data.py tree tests/test_data + - name: Upload test data artifact uses: actions/upload-artifact@v4 with: name: test_data path: tests/test_data/downloaded + test-package: runs-on: ubuntu-latest needs: [build] @@ -59,64 +70,79 @@ jobs: matrix: package: ['wheel', 'sdist', 'archive', 'editable'] steps: + - name: Checkout repo + # Used to access the tests. Only install from source if matrix.package == 'editable'. + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Download sdist and wheel artifacts - if: matrix.package != 'archive' + if: matrix.package == 'wheel' || matrix.package == 'sdist' uses: actions/download-artifact@v4 with: name: dist path: dist/ + - name: Download git archive artifact if: matrix.package == 'archive' uses: actions/download-artifact@v4 with: name: archive path: archive/ - - name: Checkout repo - if: matrix.package == 'editable' - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-python@v5 + + - name: Set up Python + uses: actions/setup-python@v5 with: python-version: "3.12" + - name: Display Python version run: python -c "import sys; print(sys.version)" + - name: Update pip run: pip install --upgrade pip + - name: Install wheel if: matrix.package == 'wheel' run: pip install dist/*.whl + - name: Install sdist if: matrix.package == 'sdist' run: pip install dist/*.tar.gz + - name: Install archive if: matrix.package == 'archive' run: pip install archive/archive.tgz + - name: Install editable if: matrix.package == 'editable' run: pip install -e . + - name: Download test data artifact uses: actions/download-artifact@v4 with: name: test_data path: tests/test_data/downloaded + - name: Run tests without coverage if: matrix.package != 'editable' run: | pip install pytest pip list pytest -v + - name: Run tests on editable install with coverage if: matrix.package == 'editable' run: | pip install pytest-cov pip list pytest --cov=src --cov-report=xml --cov-report=term -v + - name: Upload coverage reports to Codecov if: matrix.package == 'editable' uses: codecov/codecov-action@v5 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # pypi-publish: # name: Upload release to PyPI # runs-on: ubuntu-latest