Skip to content
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

[test] Dev tox #237

Merged
merged 10 commits into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 28 additions & 12 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. highlight:: shell

============
Contributing
Contribution
============

Contributions are welcome, and they are greatly appreciated! Every
Expand All @@ -12,10 +12,20 @@ You can contribute in many ways:
Types of Contributions
----------------------

New to here
~~~~~~~~~~~

Any issue with good first issue tag on it is a great place to start! Feel free to ask any questions here.

Don't know how to start
~~~~~~~~~~~

Review codebases and PRs can give you quite a knowledge to know what's going on here!

Report Bugs
~~~~~~~~~~~

Report bugs at https://github.com/rolando/scrapy-redis/issues.
Report bugs at https://github.com/rmax/scrapy-redis/issues.

If you are reporting a bug, please include:

Expand All @@ -29,10 +39,10 @@ Fix Bugs
Look through the GitHub issues for bugs. Anything tagged with "bug"
is open to whoever wants to implement it.

Implement Features
Implement Features & imporvments
~~~~~~~~~~~~~~~~~~

Look through the GitHub issues for features. Anything tagged with "feature"
Look through the GitHub issues for features. Anything tagged with "feature" or "improvments"
is open to whoever wants to implement it.

Write Documentation
Expand All @@ -45,7 +55,7 @@ articles, and such.
Submit Feedback
~~~~~~~~~~~~~~~

The best way to send feedback is to file an issue at https://github.com/rolando/scrapy-redis/issues.
The best way to send feedback is to file an issue at https://github.com/rmax/scrapy-redis/issues.

If you are proposing a feature:

Expand All @@ -59,6 +69,9 @@ Get Started!

Ready to contribute? Here's how to set up `scrapy-redis` for local development.

Setup environment
~~~~~~~~~~~~~~~

1. Fork the `scrapy-redis` repo on GitHub.
2. Clone your fork locally::

Expand All @@ -70,6 +83,7 @@ Ready to contribute? Here's how to set up `scrapy-redis` for local development.
virtualenv --python=/usr/bin/python3 ~/scrapy_redis
source ~/scrapy_redis/bin/activate
cd scrapy-redis/
pip install -r requirements-install.txt
pip install .

4. Create a branch for local development::
Expand All @@ -78,30 +92,32 @@ Ready to contribute? Here's how to set up `scrapy-redis` for local development.

Now you can make your changes locally.

5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox::
Setup testing environment
~~~~~~~~~~~~~~~

1. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox::

pip install -r requirements-tests.txt
flake8 src/ tests/
python -m pytest --ignore=setup.py
tox

To get flake8 and tox, just pip install them into your virtualenv.

6. Note that if the error of `No module named scrapy_redis` shows, please check the install `scrapy-redis` of your branch by::
2. Note that if the error of `No module named scrapy_redis` shows, please check the install `scrapy-redis` of your branch by::

pip install .

7. Or change the import lines::
3. Or change the import lines::

from scrapy_redis import xxx # from this
from src.scrapy_redis import xxx # to this

8. Commit your changes and push your branch to GitHub::
4. Commit your changes and push your branch to GitHub::

git add .
git commit -m "Your detailed description of your changes."
git push origin name-of-your-bugfix-or-feature

9. Submit a pull request through the GitHub website.
5. Submit a pull request through the GitHub website.

Pull Request Guidelines
-----------------------
Expand Down
2 changes: 1 addition & 1 deletion requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This packages are required to run all the tests.
coverage
flake8
mock
pytest
pytest-cov
tox
54 changes: 39 additions & 15 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,21 +1,45 @@
[tox]
# TODO: added redis-py version matrix.
envlist = py{27,34,35}-scrapy{10,11,12,1x,rel,dev}
# TODO: envlist = py{27,34,35}-scrapy{10,11,12,1x,rel,dev}
envlist = security,flake8,py37,py38,py39,py310
minversion = 1.7.0

[base]
deps =
scrapy>=2.4
redis>=4.0
six>=1.5.2

[testenv]
basepython =
py27: python2.7
py34: python3.4
py35: python3.5
basepython =
py37: python3.7
py38: python3.8
py39: python3.9
py310: python3.10
deps =
{[base]deps}
mock
pytest
pytest-cov
commands =
pip install .
python -m pytest --ignore=setup.py # --cov-report term --cov=scrapy_redis

[testenv:flake8]
deps =
{[base]deps}
flake8 # https://github.com/tholo/pytest-flake8/issues/81
commands =
flake8 docs tests

[testenv:security]
deps =
-rrequirements-setup.txt
-rrequirements-install.txt
-rrequirements-tests.txt
bandit==1.7.3
commands =
scrapy10: pip install scrapy>=1.0,<1.1
scrapy11: pip install scrapy>=1.1,<1.2
scrapy12: pip install scrapy>=1.2,<1.3
scrapy1x: pip install scrapy>=1.0,<2.0
scrapyrel: pip install scrapy
scrapydev: pip install https://github.com/scrapy/scrapy/archive/master.zip
{posargs:coverage run -m pytest --ignore=setup.py }
bandit -r -c .bandit.yml src/ tests/

# TODO: add pylint

# TODO: build windows/linux/mac

# TODO: build docs