⬆️ ⬇️

Setting up and using Geany with Python

Hello, today I will tell you about setting up and working with a text editor called Geany. So, let's begin.



Installation



Linux


Go here , here you can find information about the installation in many distributions. Install. Everything is working.



Windows


Download setup.exe from here , install. After installation, you will have to do the following:
Spoiler
Out of the box, everything seems to work, except for the button: it will be written, they say, we don’t know what a python is. Click Build -> Install Build Commands -> at the bottom, to the right of the Run label, write the full path to the python interpreter.

image

Everything, now everything works.



Initial setup



Go to Edit -> Settings -> Editor -> Indents. Indent spaces with spaces , because it is necessary ; lovers of tabs can not touch.

One of the most awesome geany features is the integrated terminal. But it does not always work, in order for it to work, libvte.so is needed; In Ubuntu, you can do apt-get install libvte-dev. For the rest of the distros I do not know, but you can ask Google. The terminal is available in the bottom panel. Just dig a little in the settings, there you can enable the completion of brackets, quotes, etc.; configure hotkeys and stuff.



Plugins



Linux


Go here , choose the installation method for your distribution.

')

Windows


Download the setup from here , install.




Go to geany, Tools -> Module Manager. I strongly recommend the inclusion of modules:



Projects



Well, everything is simple: to create a project, click Project -> New. Set the name, in the file name field write <directory path> / <project name> .geany

From below, respectively, we write just the path to the directory. When you open a project, the project folder will automatically open in the sidebar, in the module tree of files.



Different amenities



I do not know about you, but sometimes I need to check the style of the code. There is no standard support in geany. I decided to use flake8 for this, since it is very easy to install. We make pip install flake8 pep8-naming. Open some Python file, click Build -> Install

build commands. Under the heading python commands, look for item 2, rename it to check, or something else, on the right, write flake8 --show-source "% f" In the error regular expression column, write ([^:] +): ([[0-9 ] +): ([0-9:] +)? . *; It should work like this:

image

Bind on the hotkey (by default I had F9). PROFIT

ATTENTION!!! In order for the code check to work for any Python files, you need to open not a file from a project, but any single file, and only add these lines to it. Otherwise, the code check will work only for the project in which we

activated it.



The next thing - many people who are engaged in web development, have a problem that you need to restart to update everything.

server, which is not always convenient. Of course, you can use the built-in terminal, and it is quite convenient, he did it himself. But then I wanted

so that when you click on a button, the server restarts itself. We discover how strange it is Build -> Install

build commands. We are looking for the title indemendent comands. In the column to the right of “Make” we write the restart command of our server (I have sudo

apachectl restart). Attention! For this trick to work, you need to register in sudoers so that this command does not ask for a password, otherwise

will earn nothing. Next, bindim “Make” on a convenient button, rejoice.



Color scheme



The standard color scheme is not so bad, but I want, of course, more beautiful. Go here , download the archive. All contents of the archive are copied in the case of Linux in ~ / .config / geany. In the case of windows, we copy everything into

C: \ Users \ YourUserName \ AppData \ Roaming \ geany \. Next, go to View -> Editor -> Color Schemes. Choose your favorite, reboot

geany, everything works. My choice is monokai, the most pleasant in my opinion scheme. Yes, and if someone does not like these topics, you can do it yourself here .



Conclusion



I hope in this article I have revealed the main advantages of such an editor as geany and helped you to set it up well, thank you for your attention.

Source: https://habr.com/ru/post/198468/



All Articles