Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

added deprecation warning when importing scrapy.conf module

Pablo Hoffman9d7106219a87
diff --git a/scrapy/conf.py b/scrapy/conf.py
index f8aade2d3..717f1da6f 100644
--- a/scrapy/conf.py
+++ b/scrapy/conf.py
@@ -1,11 +1,10 @@
# This module is kept for backwards compatibility, so users can import
# scrapy.conf.settings and get the settings they expect
-#
-# TODO: Add deprecation warning once all scrapy.conf instances have been
-# removed from Scrapy codebase.
-import sys
+from scrapy.project import crawler
+settings = crawler.settings
-if 'scrapy.cmdline' not in sys.modules:
- from scrapy.utils.project import get_project_settings
- settings = get_project_settings()
+import warnings
+from scrapy.exceptions import ScrapyDeprecationWarning
+warnings.warn("Module `scrapy.conf` is deprecated, use `crawler.settings` attribute instead",
+ ScrapyDeprecationWarning, stacklevel=2)