Skip to content

[IfcPatch]Create proper CLI entrypoint / script #6436

@sanzoghenzo

Description

@sanzoghenzo

Feature Description

Currently, ifcPatch CLI can only be run via python -m ifcpatch.
The current instructions to use an alias may work, but its doesn't play well with multiple environments, especially now that we have easy to use isolated environment managers such as pipx and uv.

Using the wonderful uv as an example, to run ifcpatch in an ephemeral environment, one needs to:

uvx --with ifcpatch python -m ifcpatch ...

instead of just uvx ifcpatch ... as one would expect.

$ uvx ifcpatch -h
The executable `ifcpatch` was not found.
warning: Package `ifcpatch` does not provide any executables.

this also makes it impossible to install ifcpatch with uv tool install which errors out with the No executables are provided by ifcpatch message.

Python already has all we need to create a proper cross platform executable via the project.scripts table

since this config needs a function, it cannot points to the __main__ module directly, unless we wrap everything inside it in a main function

def main():
    # current contents of __main__.py

if __name__ == "__main__":
    main()

and then use it in the pyproject.toml

[project.scripts]
ifcpatch = "ifcpatch.__main__:main"

to be more explicit, the main function could be named cli and put into a cli module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    IfcPatchSeverity:MinorOptimisation, warning, inconsistency, accommodate invalid data

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions