We welcome contributions from developers of all skill levels! Whether you're submitting a Python snippet, fixing bugs, improving documentation, or adding new features, your contributions make a big difference.
If you are a first-time contributor, see this guide on how to contribute to open source.
Please follow Code of Conduct in all your interactions with the project.
Ensure your code snippet follows these requirements:
- It is under 100 lines of code.
- It is well-commented and easy to understand.
- It provides something interesting - this could be a unique algorithm, a cool use case, or a clever trick in Python.
- It follows Python’s PEP 8 style guide to keep the code clean and readable.
Please follow the steps below to contribute. Remember to check if your idea is already implemented in our existing snippets.
Create a new issue. Add a short title that describes your code and a brief description.
At the top of the main repository page, click the "Fork" button.
In the following page, click "Create fork". This will create a copy of the repository in your GitHub account.
Clone your forked repository to your local machine with the following bash command:
git clone https://github.com/<your-github-name>/100LinesOfPythonCode.git
Navigate into the cloned directory:
cd 100LinesOfPythonCode
Create a new branch for your contribution:
git checkout -b <your-branch-name>
Replace <your-branch-name>
with something descriptive, like add-python-snippet
or fix-typo-in-docs
.
Create a new folder and give it a short name that describes your script. Name your file using a descriptive title of what the code does. For example:
snippets/fibonacci_sequence.py
Note: Do not use spaces in folder or file names; instead, use underscores (_
) to separate words.
Add your Python code file into your folder.
Add a README.md into that folder which explains your script and any prerequisites it may have.
Ensure your code works by running it locally. If you can, write test cases to validate its functionality.
After you've made your changes and tested your code, commit your work:
git add .
git commit -m "Add <description-of-your-code>"
git push origin <your-branch-name>
Go to your forked repository on GitHub and click the "Compare & pull request" button. In the pull request:
- Describe the changes you've made.
- Tag the issue you created.
- Reference discussions if necessary.
We will review your pull request, and once approved, it will be merged into the main repository.
If you find a bug, have a question, or would like to suggest a new feature, feel free to open an issue. Please include a detailed description so we can understand the problem or feature request.
Thank you for contributing!