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
- Create a
server/app.py with a valid main() function
- Call it with arguments in the
__main__ block:
if __name__ == "__main__":
main(port=8000)
- Run
openenv validate
- 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
Description
openenv validatereports the following issue even whenmain()is properlydefined and callable:
Root Cause
In
src/openenv/cli/_validation.py, the check is:This is a plain string search for
"main()". Ifmain()is called witharguments like
main(port=args.port), the string"main()"never appearsand the check fails — even though the function is perfectly callable.
Steps to Reproduce
server/app.pywith a validmain()function__main__block:openenv validateExpected Behavior?
The check should pass as long as a main() exists and
if __name__ == "__main__"is present, regardless of howmain()is called.Workaround
Adding
# main()as a comment inapp.pypasses the string check but is obviously not a real fix.Environment