Skip to content

openenv validate falsely fails when main() is called with arguments #490

@pvs333

Description

@pvs333

Description

openenv validate reports the following issue even when main() is properly
defined and callable:

server/app.py main() function not callable (missing if __name__ == '__main__')

Root Cause

In src/openenv/cli/_validation.py, the check is:

if "__name__" not in app_content or "main()" not in app_content:
    issues.append("server/app.py main() function not callable...")

This is a plain string search for "main()". If main() is called with
arguments like main(port=args.port), the string "main()" never appears
and the check fails — even though the function is perfectly callable.

Steps to Reproduce

  1. Create a server/app.py with a valid main() function
  2. Call it with arguments in the __main__ block:
   if __name__ == "__main__":
       main(port=8000)
  1. Run openenv validate
  2. Observe false failure

Expected Behavior?

The check should pass as long as a main() exists and if __name__ == "__main__" is present, regardless of how main() is called.

Workaround

Adding # main() as a comment in app.py passes the string check but is obviously not a real fix.

Environment

  • openenv-core version: 0.2.3.dev0
  • Python: 3.14

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions