Poetry run <script> output 'format' ; does not run in macOS; running fine in Ubuntu

Poetry Script Entry Point Configuration Error - ‘dev’ script not installed properly with Streamlit 1.49.1 and Python 3.12.7

Environment:

  • macOS v 15.6
  • Python 3.12.7
  • Poetry package manager
  • Streamlit 1.49.1
  • Project structure with src/api/ package layout

Problem Description:
When running `poetry run dev it just output ‘format’ and stopped, earlier it was throwing this message

```

but it says Warning: ‘dev’ is an entry point defined in pyproject.toml, but it’s not installed as a script. You may get improper `sys.argv[0]`, which went away now when running `poetry install`, the issue persists with output showing:

No dependencies to install or update
Installing the current project: tz-script (3.2.0)

Current Configuration:

[tool.poetry]
name = "fabric"
version = "3.2.0"
readme = "README.md"
license = "MIT"

package-mode = false
packages = [{ include = "api", from = "src" }]

[tool.poetry.scripts]
setup-hooks = "bash ./setup-hooks.sh"
dev = "threadzip:main"
api = "run_api:main"

Project Structure:

project-root/
├── LICENSE
├── poetry.lock
├── pyproject.toml
├── requirements.txt
├── run_api.py
├── setup-hooks.sh
├── src
│   ├── __init__.py
│   ├── api
│   ├── assets
│   ├── streamlit_app.py
└── threadzip.py

Attempted Solutions:

  1. :white_check_mark: Ran poetry install and poetry install --no-root
  2. :white_check_mark: Verified Python 3.12.7 compatibility
  3. :warning: Attempted to fix script syntax but encountering colon format issues
  4. :warning: package-mode = false may be preventing proper script installation

Code Files: threadzip.py

# this file is used to run in development environment only as `poetry run python threadzip.py`
import logging
import subprocess
from pathlib import Path


def main():
    """Main function to be called by Poetry script entry point"""
    # Get the current script's directory
    current_dir = Path(__file__).parent.resolve()

    logging.basicConfig(level=logging.INFO)
    logging.info(f"Current directory: {current_dir}")

    # Path to the Streamlit app
    streamlit_app_path = current_dir / "src" / "streamlit_app.py"
    logging.info(f"Streamlit app path: {streamlit_app_path}")

    # Check if the streamlit app file exists
    if not streamlit_app_path.exists():
        logging.error(f"Streamlit app not found at: {streamlit_app_path}")
        return

    # Run Streamlit through Poetry with explicit port to avoid conflicts
    subprocess.run(
        [
            "poetry",
            "run",
            "streamlit",
            "run",
            str(streamlit_app_path),
            "--server.port",
            "8501",
        ]
    )


if __name__ == "__main__":
    main()

Additional Context:

  • The setup works on Ubuntu but fails on macOS (suggesting path/OS-specific issues)
  • Streamlit 1.49.1 may have different behaviour than previous versions
  • Python 3.12.7 path handling might differ from earlier Python versions
  • macOS may have different security/permissions for subprocess execution

Requested Assistance:

  1. Help correct the script entry point syntax for macOS/Python 3.12.7
  2. Verify Streamlit 1.49.1 compatibility with subprocess execution
  3. Resolve the installation issue where Poetry doesn’t properly install scripts
  4. Ensure macOS-specific path handling works correctly
  5. Address any Streamlit 1.49.1 specific configuration requirements

Steps to Reproduce:

  1. Clone the project on macOS with Python 3.12.7
  2. Run poetry install with Streamlit 1.49.1
  3. Run poetry run dev
  4. Observe the warning message and script failure

Expected Behavior:

  • poetry install should properly install the script entry points
  • poetry run dev should execute without warnings on macOS
  • Streamlit 1.49.1 should launch successfully on port 8501
  • Python 3.12.7 path handling should work correctly

Please provide:

  • Complete threadzip.py content including Streamlit launch code
  • Project directory structure (where files are actually located)
  • Exact error messages when using different script syntax attempts
  • macOS version information
  • Any macOS-specific permission or security settings that might affect subprocess execution

This will help diagnose the exact configuration issue with Streamlit 1.49.1 and Python 3.12.7 on macOS and provide a working solution.