Skip to content

First Steps ๐Ÿ‘ฃโš“

In this section described basic steps to start programming with Python or Rust.

Python ๐Ÿโš“

Installation ๐Ÿ”Œโš“

  1. Just download .exe file;
  2. Install it;
  3. Add python executable to PATH (should be option for it);
  4. Use to "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