Skip to content

Update developer toolset instructions in CONTRIBUTING.md #7762

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

Closed
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
14 changes: 9 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ Use [pre-commit](https://pre-commit.com/#installation) to automatically format y
python3 -m pip install pre-commit # only required the first time
pre-commit install
```
That's it! The plugin will run every time you commit any changes. If there are any errors found during the run, fix them and commit those changes. You can even run the plugin manually on all files:
That's it! The plugin will run every time you commit any changes. If there are any errors found during the run, fix them and commit those changes.
Pre-commit includes
[black](https://github.com/psf/black),
[ruff](https://beta.ruff.rs/docs/)
[mypy](http://mypy-lang.org).

You can even run the plugin manually on all files:

```bash
pre-commit run --all-files --show-diff-on-failure
Expand Down Expand Up @@ -148,15 +154,14 @@ We want your work to be readable by others; therefore, we encourage you to note
starting_value = int(input("Please enter a starting value: ").strip())
```

The use of [Python type hints](https://docs.python.org/3/library/typing.html) is encouraged for function parameters and return values. Our automated testing will run [mypy](http://mypy-lang.org) so run that locally before making your submission.
The use of [Python type hints](https://docs.python.org/3/library/typing.html) is encouraged for function parameters and return values.
Our automated testing will run [mypy](http://mypy-lang.org) so run that locally with pre-commit before making your submission.

```python
def sum_ab(a: int, b: int) -> int:
return a + b
```

Instructions on how to install mypy can be found [here](https://github.com/python/mypy). Please use the command `mypy --ignore-missing-imports .` to test all files or `mypy --ignore-missing-imports path/to/file.py` to test a specific file.

- [__List comprehensions and generators__](https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions) are preferred over the use of `lambda`, `map`, `filter`, `reduce` but the important thing is to demonstrate the power of Python in code that is easy to read and maintain.

- Avoid importing external libraries for basic algorithms. Only use those libraries for complicated algorithms.
Expand All @@ -172,7 +177,6 @@ We want your work to be readable by others; therefore, we encourage you to note
- If you have modified/added documentation work, ensure your language is concise and contains no grammar errors.
- Do not update the README.md or DIRECTORY.md file which will be periodically autogenerated by our GitHub Actions processes.
- Add a corresponding explanation to [Algorithms-Explanation](https://github.com/TheAlgorithms/Algorithms-Explanation) (Optional but recommended).
- All submissions will be tested with [__mypy__](http://www.mypy-lang.org) so we encourage you to add [__Python type hints__](https://docs.python.org/3/library/typing.html) where it makes sense to do so.

- Most importantly,
- __Be consistent in the use of these guidelines when submitting.__
Expand Down