|
| 1 | +# Contributing |
| 2 | + |
| 3 | + |
| 4 | +Thanks for taking the time to contribute to `iso639-lang`! |
| 5 | + |
| 6 | +If you want to add or improve a feature, please create a GitHub issue to discuss your proposal before you submit a pull request. |
| 7 | + |
| 8 | + |
| 9 | +## Pull Request Guidelines |
| 10 | + |
| 11 | +- Keep your pull request focused on a single feature or change. |
| 12 | +- Include tests for any new features or changes. |
| 13 | +- Update the documentation if necessary. |
| 14 | +- Make sure all tests pass. |
| 15 | +- Ensure that your code follows the project's code style. |
| 16 | + |
| 17 | + |
| 18 | +## Creating a Development Environment |
| 19 | + |
| 20 | +Fork the repository. |
| 21 | + |
| 22 | +``` |
| 23 | +https://github.com/LBeaudoux/iso639/fork |
| 24 | +``` |
| 25 | + |
| 26 | +Clone the repository. |
| 27 | + |
| 28 | +```sh |
| 29 | +git clone https://github.com/your-username/iso639.git |
| 30 | +cd iso639 |
| 31 | +``` |
| 32 | + |
| 33 | +Create a virtual environment. |
| 34 | + |
| 35 | +```sh |
| 36 | +python3 -m venv env_iso639 |
| 37 | +source env_iso639/bin/activate |
| 38 | +``` |
| 39 | + |
| 40 | +Build and install `iso639-lang` in 'editable' mode. |
| 41 | + |
| 42 | +```sh |
| 43 | +pip install -e . |
| 44 | +pip install -r requirements-dev.txt |
| 45 | +``` |
| 46 | + |
| 47 | + |
| 48 | +## Running Tests |
| 49 | + |
| 50 | +```sh |
| 51 | +pytest tests dev_tests |
| 52 | +``` |
| 53 | + |
| 54 | +The main tests are located in `tests/`. They run faster and don't require access to the original ISO 639 data files located in `dev_iso639/downloads/`. |
| 55 | + |
| 56 | +The tests in `dev_tests` are slower because they check that the `iso639-lang` library is fully consistent with the official ISO 639 tables. |
| 57 | + |
| 58 | +Pushing changes to your forked repository should trigger a [workflow](https://github.com/LBeaudoux/iso639/actions/workflows/ci.yml) that tests your code across multiple operating systems and Python versions. |
| 59 | + |
| 60 | + |
| 61 | +## Running Code Style Checks |
| 62 | + |
| 63 | +```sh |
| 64 | +flake8 |
| 65 | +black --check . |
| 66 | +isort --check-only . |
| 67 | +``` |
| 68 | + |
| 69 | +`iso639-lang` uses `flake8` for linting, `black` for formatting and `isort` for sorting imports. The configuration of these tools is available in the `.flake8` and `pyproject.toml` files. |
| 70 | + |
| 71 | + |
| 72 | +## Submitting Changes |
| 73 | + |
| 74 | +Specify a new remote upstream repository to sync with the forked repository. |
| 75 | + |
| 76 | +```sh |
| 77 | +git remote add upstream https://github.com/LBeaudoux/iso639.git |
| 78 | +``` |
| 79 | + |
| 80 | +Check that your local repository has a remote link to both your forked repository (origin) and `LBeaudoux/iso639` (upstream). |
| 81 | + |
| 82 | +```sh |
| 83 | +git remote -v |
| 84 | +``` |
| 85 | + |
| 86 | +Make sure your local master branch is up to date. |
| 87 | + |
| 88 | +```sh |
| 89 | +git checkout master |
| 90 | +git pull upstream master |
| 91 | +``` |
| 92 | + |
| 93 | +Create a new branch for your changes. |
| 94 | + |
| 95 | +```sh |
| 96 | +git checkout -b new-branch-name |
| 97 | +``` |
| 98 | + |
| 99 | +Commit your changes with a clear and concise commit message. |
| 100 | + |
| 101 | +```sh |
| 102 | +git commit -m "Add a brief description of your changes" |
| 103 | +``` |
| 104 | + |
| 105 | +Push your changes to your forked repository. |
| 106 | + |
| 107 | +```sh |
| 108 | +git push origin new-branch-name |
| 109 | +``` |
| 110 | + |
| 111 | +Navigate to your forked repository and click on the 'New Pull Request' button. Select your branch and provide a description of your changes. |
| 112 | + |
0 commit comments