diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9ae5093 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.13"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install ruff pytest + python -m pip install -e . + - name: Lint with ruff + run: | + ruff check --select E,F --exclude ./demos + - name: Test with pytest + run: | + pytest diff --git a/mod/hallmark/__init__.py b/mod/hallmark/__init__.py index b96f40c..d7d33d8 100644 --- a/mod/hallmark/__init__.py +++ b/mod/hallmark/__init__.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .core import ParaFrame +from .core import ParaFrame as ParaFrame diff --git a/mod/hallmark/core.py b/mod/hallmark/core.py index e621501..eec2596 100644 --- a/mod/hallmark/core.py +++ b/mod/hallmark/core.py @@ -121,16 +121,16 @@ def ParaFrame(fmt, *args, debug=False, **kwargs): elif n > 0: print(f'{n} match, i.e., "{files[0]}"') else: - print(f'No match; please check format string') + print('No match; please check format string') # Parse list of file names back to parameters parser = parse.compile(fmt) - l = [] + frame = [] for f in files: r = parser.parse(f) if r is None: print(f'Failed to parse "{f}"') else: - l.append({'path':f, **r.named}) - return pd.DataFrame(l) + frame.append({'path':f, **r.named}) + return pd.DataFrame(frame)