SCP18: No root stack

What it does

Finds out if the stack key is missing from the root of the scrapinghub.yml shub configuration file.

Why is this bad?

The stack key in the scrapinghub.yml file specifies the software stack to use: Docker image, Python version, and Python packages.

While you can (and should) set your Python packages through your requirements file, the stack allows you to freeze the Docker image and Python version that your project uses in Scrapy Cloud.

And it is important to set this stack at the root of the scrapinghub.yml file, instead of e.g. under a specific Scrapy Cloud project, because you do not want to accidentally use the default stack when deploying to a Scrapy Cloud project that does not have a stack explicitly configured. And it generally makes sense that the same code base always uses the same stack.

Example

requirements:
  file: requirements.txt

Instead use:

requirements:
  file: requirements.txt
stack: scrapy:2.12-20241202