Перейти до змісту

Перші кроки 👣

В цьому розділі описано основні кроки для початку програмування на Python або Rust.

Python 🐍

Встановлення 🔌

  1. Просто завантажте файл .exe;
  2. Встановіть його;
  3. Додайте Python до системного PATH (для нього повинен бути );
  4. Встановіть для опції "install for all users";
  1. Download archive;
  2. Extract it;
  3. Go go extracted folder;
  4. Use these commands:

    1. ./configure - prepare for installation;
    2. make - extract / download / check files;
    3. make test - to rust CPython tests before installation;
    4. make altinstall - to install new version together with already installed, without change the default one;

    Info

    All commands can require sudo access (but it depends).

    Danger

    If you need override your current python enterpreter with new one, use can use make install.

Virtual Environment 🔮✨

For Python 🐍 projects are best practices to use different Python versions and separate installed versions for dependencies.

venv

Here is another good option to manage virtual environments, called Poetry:

Poetry Poetry - Managing environments

Code Formatters 🧾

Python has no standard auto formatters included to it 😢.

Several of common community formatters is:

black - code formatter; isort - imports formatter;

Rust 🦀

Installation 🔌

To install Rust it's better to use the official method via rustup (this is Rust toolchain).

  1. Go to Rustup;
  2. Click "display all supported installers";
  3. Select x32 or x64 bit version of rustup-init.exe;
  4. Install it;
  1. Go to Rustup;
  2. Copy cURL link and execute it in terminal (maybe it will require sudo previliages);

Check versions

rustup -V && rustc -V && cargo -V

Virtual Environment 🔮✨

Rust 🦀 no need to manage virtual environment in such way like a Python, because every package (called Crate in Rust) is separated from others and it builds at compile time.

To manage dependencies and crates in Rust toolchain - exists Cargo.

Code Formatters 🧾

Rust has standard formatter called rustfmt.

You can call it directly from Cargo inside your crate:

cargo fmt

Or from rustfmt by one file:

rustfmt <path_to_file>

Example

rustfmt docs/src/hello_world/hello_world.rs