-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor requirements #407
Conversation
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## master #407 +/- ##
=======================================
Coverage 78.64% 78.64%
=======================================
Files 73 73
Lines 3152 3152
Branches 528 528
=======================================
Hits 2479 2479
Misses 598 598
Partials 75 75 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with the current approach but I think it was suggested to get rid of requirements.txt
files and just leave pre-commit & tox to fetch all dependencies from the setup.py file.
Some examples:
Could you also please update https://github.com/scrapinghub/spidermon/blob/master/CONTRIBUTING.rst to replace references to requirements.txt files and substitute it with just installing tox ? |
We need to review the list of packages on setup.py as not all are required by spidermon itself |
@@ -0,0 +1,3 @@ | |||
sphinx | |||
sphinx-rtd-theme |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be a good practice to pin the package versions here.
setup.py
Outdated
"tests": test_requirements, | ||
# Tools to build and publish the documentation | ||
"docs": ["sphinx", "sphinx-rtd-theme", "s3cmd"], | ||
"monitoring": [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to move packags like slack_sdk, sentry_sdk and boto here? Are they optional dependencies of spidermon, or are they all required for spidermon to work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not required by Spidermon itself but by different actions:
- boto is required by
actions/reports/s3.py
- boto3 is required by
actions/email/ses.py
- sentry_sdk is required by
actions/sentry/__init__.py
- slack_sdk is required by
actions/slack/__init__.py
Before this change, most-common user case of spidermon was to install everything with spidermon[monitoring]
. The idea was to make this the default installing by moving all the packages into install_requires
and keep monitoring
empty to be backward compatible.
Alternatively, we could move this packages into a new section named actions
but that wouldn't be backwards compatible and may be quite problematic for most people.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the reqs that were moved from tests_require
/ spidermon[tests]
to install_requires
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken those would be:
- itemadapter: [contrib/scrapy/pipelines.py], [contrib/scrapy/extensions.py],
- requests [contrib/actions/telegram/init.py],[contrib/actions/discord/init.py]:
- scrapinghub-entrypoint-scrapy (sh_scrapy) [contrib/stats/statscollectors/sc_collections.py]
- twisted [contrib/scrapy/extensions.py]
itemadapter, requests and sh_scrapy are required by different parts of the code. I guess they were not previously added by mistake, because they are already present on most Scrapy stacks anyway.
The only package that seems redundant to me is twisted which I think we should drop as is already covered by scrapy
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the dependencies like boto or slack-sdk are all optional, and most users don't use all of them.
Not installing them by default minimizes scenarios when some of these packages don't install for some reason for the users - e.g. a package drops support for some Python version which spidermon still supports (and which an user is using), or requirements of some package conflict with requirements which user's project has.
If these packages are not optional, then in such scenario spidemon installation is broken for users who don't even use these features.
That said, if based on your experience with these particular packages you found it unlikely they break, it looks fine to install them by default.
So, I'm approving the PR, and let you folks decide if the concern is worth addressing, or if addressing it just complicates things.
If it's something which should be addressed, probably the easiest way to go is to move all optional requirements to some section like pip install spidermon[contrib]
or pip install spidermon[all]
, keep only the required ones in default install_requires, and also document pip install spidermon[all]
as the way to install spidermon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried about adding a new optional requirements like contrib
all all
after we already have monitors
in place that is used by default by most users.
I have updated the PR with some changes:
|
* Refactor requirements * Removing requirements files * Adjust reqs * Adjust tox * remove requirements * Remove redundant requirements/docs.txt files * Remove deprecate extras and redundancy in testenv deps * Restore jsonschema min version * Fix tox testenv:min * Move optional dependencies into extra[monitoring] for backwards compatibility * Fix incorrect coverage file being uploaded to codecov --------- Co-authored-by: mauricio.barg <> Co-authored-by: Víctor Ruiz <[email protected]>
Closes #393.
Organizing dependencies.