| 1 |
Contributing to isort |
| 2 |
======== |
| 3 |
|
| 4 |
Looking for a useful open source project to contribute to? |
| 5 |
Want your contributions to be warmly welcomed and acknowledged? |
| 6 |
Welcome! You have found the right place. |
| 7 |
|
| 8 |
## Getting isort set up for local development |
| 9 |
The first step when contributing to any project is getting it set up on your local machine. isort aims to make this as simple as possible. |
| 10 |
|
| 11 |
Account Requirements: |
| 12 |
|
| 13 |
- [A valid GitHub account](https://github.com/join) |
| 14 |
|
| 15 |
Base System Requirements: |
| 16 |
|
| 17 |
- Python3.10+ |
| 18 |
- uv |
| 19 |
- bash or a bash compatible shell (should be auto-installed on Linux / Mac) |
| 20 |
- WSL users running Ubuntu may need to install Python's venv module even after installing Python. |
| 21 |
|
| 22 |
Once you have verified that your system matches the base requirements you can start to get the project working by following these steps: |
| 23 |
|
| 24 |
1. [Fork the project on GitHub](https://github.com/pycqa/isort/fork). |
| 25 |
2. Clone your fork to your local file system: |
| 26 |
`git clone https://github.com/$GITHUB_ACCOUNT/isort.git` |
| 27 |
3. `cd isort` |
| 28 |
4. `uv sync --all-extras --frozen` |
| 29 |
* Optionally, isolate uv's installation from the rest of your system using the instructions on the uv site here: https://docs.astral.sh/uv/ |
| 30 |
5. `./scripts/test.sh` should yield Success: no issues found |
| 31 |
6. `./scripts/clean.sh` should yield a report checking packages |
| 32 |
|
| 33 |
**TIP**: `./scripts/done.sh` will run both clean and test in one step. |
| 34 |
|
| 35 |
### Docker development |
| 36 |
|
| 37 |
If you would instead like to develop using Docker, the only local requirement is docker. |
| 38 |
See the [docker docs](https://docs.docker.com/get-started/) if you have not used docker before. |
| 39 |
|
| 40 |
Once you have the docker daemon running and have cloned the repository, you can get started by following these steps: |
| 41 |
|
| 42 |
1. `cd isort` |
| 43 |
2. `./scripts/docker.sh` |
| 44 |
|
| 45 |
A local test cycle might look like the following: |
| 46 |
|
| 47 |
1. `docker build ./ -t isort:latest` |
| 48 |
2. `docker run isort` |
| 49 |
3. if #2 fails, debug, save, and goto #1 |
| 50 |
* `docker run -it isort bash` will get you into the failed environment |
| 51 |
* `docker run -v $(git rev-parse --show-toplevel):/isort` will make changes made in the docker environment persist on your local checkout. |
| 52 |
**TIP**: combine both to get an interactive docker shell that loads changes made locally, even after build, to quickly rerun that pesky failing test |
| 53 |
4. `./scripts/docker.sh` |
| 54 |
5. if #4 fails, debug, save and goto #1; you may need to specify a different `--build-arg VERSION=$VER` |
| 55 |
6. congrats! you are probably ready to push a contribution |
| 56 |
|
| 57 |
## Making a contribution |
| 58 |
Congrats! You're now ready to make a contribution! Use the following as a guide to help you reach a successful pull-request: |
| 59 |
|
| 60 |
1. Check the [issues page](https://github.com/pycqa/isort/issues) on GitHub to see if the task you want to complete is listed there. |
| 61 |
- If it's listed there, write a comment letting others know you are working on it. |
| 62 |
- If it's not listed in GitHub issues, go ahead and log a new issue. Then add a comment letting everyone know you have it under control. |
| 63 |
- If you're not sure if it's something that is good for the main isort project and want immediate feedback, you can discuss it [here](https://github.com/PyCQA/isort/discussions). |
| 64 |
2. Create an issue branch for your local work `git checkout -b issue/$ISSUE-NUMBER`. |
| 65 |
3. Do your magic here. |
| 66 |
4. Ensure your code matches the [HOPE-8 Coding Standard](https://github.com/hugapi/HOPE/blob/master/all/HOPE-8--Style-Guide-for-Hug-Code.md#hope-8----style-guide-for-hug-code) used by the project. |
| 67 |
5. Run tests locally to make sure everything is still working |
| 68 |
`./scripts/done.sh` |
| 69 |
_Or if you are using Docker_ |
| 70 |
`docker run isort:latest` |
| 71 |
6. Submit a pull request to the main project repository via GitHub. |
| 72 |
|
| 73 |
Thanks for the contribution! It will quickly get reviewed, and, once accepted, will result in your name being added to the acknowledgments list :). |
| 74 |
|
| 75 |
## Thank you! |
| 76 |
I can not tell you how thankful I am for the hard work done by isort contributors like *you*. |
| 77 |
|
| 78 |
Thank you! |
| 79 |
|
| 80 |
~Timothy Crosley |
| 81 |
|