Skip to content
Snippets Groups Projects

Cinematinator: prop die bioscoop maar vol

Nix

To get this project's dependencies you first need to install Nix. Execute the following command and follow the instructions it gives in your terminal:

$ sh <(curl -L https://nixos.org/nix/install)

Afterwards, reopen your terminal or execute this command to make the nix command available.

$ source ~/.nix-profile/etc/profile.d/nix.sh
$ # This should now work:
$ nix

Usage: nix <COMMAND> <FLAGS>... <ARGS>...

[...]

Dependencies

This project's dependencies are managed using Nix.

TL;DR:

  • ./make-virtualenv.sh to make a "virtualenv" under venv with all dependencies
  • ./develop.sh to open a shell with this virtualenv active
  • ./format.sh to apply the code formatting to all files
  • ./typecheck.sh to check the program's types
  • nix build to run all checks
  • cli to run our code (inside the virtualenv) or nix run -c cli

Useful commands:

  • nix build -o venv -A pythonEnv (shortcut: ./make-virtualenv.sh): Creates a symlink named venv in the root of the repository with the project's dependencies inside. Of interest:

    • result/bin/python, result/bin/python3.8: Python interpreter with all dependencies available
    • result/bin/black, result/bin/mypy, result/bin/isort: Linter tools also used in the build
  • nix-shell -A package (shortcut: ./develop.sh): Open a new shell with all dependencies active, don't run any code checks.

  • cli (run this inside the virtualenv): Run some command in the project, see cinematinator/cli.py.

  • Code style commands (run these inside the virtualenv):

    • isort --recursive cinematinator: Sort imports in all files in the project.
    • black cinematinator: Apply the Black codestyle to all Python files in the project.

    These commands can be run with ./format.sh.

  • mypy --strict cinematinator (shortcut: ./typecheck.sh): Run type checks, i.e. check that all functions are called with valid arguments, variables aren't misused, etc.