Skip to main content

scrapy-command-new

A package providing code generation command for scrapy CLI.

The project is a WIP, so expect major changes and additions (latter, mostly). Master branch is to be considered as always ready to use, with major changes/features introduced in feature branches.

This is a part of a bigger project - Scrapy Boilerplate.

The command works with a specific scrapy project structure (not the default one). Rationale for this is described here.

Usage

This is a scrapy command to generate class files and automatically add imports to respective module's __init__ files. It can be used as follows:

scrapy new spider SampleSpider

The first argument (spider) is a type of class file to be generated, and can be one of the following:

  • command
  • extension
  • item
  • middleware
  • model
  • pipeline
  • spider

The second argument is class name.

Also for pipeline and spider class an option --rabbit can be used to add RabbitMQ connection code to generated source.

Option --item with value CLASSNAME is supported for generating pipelines, which adds an import and type-check for a provided item class to the resulting code.

Option --settings is also supported for pipelines, extension, middlewares and spider middlewares. It has an optional integer value PRIORITY that adds specified priority. If only -s is used, settings file will be settings.py.

(experimental) Option --file is used for specifying settings file name (or class). You can use spider file for adding newly generated class to spiders' custom_settings property. If you enumerate file names (or class names) using , (like -f SomeSpider,AnotherSpider) - script will add generated class to custom_settings of each file. If only -f is used, will be used default priority (300).

Option --terminal will output 'custom_settings' code to terminal.

Option --custom can be used for custom template folder path. Template names should be like {}.py.mako. Option will enable usage of TEMPLATES_MODULE setting from projects` settings.py. If this setting is not defined, will cause exception.

Installation

This command is included in the Scrapy Boilerplate out of the box. If you want to install it manually, you can get it from PyPi:

pip install scrapy-new

Please note that this package won't work with default Scrapy project structure, it requires a specific custom one, as described here.

Release files for scrapy-new 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scrapy-new 0.2.1
File Size Uploaded
scrapy_new-0.2.1.tar.gz 10.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scrapy-new 0.2.1
File Interpreter ABI Platform
scrapy_new-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 22.9 kB

Release files / scrapy_new-0.2.1.tar.gz

Download URL scrapy_new-0.2.1.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9acd7a158fd2cff0c077b4f58cc6ee18e8aea021451c169b507185e9189dead6
BLAKE2b-256 checksum
How to use checksums
4dc0bd5e782c951b8601978ed53e34ebdd2f57e60bd64f674c91f2050db61d01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.7.5 Linux/5.3.0-61-generic

Release files / scrapy_new-0.2.1-py3-none-any.whl

Download URL scrapy_new-0.2.1-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df47c21a7859426c2802ad23d1665d17bab5cee28426c1ea056782cbff276b16
BLAKE2b-256 checksum
How to use checksums
4c43e37354bba5e7beb346e1718c6c6389b7f8f8f558f7d384e692939e2bf096
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.7.5 Linux/5.3.0-61-generic

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page