Skip to content

'black' target version warning #993

Description

@tjlaboss

Job: https://github.com/idaholab/MontePy/actions/runs/30208828043/job/89811502720?pr=960

Error:

Warning: Python 3.14 cannot parse code formatted for Python 3.15. To fix this: run Black with Python 3.15, set --target-version to py314, or use --fast to skip the safety check. Black's safety check verifies equivalence by parsing the AST, which fails when the running Python is older than the target version.

We do build and test 3.15-dev:

jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    strategy:
      matrix:
        python-version: ["3.12", "3.13", "3.14", "3.15-dev"]
    continue-on-error: ${{ matrix.python-version == '3.15-dev' }}

But format-test runs with only Python 3.14:

  format-test:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    
    steps:

      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
        with:
          persist-credentials: false
      - name: set up python 3.14
        uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1
        with: 
          python-version: 3.14
      - run: pip install . montepy[format]
      - run: black --check montepy/ tests/

An easy fix is to manually set the target version: SalishSeaCast/SalishSeaNowcast@4316775

but why does black think the codebase is Python 3.15?

Metadata

Metadata

Assignees

No one assigned

    Labels

    CI/CDContinuous Integration and/or Continuous Deployment

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions