Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Python implementation using pybind11 and gobject introspection #181

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

zalox
Copy link
Member

@zalox zalox commented Apr 4, 2016

No description provided.

@zalox zalox self-assigned this Apr 4, 2016
@zalox zalox added this to the v.1.3 milestone Apr 4, 2016
@zalox
Copy link
Member Author

zalox commented Apr 4, 2016

Replaces #99

@zalox zalox force-pushed the python-refactor branch 4 times, most recently from d82ae2b to 9bdc0c9 Compare April 8, 2016 12:49
std::cerr << std::string(err) << std::endl;
}

PythonError::PythonError(){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zalox Have not studied the changes in detail, just saw that you repeated Python in for instance PythonInterpreter and PythonError. I think its better to use namespaces such that it becomes: Python::Interpreter and Python::Error.

@zalox zalox force-pushed the python-refactor branch 2 times, most recently from 94c68fd to 3513d4f Compare April 9, 2016 16:32
@zalox zalox force-pushed the python-refactor branch 2 times, most recently from 97504ef to 989501f Compare April 18, 2016 16:08
@zalox
Copy link
Member Author

zalox commented Apr 19, 2016

Working plugins here for now: https://github.com/zalox/jucipp-plugins

@zalox
Copy link
Member Author

zalox commented Apr 19, 2016

@milleniumbug Did you manage to test the plugins?

@milleniumbug
Copy link
Contributor

Not yet, I'm trying to. The missing Py_DecodeLocale was the immediate issue that prevented me from compiling this branch.

docs/install.md Outdated
@@ -143,7 +143,7 @@ Note that juCi++ must be run in a MinGW Shell (for instance MinGW-w64 Win64 Shel

Install dependencies (replace `x86_64` with `i686` for 32-bit MSYS2 installs):
```sh
pacman -S git mingw-w64-x86_64-cmake make mingw-w64-x86_64-toolchain mingw-w64-x86_64-clang mingw-w64-x86_64-gtkmm3 mingw-w64-x86_64-gtksourceviewmm3 mingw-w64-x86_64-boost mingw-w64-x86_64-aspell mingw-w64-x86_64-aspell-en
pacman -S git mingw-w64-x86_64-cmake make mingw-w64-x86_64-toolchain mingw-w64-x86_64-clang mingw-w64-x86_64-gtkmm3 mingw-w64-x86_64-gtksourceviewmm3 mingw-w64-x86_64-boost mingw-w64-x86_64-aspell mingw-w64-x86_64-aspell-en mingw-w64-x86_64-gobject-introspection mingw-w64-x86_64-pygobject-devel mingw-w64-x86_64-python3-gobject
```
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@milleniumbug You will probably need some variant of these packages as well. I needed to point to my site-packages on windows and debian. Arch was fine.

@milleniumbug
Copy link
Contributor

milleniumbug commented Apr 19, 2016

Ok, after installing necessary dependencies, setting site-packages in config.json to correct path, snippet.py works correctly, but tools.py doesn't seem to load at all. (Python version: 3.4)

Dependencies for Fedora 23: gobject-introspection-devel pygobject3-devel python3-gobject (posting here so I won't forget)

@zalox
Copy link
Member Author

zalox commented Apr 19, 2016

Are there no errors in the terminal?

@milleniumbug
Copy link
Contributor

None at all. I've verified that it doesn't load by putting some logging statements in tools.py (with jucipp.terminal.println("test"))

@milleniumbug
Copy link
Contributor

Okay, nevermind. Moving snippet.py outside and renaming tools.py to snippet.py loads the plugin, so probably I have forgotten to put it on some list.

zalox referenced this pull request in zalox/jucipp-plugins Apr 19, 2016
@zalox
Copy link
Member Author

zalox commented Apr 19, 2016

@eidheim I'm having trouble persisting my config.json file. Is there any mechanism that overwrites the file or anything in it?

I had the issues in msys2.

@eidheim
Copy link
Member

eidheim commented Apr 19, 2016

As long as you have the same version number in the config file, as in the files.h, juCi++ will not touch the config file. However, if the versions are different, changes will be done to the old config file so that it corresponds to the new file specified in files.h.

@zalox
Copy link
Member Author

zalox commented Apr 19, 2016

I had some very strange behaviour then. I'll try to reproduce when I get back to windows.

@eidheim
Copy link
Member

eidheim commented Apr 19, 2016

Windows does some file lock if a file is opened by another process? That might have been the case, denying the write to you your config file. Although, I'm not very experienced with Windows.

@milleniumbug
Copy link
Contributor

milleniumbug commented Apr 19, 2016

I've debugged the program, and it seems it stops searching for plugins on first hidden file.

/home/milleniumbug/.juci/plugins/snippet.py - full
snippet - stem
/home/milleniumbug/.juci/plugins/.gitignore - full
 - stem
/home/milleniumbug/.juci/plugins/__pycache__ - full
__pycache__ - stem
/home/milleniumbug/.juci/plugins/README.md - full
README - stem
/home/milleniumbug/.juci/plugins/LICENSE - full
LICENSE - stem
/home/milleniumbug/.juci/plugins/tools.py - full
tools - stem
/home/milleniumbug/.juci/plugins/.git - full
 - stem

Changing from

    auto module_name=it->path().stem().string();
    if(module_name.empty())
      break;

to

    auto module_name=it->path().stem().string();
    if(module_name.empty())
      continue;

fixed the problem.

@@ -95,7 +95,7 @@ Python::Interpreter::Interpreter(){
for(boost::filesystem::directory_iterator it(plugin_path);it!=end_it;it++){
auto module_name=it->path().stem().string();
if(module_name.empty())
break;
continue;
auto is_directory=boost::filesystem::is_directory(it->path());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@milleniumbug I fixed it this morning. You probably pulled before.

@zalox
Copy link
Member Author

zalox commented Apr 19, 2016

It might be possible to do it inClangViewAutocomplete::autocomplete_get_suggestions by asking i.e.Python::Interpreter::get_suggestions. The suggestions can be dynamically produced by clang context in plugins. If the interpreter and clang works in parallel I think it might work without a huge performance drop.

This approach isn't very generic and re-factoring might be needed for a reasonable solution.

@eidheim
Copy link
Member

eidheim commented Apr 20, 2016

@zalox I've been thinking about simpler ways to reuse the autocompletion dialog. I'll prioritize this in the coming weeks.

@zalox
Copy link
Member Author

zalox commented May 26, 2016

I updated the docker images with python now. I only updated the packages, so it shouldn't break other builds. https://hub.docker.com/r/cppit/jucipp/builds/

@eidheim
Copy link
Member

eidheim commented May 26, 2016

Coincidently, I'll test it on master now:)

@zalox
Copy link
Member Author

zalox commented May 26, 2016

@zalox zalox force-pushed the python-refactor branch 6 times, most recently from 15b91fd to b019550 Compare September 4, 2016 14:30
@zalox zalox force-pushed the python-refactor branch 3 times, most recently from 73502bd to b285d3d Compare February 18, 2017 15:02
@zalox zalox force-pushed the python-refactor branch 3 times, most recently from 1e57586 to bb6b4aa Compare February 28, 2017 22:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants