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

Modularize 'cqlsh' for use in python imports and better support for Windows installations #7

Merged
merged 5 commits into from Jan 10, 2022

Conversation

bschoening
Copy link
Collaborator

@bschoening bschoening commented Dec 27, 2021

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())

@bschoening bschoening changed the title Modularize 'cqlsh' and better support for Windows instalations Modularize 'cqlsh' and better support for Windows installations Dec 27, 2021
@bschoening bschoening changed the title Modularize 'cqlsh' and better support for Windows installations Modularize 'cqlsh' for use in python imports and better support for Windows installations Dec 28, 2021
@jeffwidman
Copy link
Owner

jeffwidman commented Jan 8, 2022

Thanks for the hard work here!

  1. Can you break out the deprecated dep as a separate PR? It's different scope then the other changes here and as noted in Drop unused/deprecated dependency on cql package #4 (comment) 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.
  2. I think it's a great idea to make this easily importable and use entry_points... def interested in merging that functionality.

@bschoening
Copy link
Collaborator Author

Reverted the deprecated dependency change #4

@jeffwidman jeffwidman merged commit 89bb52f into jeffwidman:master Jan 10, 2022
@jeffwidman
Copy link
Owner

Thank you!

fruch added a commit to scylladb/scylla-cqlsh that referenced this pull request Sep 5, 2022
…ent OSes

changes to make the library installable cleanly, and in more complient way
to how packging of python package should look nowdays.
based on the work from jeffwidman/cqlsh#7
fruch added a commit to scylladb/scylla-cqlsh that referenced this pull request Sep 6, 2022
…ent OSes

changes to make the library installable cleanly, and in more complient way
to how packging of python package should look nowdays.
based on the work from jeffwidman/cqlsh#7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants