Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add entry_points to setuptools’ configuration to provide command-line console scripts #3199

Closed
vitorsr opened this issue Feb 22, 2024 · 3 comments
Labels

Comments

@vitorsr
Copy link

vitorsr commented Feb 22, 2024

Currently, PyMuPDF is not pipx-installable because it does not provide any console commands:

$ pipx install PyMuPDF

No apps associated with package pymupdf or its dependencies. If you are attempting to install a library, pipx should
not be used. Consider using pip or a similar tool instead.

To make, e.g., fitz, directly available from the command-line we need to add entry_points to setuptools’ configuration [1]:

        entry_points = {"console_scripts": ["fitz = fitz.__main__:main"]},

This would require modifying the pipcl.Package class.

It could alternatively be added to pyproject.toml [2]:

diff --git a/pyproject.toml b/pyproject.toml
index 10c9a43..05b7117 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -5,3 +5,6 @@ requires = ["libclang", "swig", "setuptools", "psutil"]
 #
 build-backend = "setup"
 backend-path = ["."]
+
+[project.scripts]
+fitz = fitz.__main__:main

[1] https://setuptools.pypa.io/en/latest/userguide/entry_point.html

[2] https://packaging.python.org/en/latest/specifications/pyproject-toml/#entry-points

julian-smith-artifex-com added a commit that referenced this issue Feb 25, 2024
This uses pipcl.py's new `entry_points` support.

Note that direct installation with `setup.py install` does not implement this.

tests/test_general.py: test_cli() - basic test of command-line `pymupdf`
command.

Addresses #3199.
@julian-smith-artifex-com
Copy link
Collaborator

Thanks for this, i didn't know about entry_points before.

In my tree i have added support for entry_points to pipcl.py and modified setup.py, so that installation gives a pymupdf command that runs fitz/main.py.

Depending on internal review, it might get included in the next release.

Thanks again.

julian-smith-artifex-com added a commit that referenced this issue Feb 27, 2024
This uses pipcl.py's new `entry_points` support.

Note that direct installation with `setup.py install` does not implement this.

tests/test_general.py: test_cli() - basic test of command-line `pymupdf`
command.

Addresses #3199.
@julian-smith-artifex-com
Copy link
Collaborator

Fixed in 1.23.26.

@vitorsr
Copy link
Author

vitorsr commented Feb 29, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants