Skip to content

Commit c2552cd

Browse files
poyeayanglbme
authored andcommitted
Create CONTRIBUTING.md (TheAlgorithms#864)
* Create CONTRIBUTING.md * Create a tailor-made contribution guide Closes TheAlgorithms#802 * Update README.md * Rename License to LICENSE.md
1 parent f386fce commit c2552cd

File tree

3 files changed

+128
-11
lines changed

3 files changed

+128
-11
lines changed

CONTRIBUTING.md

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Contributing guidelines
2+
3+
## Before contributing
4+
5+
Welcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Python)! Before sending your pull requests, make sure that you **read the whole guidelines**. If you have any doubt on the contributing guide, please feel free to [state it clearly in an issue](https://github.com/TheAlgorithms/Python/issues/new) or ask the community in [Gitter](https://gitter.im/TheAlgorithms).
6+
7+
## Contributing
8+
9+
### Contributor
10+
11+
We are very happy that you consider implementing algorithms and data structure for others! This repository is referenced and used by learners from all over the globe. Being one of our contributors, you agree and confirm that:
12+
13+
- your did your work - no plagiarism allowed
14+
- Any plagiarized work will not be merged.
15+
- your work will be distributed under [MIT License](License) once your pull request is merged
16+
- you submitted work fulfils or mostly fulfils our styles and standards
17+
18+
**New implementation** is welcome! For example, new solutions for a problem, different representations for a graph data structure or algorithm designs with different complexity.
19+
20+
**Improving comments** and **writing proper tests** are also highly welcome.
21+
22+
### Contribution
23+
24+
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.
25+
26+
#### Coding Style
27+
28+
We want your work to be readable by others; therefore, we encourage you to note the following:
29+
30+
- Please write in Python 3.x.
31+
32+
- If you know [PEP 8](https://www.python.org/dev/peps/pep-0008/) already, you will have no problem in coding style, though we do not follow it strictly. Read the remaining section and have fun coding!
33+
34+
- Always use 4 spaces to indent.
35+
36+
- Original code submission requires comments to describe your work.
37+
38+
- More on comments and docstrings:
39+
40+
The following are considered to be bad and may be requested to be improved:
41+
42+
```python
43+
x = x + 2 # increased by 2
44+
```
45+
46+
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.
47+
48+
*Sometimes, docstrings are avoided.* This will happen if you are using some editors and not careful with indentation:
49+
50+
```python
51+
"""
52+
This function sums a and b
53+
"""
54+
def sum(a, b):
55+
return a + b
56+
```
57+
58+
However, if you insist to use docstrings, we encourage you to put docstrings inside functions. Also, please pay attention to indentation to docstrings. The following is acceptable in this case:
59+
60+
```python
61+
def sumab(a, b):
62+
"""
63+
This function sums two integers a and b
64+
Return: a + b
65+
"""
66+
return a + b
67+
```
68+
69+
- `lambda`, `map`, `filter`, `reduce` and complicated list comprehension are welcome and acceptable to demonstrate the power of Python, as long as they are simple enough to read.
70+
71+
- This is arguable: **write comments** and assign appropriate variable names, so that the code is easy to read!
72+
73+
- Write tests to illustrate your work.
74+
75+
The following "testing" approaches are not encouraged:
76+
77+
```python
78+
input('Enter your input:')
79+
# Or even worse...
80+
input = eval(raw_input("Enter your input: "))
81+
```
82+
83+
Please write down your test case, like the following:
84+
85+
```python
86+
def sumab(a, b):
87+
return a + b
88+
# Write tests this way:
89+
print(sumab(1,2)) # 1+2 = 3
90+
print(sumab(6,4)) # 6+4 = 10
91+
# Or this way:
92+
print("1 + 2 = ", sumab(1,2)) # 1+2 = 3
93+
print("6 + 4 = ", sumab(6,4)) # 6+4 = 10
94+
```
95+
96+
- Avoid importing external libraries for basic algorithms. Use those libraries for complicated algorithms.
97+
98+
#### Other Standard While Submitting Your Work
99+
100+
- File extension for code should be `.py`.
101+
102+
- Please file your work to let others use it in the future. Here are the examples that are acceptable:
103+
104+
- Camel cases
105+
- `-` Hyphenated names
106+
- `_` Underscore-separated names
107+
108+
If possible, follow the standard *within* the folder you are submitting to.
109+
110+
- If you have modified/added code work, make sure the code compiles before submitting.
111+
112+
- If you have modified/added documentation work, make sure your language is concise and contains no grammar mistake.
113+
114+
- Add a corresponding explanation to [Algorithms-Explanation](https://github.com/TheAlgorithms/Algorithms-Explanation) (Optional but recommended).
115+
116+
- Most importantly,
117+
118+
- **be consistent with this guidelines while submitting.**
119+
- **join** [Gitter](https://gitter.im/TheAlgorithms) **now!**
120+
- Happy coding!
121+
122+
123+
124+
Writer [@poyea](https://github.com/poyea), Jun 2019.

License renamed to LICENSE.md

File renamed without changes.

README.md

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
# The Algorithms - Python <!-- [![Build Status](https://travis-ci.org/TheAlgorithms/Python.svg)](https://travis-ci.org/TheAlgorithms/Python) -->
22
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/TheAlgorithms/100) &nbsp;
3-
[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/TheAlgorithms)
4-
3+
[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/TheAlgorithms) &nbsp;
4+
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/TheAlgorithms/Python)
55

66
### All algorithms implemented in Python (for education)
77

88
These implementations are for learning purposes. They may be less efficient than the implementations in the Python standard library.
99

10-
Run, edit and contribute using Gitpod.io a free online dev environment.
11-
12-
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/TheAlgorithms/Python)
1310

1411
## Contribution Guidelines
1512

16-
* File name should be in camel case.
17-
* Write proper documentation of the code.
18-
* Avoid input methods as far as possible. Assign values to the variables statically. This will make the code easy to understand and algorithm can be traced easily.
19-
* Add a corresponding explaination to [Algorithms-Explanation](https://github.com/TheAlgorithms/Algorithms-Explanation) (Optional but recommended).
20-
* Avoid importing external libraries for basic algorithms.
13+
Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute.
2114

2215
## Community Channel
2316

24-
https://gitter.im/TheAlgorithms
17+
We're on [Gitter](https://gitter.im/TheAlgorithms)! Please join us.

0 commit comments

Comments
 (0)