Summary and Setup

This is a Byte-Sized RSE lesson on code style, quality & linting, part of the Byte-Sized RSE Series.

Learning Objectives


At the end of this lesson, learners should be able to:

  • Explain why consistent code style is important for collaboration and long-term maintainability.
  • Identify key code style practices and how they vary between programming languages.
  • Recognise how maintaining good code style can reduce bugs and improve code quality.
  • Explain what a linter is and describe its role in detecting errors and enforcing style.
  • Perform automated code style checking and static code analysis with Pylint.

Setup


Prerequisite
  • Shell with Git version control tool installed
  • Ability to navigate filesystem and run commands from within a shell
  • Python version 3.8 or above installed
  • Understanding of Python syntax to be able to read and follow code examples
  • Pip Python package installer
  • Visual Studio Code installed (ideally the latest version)

Shell with Git

On macOS and Linux, some version of a shell (e.g. bash) with Git will be available by default and no installation is needed.

If you do not have a bash shell installed on your system and require assistance with the installation, you can take a look at the instructions provided by Software Carpentry for installing shell and Git.

Python

Python version 3.8 or above is required. Type python -v at your shell prompt and press enter to see what version of Python is installed on your system. If you do not have Python installed on your system and require assistance with the installation, you can take a look at the instructions provided by Software Carpentry for installing Python in preparation for undertaking their Python lesson.

Pip

Pip Python package should come together with your Python distribution. Try typing pip at the command line and you should see some usage instructions for the command appear if it is installed.

VS Code

The hands-on part of this topic will be conducted using Visual Studio Code (VS Code), a widely used IDE. Please [download the appropriate version of Visual Studio Code][vs-code] for your operating system (Windows, macOS, or Linux) and system architecture (e.g., 64-bit, ARM).