Skip to content

Commit 23c147e

Browse files
docs: fix outdated references in CONTRIBUTING.md (#15188)
* docs: fix outdated references in CONTRIBUTING.md - Update Python version from 3.13+ to 3.14+ (matches pyproject.toml) - Replace outdated black formatter recommendation with ruff format (matches .pre-commit-config.yaml) - Update PEP 8 URL to canonical peps.python.org (old URL 302-redirects) - Fix inconsistent mypy URL from http://www.mypy-lang.org to https://mypy-lang.org * docs: point CONTRIBUTING.md at the tooling CI actually runs - `ruff .` -> `ruff check .`: bare `ruff .` fails with "unrecognized subcommand '.'"; .github/workflows/ruff.yml runs `ruff check ... .` - mypy -> ty: the mirrors-mypy pre-commit hook is commented out and no workflow runs mypy, while .github/workflows/ty.yml runs `ty check` on every pull request - requirements.txt -> pyproject.toml: requirements.txt was deleted in #13486 ("dependencies are in pyproject.toml") * docs: note that the ty check is informational Addresses Copilot review feedback: .github/workflows/ty.yml sets `continue-on-error: true` and passes `--exit-zero` ("ty is not yet a required gate"), so the previous wording implied an enforced gate. * Apply batched suggestions from code review Co-authored-by: Christian Clauss <cclauss@me.com> * Fix grammar and punctuation in CONTRIBUTING.md Correct grammar and punctuation throughout the document for clarity and consistency. --------- Co-authored-by: Christian Clauss <cclauss@me.com>
1 parent bfa655e commit 23c147e

1 file changed

Lines changed: 26 additions & 21 deletions

File tree

CONTRIBUTING.md

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ __Improving comments__ and __writing proper tests__ are also highly welcome.
2323

2424
We appreciate any contribution, from fixing a grammar mistake in a comment to implementing complex algorithms. Please read this section if you are contributing your work.
2525

26-
Your contribution will be tested by our [automated testing on GitHub Actions](https://github.com/TheAlgorithms/Python/actions) to save time and mental energy. After you have submitted your pull request, you should see the GitHub Actions tests start to run at the bottom of your submission page. If those tests fail, then click on the ___details___ button to read through the GitHub Actions output to understand the failure. If you do not understand, please leave a comment on your submission page and a community member will try to help.
26+
Your contribution will be tested by our [automated testing on GitHub Actions](https://github.com/TheAlgorithms/Python/actions) to save time and mental energy. After you have submitted your pull request, you should see the GitHub Actions tests start to run at the bottom of your submission page. If those tests fail, then click on the ___details___ button to read through the GitHub Actions output to understand the failure. If you do not understand, please leave a comment on your submission page, and a community member will try to help.
2727

2828
#### Issues
2929

@@ -46,7 +46,7 @@ An Algorithm is one or more functions (or classes) that:
4646
* return one or more outputs,
4747
* have minimal side effects (Ex. `print()`, `plot()`, `read()`, `write()`).
4848

49-
Algorithms should be packaged in a way that would make it easy for readers to put them into larger programs.
49+
Algorithms should be packaged in a way that makes it easy for readers to put them into larger programs.
5050

5151
Algorithms should:
5252
* have intuitive class and function names that make their purpose clear to readers
@@ -58,7 +58,7 @@ Algorithms should:
5858
* contain doctests that test both valid and erroneous input values
5959
* return all calculation results instead of printing or plotting them
6060

61-
Algorithms in this repo should not be how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values. Those calculations or manipulations can use data types, classes, or functions of existing Python packages but each algorithm in this repo should add unique value.
61+
Algorithms in this repo should not be how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values. Those calculations or manipulations can use data types, classes, or functions of existing Python packages, but each algorithm in this repo should add unique value.
6262

6363
#### Pre-commit plugin
6464
Use [pre-commit](https://pre-commit.com/#installation) to automatically format your code to match our coding style:
@@ -67,7 +67,7 @@ Use [pre-commit](https://pre-commit.com/#installation) to automatically format y
6767
python3 -m pip install pre-commit # only required the first time
6868
pre-commit install
6969
```
70-
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:
70+
That's it! The plugin will run every time you commit any changes. If any errors are found during the run, fix them and commit those changes. You can even run the plugin manually on all files:
7171

7272
```bash
7373
pre-commit run --all-files --show-diff-on-failure
@@ -77,22 +77,22 @@ pre-commit run --all-files --show-diff-on-failure
7777

7878
We want your work to be readable by others; therefore, we encourage you to note the following:
7979

80-
- Please write in Python 3.13+. For instance: `print()` is a function in Python 3 so `print "Hello"` will *not* work but `print("Hello")` will.
80+
- Please write in free-threaded Python 3.14t+. For instance: `print()` is a function in Python 3, so `print "Hello"` will *not* work, but `print("Hello")` will.
8181
- Please focus hard on the naming of functions, classes, and variables. Help your reader by using __descriptive names__ that can help you to remove redundant comments.
82-
- Single letter variable names are *old school* so please avoid them unless their life only spans a few lines.
82+
- Single-letter variable names are *old school*, so please avoid them unless their life only spans a few lines.
8383
- Expand acronyms because `gcd()` is hard to understand but `greatest_common_divisor()` is not.
8484
- Please follow the [Python Naming Conventions](https://pep8.org/#prescriptive-naming-conventions) so variable_names and function_names should be lower_case, CONSTANTS in UPPERCASE, ClassNames should be CamelCase, etc.
8585

8686
- We encourage the use of Python [f-strings](https://realpython.com/python-f-strings/#f-strings-a-new-and-improved-way-to-format-strings-in-python) where they make the code easier to read.
8787

88-
- Please consider running [__psf/black__](https://github.com/python/black) on your Python file(s) before submitting your pull request. This is not yet a requirement but it does make your code more readable and automatically aligns it with much of [PEP 8](https://www.python.org/dev/peps/pep-0008/). There are other code formatters (autopep8, yapf) but the __black__ formatter is now hosted by the Python Software Foundation. To use it,
88+
- Please consider running [__ruff format__](https://docs.astral.sh/ruff/formatter/) on your Python file(s) before submitting your pull request. This is not yet a requirement, but it does make your code more readable and automatically aligns it with much of [PEP 8](https://peps.python.org/pep-0008/). To use it,
8989

9090
```bash
91-
python3 -m pip install black # only required the first time
92-
black .
91+
python3 -m pip install ruff # only required the first time
92+
ruff format
9393
```
9494

95-
- All submissions will need to pass the test `ruff .` before they will be accepted so if possible, try this test locally on your Python file(s) before submitting your pull request.
95+
- All submissions will need to pass the test `ruff check` before they will be accepted, so if possible, try this test locally on your Python file(s) before submitting your pull request.
9696

9797
```bash
9898
python3 -m pip install ruff # only required the first time
@@ -103,17 +103,17 @@ We want your work to be readable by others; therefore, we encourage you to note
103103

104104
- More on docstrings and comments:
105105

106-
If you used a Wikipedia article or some other source material to create your algorithm, please add the URL in a docstring or comment to help your reader.
106+
If you used a Wikipedia article or other source material to create your algorithm, please add the URL in a docstring or comment to help your reader.
107107

108108
The following are considered to be bad and may be requested to be improved:
109109

110110
```python
111111
x = x + 2 # increased by 2
112112
```
113113

114-
This is too trivial. Comments are expected to be explanatory. For comments, you can write them above, on or below a line of code, as long as you are consistent within the same piece of code.
114+
This is too trivial. Comments are expected to be explanatory. For comments, you can write them above, on, or below a line of code, as long as you are consistent within the same piece of code.
115115

116-
We encourage you to put docstrings inside your functions but please pay attention to the indentation of docstrings. The following is a good example:
116+
We encourage you to put docstrings inside your functions, but please pay attention to the indentation of docstrings. The following is a good example:
117117

118118
```python
119119
def sum_ab(a, b):
@@ -139,7 +139,7 @@ We want your work to be readable by others; therefore, we encourage you to note
139139
return a + b
140140
```
141141

142-
These doctests will be run by pytest as part of our automated testing so please try to run your doctests locally and make sure that they are found and pass:
142+
These doctests will be run by pytest as part of our automated testing, so please try to run your doctests locally and make sure that they are found and pass:
143143

144144
```bash
145145
python3 -m doctest -v my_submission.py
@@ -159,31 +159,36 @@ We want your work to be readable by others; therefore, we encourage you to note
159159
starting_value = int(input("Please enter a starting value: ").strip())
160160
```
161161

162-
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](https://mypy-lang.org) so run that locally before making your submission.
162+
The use of [Python type hints](https://docs.python.org/3/library/typing.html) is encouraged for function parameters and return values. Our CI runs [ty](https://docs.astral.sh/ty/) as an informational check that does not block merges yet, so you may want to run it locally before making your submission.
163+
164+
```bash
165+
python3 -m pip install ty # only required the first time
166+
ty check my_file_path.py
167+
```
163168

164169
```python
165170
def sum_ab(a: int, b: int) -> int:
166171
return a + b
167172
```
168173

169-
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.
174+
Instructions on how to install ty can be found [here](https://docs.astral.sh/ty/installation/). Please use the command `ty check` to test all files or `ty check path/to/file.py` to test a specific file.
170175

171176
- [__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.
172177

173178
- Avoid importing external libraries for basic algorithms. Only use those libraries for complicated algorithms.
174-
- If you need a third-party module that is not in the file __requirements.txt__, please add it to that file as part of your submission.
179+
- If you need a third-party module that is not already listed in __pyproject.toml__, please add it to the `dependencies` there as part of your submission. The `uv-lock` pre-commit hook will update `uv.lock` to match.
175180

176181
#### Other Requirements for Submissions
177182
- If you are submitting code in the `project_euler/` directory, please also read [the dedicated Guideline](https://github.com/TheAlgorithms/Python/blob/master/project_euler/README.md) before contributing to our Project Euler library.
178183
- The file extension for code files should be `.py`. Jupyter Notebooks should be submitted to [TheAlgorithms/Jupyter](https://github.com/TheAlgorithms/Jupyter).
179-
- Strictly use snake_case (underscore_separated) in your file_name, as it will be easy to parse in future using scripts.
184+
- Strictly use snake_case (underscore_separated) in your file_name, as it will be easy to parse in the future using scripts.
180185
- Please avoid creating new directories if at all possible. Try to fit your work into the existing directory structure.
181186
- If possible, follow the standard *within* the folder you are submitting to.
182-
- If you have modified/added code work, make sure the code compiles before submitting.
187+
- If you have modified/added code, make sure the code compiles before submitting.
183188
- If you have modified/added documentation work, ensure your language is concise and contains no grammar errors.
184-
- Do not update the README.md or DIRECTORY.md file which will be periodically autogenerated by our GitHub Actions processes.
189+
- Do not update the README.md or DIRECTORY.md file, which will be periodically autogenerated by our GitHub Actions processes.
185190
- Add a corresponding explanation to [Algorithms-Explanation](https://github.com/TheAlgorithms/Algorithms-Explanation) (Optional but recommended).
186-
- 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.
191+
- Our CI runs [__ty__](https://docs.astral.sh/ty/) on every pull request as an informational check that does not block merges yet, so we encourage you to add [__Python type hints__](https://docs.python.org/3/library/typing.html) where `ty` recommends to do so.
187192

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

0 commit comments

Comments
 (0)