This patch is designed to better integrate this PyPI packager with Apache cqlsh. It does not make code changes to cqlsh.py.
The changes here create a new module 'cqlsh', which is required to use setuptools' Entry Point (https://setuptools.pypa.io/en/latest/userguide/entry_point.html). Entry points provide better platform installation; on Linux it will create a shell script for 'cqlsh' which calls the module; on Windows it will create an .exe file. Currently, this package isn't easy to run on Windows because a file without an extension is not executable.
Note: I've tested these changes on both Linux (MacOS) and Windows 11. The test version of the package can be found at https://test.pypi.org/project/cqlsht/ and installed with:
On Linux, the executable cqlsh file created by setuptools looks like this:
$cat /usr/local/bin/cqlsh
#!/usr/local/opt/python@3.9/bin/python3.9
# -*- coding: utf-8 -*-
import re
import sys
from cqlsh.__main__ import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
Can you break out the deprecated dep as a separate PR? It's different scope then the other changes here and as noted in https://github.com/jeffwidman/cqlsh/issues/4#issuecomment-1008186919 there's a little more research needed before we can merge that. My experience in open source is keeping the scope of individual PR's smaller makes them easier to discuss/merge w/less risk.
I think it's a great idea to make this easily importable and use entry_points... def interested in merging that functionality.
This patch is designed to better integrate this PyPI packager with Apache cqlsh. It does not make code changes to cqlsh.py.
The changes here create a new module 'cqlsh', which is required to use setuptools' Entry Point (https://setuptools.pypa.io/en/latest/userguide/entry_point.html). Entry points provide better platform installation; on Linux it will create a shell script for 'cqlsh' which calls the module; on Windows it will create an .exe file. Currently, this package isn't easy to run on Windows because a file without an extension is not executable.
Note: I've tested these changes on both Linux (MacOS) and Windows 11. The test version of the package can be found at https://test.pypi.org/project/cqlsht/ and installed with:
On Linux, the executable cqlsh file created by setuptools looks like this: