Skip to content

Add pytest-based CI, template tests, and robust pandas fixes in compiler - #3

Merged
Gonza10V merged 2 commits into
guifrom
codex/create-ci/cd-workflow-for-package-testing
Jul 17, 2026
Merged

Gonza10V merged 2 commits into
guifrom
codex/create-ci/cd-workflow-for-package-testing

Conversation

@Gonza10V

Copy link
Copy Markdown

Motivation

  • Replace the old multi-step python-package workflow with a focused CI job that validates template workbooks and the converter using modern Python versions.
  • Ensure the compiler can safely handle pandas DataFrame/Series string trimming and row access without triggering ambiguous truth-value errors.
  • Add repository-level tests that exercise template parsing and end-to-end SBOL generation to prevent regressions.

Description

  • Remove the legacy .github/workflows/python-package.yml and add a new .github/workflows/tests.yml workflow that runs tests on Python 3.10 and 3.11 using actions/setup-python@v5 and pip caching.
  • Add tests/test_templates.py which validates that distributed Excel templates contain required sheets, that initialise/initialise_welcome can read template configuration, and that converter produces valid SBOL XML that parses and validates with sbol2.
  • Harden src/excel2sbol/compiler.py by replacing brittle DataFrame.applymap(...) calls with column-wise apply(... .map(...)) to avoid pandas ambiguity and by using row.iloc[0]/iloc[1] when extracting values from rows.
  • Minor cleanup to ensure file output behavior is unchanged and to keep DataFrame string trimming consistent across reads.

Testing

  • CI workflow Tests was added and configured to run on push/pull_request/workflow_dispatch with a matrix for Python 3.10 and 3.11.
  • The workflow compiles tests/test_templates.py with python -m py_compile tests/test_templates.py and runs it with python -m pytest -q tests/test_templates.py.
  • The suite verifies template sheet presence, configuration parsing via initialise/initialise_welcome, and end-to-end SBOL generation/validation using converter and sbol2; the tests passed on both Python versions.

Codex Task

### 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.
@Gonza10V
Gonza10V merged commit 7a15ac7 into gui Jul 17, 2026
4 checks passed
@Gonza10V
Gonza10V deleted the codex/create-ci/cd-workflow-for-package-testing branch July 17, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant