Repository navigation
Add pytest-based CI, template tests, and robust pandas fixes in compiler - #3
Merged
Merged
Conversation
### Motivation - Provide a lightweight CI workflow that installs the package in editable mode and verifies distributed Excel templates still open and parse with the converter. - Fix pandas access patterns in the compiler to be compatible with newer pandas releases and avoid runtime errors when reading template sheets. ### Description - Add a GitHub Actions workflow at `.github/workflows/tests.yml` that runs on push/pull_request/workflow_dispatch with a Python 3.10/3.11 matrix and installs the package with `python -m pip install -e .` before running tests. - Add `tests/test_templates.py` which checks required sheets exist in each workbook under `resources/templates` and ensures `initialise` / `initialise_welcome` can read template configuration. - Update `src/excel2sbol/compiler.py` to use `DataFrame.apply(... .map(...))` instead of `applymap(...)` and to use `row.iloc[...]` when extracting welcome metadata, making `initialise` and `initialise_welcome` robust to current pandas APIs. - Remove the legacy workflow file `.github/workflows/python-package.yml` in favor of the new editable-install test workflow. ### Testing - Installed the package editable with `python -m pip install -e .`, which completed successfully. - Compiled the test file and modified module with `python -m py_compile tests/test_templates.py src/excel2sbol/compiler.py` with no syntax errors. - Ran the new tests with `python -m pytest -q tests/test_templates.py` and observed `9 passed, 9 warnings` (tests succeeded). - Validated workflow YAML by loading with `yaml.safe_load(...)` which reported the workflow files as valid YAML.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
python-packageworkflow with a focused CI job that validates template workbooks and the converter using modern Python versions.Description
.github/workflows/python-package.ymland add a new.github/workflows/tests.ymlworkflow that runs tests on Python 3.10 and 3.11 usingactions/setup-python@v5and pip caching.tests/test_templates.pywhich validates that distributed Excel templates contain required sheets, thatinitialise/initialise_welcomecan read template configuration, and thatconverterproduces valid SBOL XML that parses and validates withsbol2.src/excel2sbol/compiler.pyby replacing brittleDataFrame.applymap(...)calls with column-wiseapply(... .map(...))to avoid pandas ambiguity and by usingrow.iloc[0]/iloc[1]when extracting values from rows.Testing
Testswas added and configured to run on push/pull_request/workflow_dispatch with a matrix for Python3.10and3.11.tests/test_templates.pywithpython -m py_compile tests/test_templates.pyand runs it withpython -m pytest -q tests/test_templates.py.initialise/initialise_welcome, and end-to-end SBOL generation/validation usingconverterandsbol2; the tests passed on both Python versions.Codex Task