Nauč se Python > Kurzy > Beginners course PyLadies > Installation > Editor installation > Atom

Instalace Atom

Download Atom from its webpage and install it.

Settings

You don't have to set up anything in Atom.

Indentation and colouring, how we want it, works only with files with .py extension.

So it's better if you save your file as early as possible.

Code style

There is just one thing missing in Atom: plug-in for checking code style

As every written language Python also has its typographic rules. You can find them here in PEP8 document.

If you don't want to remember them just install plug-in which will always notice you if you violate some.

Firstly we will have to install special library which takes care of this. Write into your command line:

$ python -m pip install flake8

And now just install the plug-in. In the main menu choose "File > Settings" and click on "Install". Then search for "linter-flake8" and in the list click "Install" next to the "linter-flake8". You will be also asked for installation of every dependency.

Indentation practice

As we already mentioned it's important in Python by how much spaces is line indented. So we will have to learn to quickly indent block of text.

First of all copy following text into your editor.

OPHELIA:
Good my lord,
How does your honour for this many a day?
HAMLET:
I humbly thank you; well, well, well.
OPHELIA:
My lord, I have remembrances of yours,
That I have longed long to re-deliver;
I pray you, now receive them.
HAMLET:
No, not I;
I never gave you aught.
OPHELIA:
My honour'd lord, you know right well you did;
And, with them, words of so sweet breath composed
As made the things more rich: their perfume lost,
Take these again; for to the noble mind
Rich gifts wax poor when givers prove unkind.
There, my lord.

Hamlet, W. Shakespeare

This text is not well-arranged so we will indent it like that:

OPHELIA:
    Good my lord,
    How does your honour for this many a day?
HAMLET:
    I humbly thank you; well, well, well.
OPHELIA:
    My lord, I have remembrances of yours,
    That I have longed long to re-deliver;
    I pray you, now receive them.
HAMLET:
    No, not I;
    I never gave you aught.
OPHELIA:
    My honour'd lord, you know right well you did;
    And, with them, words of so sweet breath composed
    As made the things more rich: their perfume lost,
    Take these again; for to the noble mind
    Rich gifts wax poor when givers prove unkind.
    There, my lord.

To indent one line set you coursor in the beginning of the line and press Tab. With every press you will indent the like by 4 spaces.

If you indent too much, press Shift+Tab.

If you would want to indent more lines just highlight them and press Tab. For undo press Shift+Tab.


Toto je stránka lekce z kurzu, který probíhá nebo proběhl naživo s instruktorem.