PINGDOM_CHECK
ArticleProduct announcementProduct Update

Introducing Scrapy Cloud with Python 3 support

Introducing Scrapy Cloud with Python 3 Support - Discover the enhanced features of Scrapy Cloud, now with Python 3 support for better performance.

Valdir Stumm Junior

2 min read ·

Introducing Scrapy Cloud with Python 3 support

Introducing Scrapy Cloud with Python 3 support

It’s the end of an era. Python 2 is on its way out with only a few security and bug fixes forthcoming from now until its official retirement in 2020. Given this withdrawal of support and the fact that Python 3 has snazzier features, we are thrilled to announce that Scrapy Cloud now officially supports Python 3.

scrapy\_cloud\_2x

If you are new to Zyte , Scrapy Cloud is our production platform that allows you to deploy, monitor, and scale your web scraping projects. It pairs with Scrapy, the open-source web scraping framework, and Portia, our open-source visual web scraper.

Scrapy + Scrapy Cloud with Python 3

I’m sure you Scrapy users are breathing a huge sigh of relief! While Scrapy with official Python 3 support has been around since May, you can now deploy your Scrapy spiders using the fancy new features introduced with Python 3 to Scrapy Cloud. You’ll have the beloved extended tuple unpacking, function annotations, keyword-only arguments, and much more at your fingertips.

Fear not if you are a Python 2 developer and can't port your spiders' codebase to Python 3 because Scrapy Cloud will continue supporting Python 2. In fact, Python 2 remains the default unless you explicitly set your environment to Python 3.

Deploying your Python 3 spiders

Docker support was one of the new features that came along with the Scrapy Cloud 2.0 release in May. It brings more flexibility to your spiders, allowing you to define in which kind of runtime environment (AKA stack) they will be executed.

This configuration is done in your local project's scrapinghub.yml. There you have to include a section called stacks having scrapy:1.1-py3 as the stack for your Scrapy Cloud project:

Plain text

Copy to clipboard

Open code in new window

EnlighterJS 3 Syntax Highlighter

projects:

default: 99999

stacks:

default: scrapy:1.1-py3

projects: default: 99999 stacks: default: scrapy:1.1-py3

1projects:
2    default: 99999
3stacks:
4    default: scrapy:1.1-py3
Copy

After doing that, you just have to deploy your project using shub:

Plain text

Copy to clipboard

Open code in new window

EnlighterJS 3 Syntax Highlighter

$ shub deploy

$ shub deploy

1$ shub deploy
Copy

Note: make sure you are using shub 2.3+ by upgrading it:

Plain text

Copy to clipboard

Open code in new window

EnlighterJS 3 Syntax Highlighter

$ pip install shub --upgrade

$ pip install shub --upgrade

1$ pip install shub --upgrade
Copy

And you're all done! The next time you run your spiders on Scrapy Cloud, they will run on Scrapy 1.1 + Python 3.

Multi-target deployment file

If you have a multi-target deployment file, you can define a separate stack for each project ID:

Plain text

Copy to clipboard

Open code in new window

EnlighterJS 3 Syntax Highlighter

projects:

default:

id: 55555

stack: scrapy:1.1

py3:

id: 99999

stack: scrapy:1.1-py3

projects: default: id: 55555 stack: scrapy:1.1 py3: id: 99999 stack: scrapy:1.1-py3

1projects:
2    default:
3        id: 55555
4        stack: scrapy:1.1
5    py3:
6        id: 99999
7        stack: scrapy:1.1-py3
Copy

This allows you to deploy your local project to whichever Scrapy Cloud project you want, using a different stack for each one:

Plain text

Copy to clipboard

Open code in new window

EnlighterJS 3 Syntax Highlighter

$ shub deploy py3

$ shub deploy py3

1$ shub deploy py3
Copy

This deploys your crawler to project 99999 and uses Scrapy 1.1 + Python 3 as the execution environment.

You can find different versions of the Scrapy stack here.

Wrap up

We hope that you’re as excited as we are for this newest upgrade to Python 3. If you have further questions or are interested in learning more about the souped-up Scrapy Cloud, take a look at our Knowledge Base article.

For those new to our platform, Scrapy Cloud has a forever free subscription, so sign up and give us a try.

Try Zyte API

Build your first scraper in minutes

Free trial, no credit card. From a single request to production in an afternoon.

Get started

Valdir Stumm Junior

Valdir's writing centers on the open-source Scrapy ecosystem and Zyte's developer tools, spanning deployment guides ("Deploy Your Scrapy Spiders From GitHub", "How To Debug Your Scrapy Spiders"), core libraries he helped build (Parsel, Scrapely, Frontera, Dateparser), and the lon…

More from this author

Continue reading

Web scraping finally has a home in the IDE
Product Update

Web scraping finally has a home in the IDE

Discover how web scraping is moving into the IDE. Learn how tools like VS Code and AI-assisted extensions are streamlining scraper development, testing, and maintenance.

Mitch Holt10 min read
Introducing Web Scraping Copilot 1.0: AI-accelerated web scraping inside VS Code
Announcement

Introducing Web Scraping Copilot 1.0: AI-accelerated web scraping inside VS Code

Discover Web Scraping Copilot 1.0, Zyte’s VS Code extension that uses AI to generate, test, and deploy production-ready Scrapy spiders faster while maintaining full developer control.

Mitch Holt10 min read
Play Before You Scrape: Explore Zyte API Settings with Playground
Product Update

Play Before You Scrape: Explore Zyte API Settings with Playground

Discover the best way to configure your scrapers using Zyte API Playground

Cleber Alexandre10 min read
Scraping food delivery data from any geo while avoiding IP-based restrictions
Announcement

Scraping food delivery data from any geo while avoiding IP-based restrictions

Geolocation technology is revolutionizing the food delivery industry, enabling platforms to access location-specific data.

Debbie Reeve-Crook3 min read
Extract localized data with Zyte API’s extended geolocation
How To

Extract localized data with Zyte API’s extended geolocation

High quality web data extracted from localized websites can be tricky and expensive. We share how we solved geolocation issues with Zyte API’s extended geolocation.

Mohsin Ali, Oleksandr Leshchynskyi6 min read
From Data to Decisions: Transforming Digital Shelf Analytics with Zyte API
Announcement

From Data to Decisions: Transforming Digital Shelf Analytics with Zyte API

Maximize DSA with Zyte API Web Scraping: Leverage Zyte API's advanced web scraping technology for your DSA needs. Extract precise, scalable data for product positioning, pricing strategies, and market trends analysis. Stay ahead with our legally compliant, flexible, and cost-effective solutions.

Debbie Reeve-Crook4 min read

The Community · Newsletter

The best of Zyte and the data web, in your inbox.

One curated edition — new articles, product updates, and the stories shaping the data web. No noise.