From 69f916d694be68f3e23a7e88cf60cc8b3b12c90b Mon Sep 17 00:00:00 2001 From: Karim shoair Date: Sat, 28 Feb 2026 16:41:44 +0200 Subject: [PATCH] docs: Enhance CONTRIBUTING rules with PR guidelines and updates Added guidelines for making pull requests and updated documentation on building and testing. --- CONTRIBUTING.md | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 425531f..e972abc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,6 +13,17 @@ There are many ways to contribute to Scrapling. Here are some of them: - Join the [Discord community](https://discord.gg/EMgGbDceNQ) and share your ideas on how to improve Scrapling. We’re always open to suggestions. - If you are not a developer, perhaps you would like to help with translating the [documentation](https://github.com/D4Vinci/Scrapling/tree/docs)? +## Making a Pull Request +To ensure that your PR gets accepted, please make sure that your PR is based on the latest changes from the dev branch and that it satisfies the following requirements: + +- **The PR must be made against the [**dev**](https://github.com/D4Vinci/Scrapling/tree/dev) branch of Scrapling. Any PR made against the main branch will be rejected.** +- **The code should be passing all available tests. We use tox with GitHub's CI to run the current tests on all supported Python versions for every code-related commit.** +- **The code should be passing all code quality checks like `mypy` and `pyright`. We are using GitHub's CI to enforce code style checks as well.** +- **Make your changes, keep the code clean with an explanation of any part that might be vague, and remember to create a separate virtual environment for this project.** +- If you are adding a new feature, please add tests for it. +- If you are fixing a bug, please add code with the PR that reproduces the bug. +- Please follow the rules and coding style rules we explain below. + ## Finding work @@ -26,7 +37,7 @@ If you have decided to make a contribution to Scrapling, but you do not know wha ## Coding style Please follow these coding conventions as we do when writing code for Scrapling: - We use [pre-commit](https://pre-commit.com/) to automatically address simple code issues before every commit, so please install it and run `pre-commit install` to set it up. This will install hooks to run [ruff](https://docs.astral.sh/ruff/), [bandit](https://github.com/PyCQA/bandit), and [vermin](https://github.com/netromdk/vermin) on every commit. We are currently using a workflow to automatically run these tools on every PR, so if your code doesn't pass these checks, the PR will be rejected. -- We use type hints for better code clarity and [pyright](https://github.com/microsoft/pyright) for static type checking, which depends on the type hints, of course. +- We use type hints for better code clarity and [pyright](https://github.com/microsoft/pyright)/[mypy](https://github.com/python/mypy) for static type checking. If your code isn't acceptable by those tools, your PR won't pass the code quality rule. - We use the conventional commit messages format as [here](https://gist.github.com/qoomon/5dfcdf8eec66a051ecd85625518cfd13#types), so for example, we use the following prefixes for commit messages: | Prefix | When to use it | @@ -63,11 +74,12 @@ pip3 install git+https://github.com/D4Vinci/Scrapling.git@dev ``` ## Building Documentation -Documentation is built using [MkDocs](https://www.mkdocs.org/). You can build it locally using the following commands: +Documentation is built using [Zensical](https://zensical.org/). You can build it locally using the following commands: ```bash -pip install mkdocs-material -mkdocs serve # Local preview -mkdocs build # Build the static site +pip install zensical +pip install -r docs/requirements.txt +zensical build --clean # Build the static site +zensical serve # Local preview ``` ## Tests @@ -80,8 +92,8 @@ Scrapling includes a comprehensive test suite that can be executed with pytest. rootdir: /Users//scrapling configfile: pytest.ini plugins: asyncio-1.2.0, anyio-4.11.0, xdist-3.8.0, httpbin-2.1.0, cov-7.0.0 - asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function - 10 workers [271 items] + asyncio: mode=Mode.STRICT, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function + 10 workers [515 items] scheduling tests via LoadScheduling ...... @@ -94,13 +106,3 @@ Bonus: You can also see the test coverage with the `pytest` plugin below ```bash pytest --cov=scrapling tests/ ``` - -## Making a Pull Request -To ensure that your PR gets accepted, please make sure that your PR is based on the latest changes from the dev branch and that it satisfies the following requirements: - -- The PR should be made against the [**dev**](https://github.com/D4Vinci/Scrapling/tree/dev) branch of Scrapling. Any PR made against the main branch will be rejected. -- The code should be passing all available tests. We use tox with GitHub's CI to run the current tests on all supported Python versions for every code-related commit. -- The code should be passing all code quality checks we mentioned above. We are using GitHub's CI to enforce the code style checks performed by pre-commit. If you were using the pre-commit hooks we discussed above, you should not see any issues when committing your changes. -- Make your changes, keep the code clean with an explanation of any part that might be vague, and remember to create a separate virtual environment for this project. -- If you are adding a new feature, please add tests for it. -- If you are fixing a bug, please add code with the PR that reproduces the bug. \ No newline at end of file