-
Notifications
You must be signed in to change notification settings - Fork 204
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
Install the python module inside a virtual environment (#243) #245
Conversation
@arthaud Let me try this on my side too and I'll merge if I don't find any issues. I'll probably get to it in the next hour or so. |
I'm reviewing this now. |
This is great. We've very close. Just a few comments:
The benefit of doing it this way is that we don't depend on the user installing dependencies, or keeping them around. The drawback is that users won't be able to take advantage of their own package management system. Since we have a plan to take IKOS to debian, it would also make the installation script incompatible with Debian, which would presumably package dependencies as individual packages. If we want access to system packages, it's possible with In either case, it'll pay to document it. Our readme states:
I'd suggest we change that too.
|
Thinking back, I don't know how many users could be affected if we dropped support for python 2. My general inclination is to deprecate things first with a warning, and wait for one or more version to remove them (in other projects I wait 3, but we can enforce more agility in this project). For info: I'm planning a release for this month and the next for March. |
Also, very minor but just for consistency with the way that other PRs are being merged, can you change the summary line of the commit message to just mention the issue with |
I'm not sure why someone would want to use system libraries? That seems like a rare use case.
I think package maintainers will want to use -DINSTALL_PYTHON_VIRTUALENV=OFF and -DUSE_PYTHON_VIRTUALENV=/usr/bin/python; and install the python package like any other python package.
Yeah I should update the documentation (in the same PR). I will fix that tomorrow.
Python 2 does not receive security patches since 2020, I don't think we should support it anymore.
I agree, that's an inconvenience. but wasn't is true already the case before my PR?
Agreed, I will change that. |
Good point. That solves it.
Great!
Great. There's logic in some scripts for Python 2 (for example, I remember seeing some imports being handled differently depending on the version).
I don't think so but, if you don't think it's a big deal, we can ignore it. Something we can also simplify is removing unnecessary dependencies in the CI jobs since we are now using ikos/.github/workflows/build-linux.yml Lines 19 to 24 in 21cd2b5
and removing these lines completely: ikos/.github/workflows/build-macos.yml Lines 15 to 17 in 21cd2b5
This PR is becoming bigger. We can split it in separate commits (in case we ever need to review it) or even open separate issues for the removal of old Python 2-related logic and the changes to the CI job. We can even address these details after the release: It doesn't hurt to keep those in, even if they don't serve any purpose once your PR is merged. |
(Sorry, pressed some key that closed the PR while I was typing my answer.) |
I have done most of the changes. |
A quick search shows: ikos/analyzer/python/ikos/http.py Lines 42 to 52 in 21cd2b5
ikos/analyzer/python/ikos/html.py Lines 42 to 47 in 21cd2b5
This second module is just a wrapper to hide the logic of importing ikos/analyzer/python/ikos/view.py Line 59 in 21cd2b5
ikos/analyzer/python/ikos/highlight.py Line 42 in 21cd2b5
We'd also need to adjust the README to mention only Python 3: Line 174 in 21cd2b5
I also found this comment which we can update: ikos/analyzer/python/ikos/output_db.py Lines 70 to 72 in 21cd2b5
That's script is quite outdated. Is it still used anywhere? A quick search shows that it's mentioned in the tests / docker files only. If it's still useful, we can adjust python in this PR but I'd rather open a small separate issue to update the versions of other dependencies (e.g., LLVM), just to keep separate matters isolated. If not, we can remove it (again, I can open a small, separate issue for that). That's all I could find. I can contribute some of these changes by pushing them to your branch if that's ok with you (I believe I have rights but I'd rather ask first). |
It is mentioned in the documentation (see INSTALL_ROOTLESS.md). I don't know if it still works. It's pretty nice to have but it's a bit annoying to maintain.
Sure, go ahead. |
…SA-SW-VnV#243). The current installation process tries to install the ikos python module as a system library. This is probably not what a typical user want. Instead, let's install a virtual environment for ikos and install the python module within it. Following homebrew's standard, this is installed under <install-path>/libexec. Note that this also deprecates Python 2 since virtual environments require Python 3.3
The last commit modified the CMake to use pip to install python dependencies. This commit removes dependencies from the CI job that were being installed by means of the OS's package manager.
0a22ac5
to
636d2f5
Compare
Second attempt. I made a minor tweak in the commit messages just for consistency, but I did not change anything else from your commits. Feel free to modify my commit messages if you think they are not clear enough (or if something's wrong). |
Support for Python 2 in IKOS was removed in a prior commit dealing with python package installation. This commit adjusts Python modules to remove any logic pertaining to Python 2. More specifically: - The imports in `http` are adjusted. - The module `html`, which was a wrapper around the standard `html`, is removed. - Other modules that were importing `ikos.html` now import `html` directly. - Remove a comment in `output_db` referring to Python 2.
636d2f5
to
3ef9267
Compare
…). This commit adjusts the bootstrap script to remove any logic pertaining to Python 2, which IKOS no longer supports.
3ef9267
to
0a8d946
Compare
@arthaud Is there anything else we need to change? If not, I'll go ahead and merge these changes. |
Btw, I don't know if we want to change it yet but I believe your change should get rid of this problem altogether: https://github.com/NASA-SW-VnV/ikos/blob/master/TROUBLESHOOTING.md#could-not-find-ikos-python-module-while-running-ikos Perhaps we can just wait a bit (I mean, we merge this as is and we wait to change the TROUBLESHOOTING.md guide until IKOS 3.3. or IKOS 3.4) to see if that every happens again. Your call. |
LGTM
I would keep these for now in case people are installing older versions of IKOS. If we remove it then that link will break, leaving people confused. |
Great! |
The current installation process tries to install the ikos python module as a system library. This is probably not what a typical user want.
Instead, let's install a virtual environment for ikos and install the python module within it. Following homebrew's standard, this is installed under /libexec.
This has been tested on macOS Sonoma 14.1.2 and Ubuntu 20.
I also added two options which we will need when updating the Homebrew formula.