Skip to content

Create CONTRIBUTING.md #864

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

Merged
merged 3 commits into from
Jun 2, 2019
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
124 changes: 124 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Contributing guidelines

## Before contributing

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).

## Contributing

### Contributor

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:

- your did your work - no plagiarism allowed
- Any plagiarized work will not be merged.
- your work will be distributed under [MIT License](License) once your pull request is merged
- you submitted work fulfils or mostly fulfils our styles and standards

**New implementation** is welcome! For example, new solutions for a problem, different representations for a graph data structure or algorithm designs with different complexity.

**Improving comments** and **writing proper tests** are also highly welcome.

### Contribution

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.

#### Coding Style

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

- Please write in Python 3.x.

- 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!

- Always use 4 spaces to indent.

- Original code submission requires comments to describe your work.

- More on comments and docstrings:

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

```python
x = x + 2 # increased by 2
```

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.

*Sometimes, docstrings are avoided.* This will happen if you are using some editors and not careful with indentation:

```python
"""
This function sums a and b
"""
def sum(a, b):
return a + b
```

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:

```python
def sumab(a, b):
"""
This function sums two integers a and b
Return: a + b
"""
return a + b
```

- `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.

- This is arguable: **write comments** and assign appropriate variable names, so that the code is easy to read!

- Write tests to illustrate your work.

The following "testing" approaches are not encouraged:

```python
input('Enter your input:')
# Or even worse...
input = eval(raw_input("Enter your input: "))
```

Please write down your test case, like the following:

```python
def sumab(a, b):
return a + b
# Write tests this way:
print(sumab(1,2)) # 1+2 = 3
print(sumab(6,4)) # 6+4 = 10
# Or this way:
print("1 + 2 = ", sumab(1,2)) # 1+2 = 3
print("6 + 4 = ", sumab(6,4)) # 6+4 = 10
```

- Avoid importing external libraries for basic algorithms. Use those libraries for complicated algorithms.

#### Other Standard While Submitting Your Work

- File extension for code should be `.py`.

- Please file your work to let others use it in the future. Here are the examples that are acceptable:

- Camel cases
- `-` Hyphenated names
- `_` Underscore-separated names

If possible, follow the standard *within* the folder you are submitting to.

- If you have modified/added code work, make sure the code compiles before submitting.

- If you have modified/added documentation work, make sure your language is concise and contains no grammar mistake.

- Add a corresponding explanation to [Algorithms-Explanation](https://github.com/TheAlgorithms/Algorithms-Explanation) (Optional but recommended).

- Most importantly,

- **be consistent with this guidelines while submitting.**
- **join** [Gitter](https://gitter.im/TheAlgorithms) **now!**
- Happy coding!



Writer [@poyea](https://github.com/poyea), Jun 2019.
File renamed without changes.
15 changes: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
# The Algorithms - Python <!-- [![Build Status](https://travis-ci.org/TheAlgorithms/Python.svg)](https://travis-ci.org/TheAlgorithms/Python) -->
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/TheAlgorithms/100) &nbsp;
[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/TheAlgorithms)

[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/TheAlgorithms) &nbsp;
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/TheAlgorithms/Python)

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

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

Run, edit and contribute using Gitpod.io a free online dev environment.

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/TheAlgorithms/Python)

## Contribution Guidelines

* File name should be in camel case.
* Write proper documentation of the code.
* 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.
* Add a corresponding explaination to [Algorithms-Explanation](https://github.com/TheAlgorithms/Algorithms-Explanation) (Optional but recommended).
* Avoid importing external libraries for basic algorithms.
Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute.

## Community Channel

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