| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,5 +16,3 @@ jobs: | |||
| 16 | 16 | - uses: pre-commit/action@v3.0.1 | |
| 17 | 17 | with: | |
| 18 | 18 | extra_args: --all-files --hook-stage manual | |
| 19 | - env: | ||
| 20 | - SKIP: black-format | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,27 +1,12 @@ | |||
| 1 | 1 | repos: | |
| 2 | - - repo: https://github.com/psf/black-pre-commit-mirror | ||
| 3 | - rev: 23.9.1 | ||
| 4 | - hooks: | ||
| 5 | - - id: black | ||
| 6 | - alias: black-check | ||
| 7 | - name: black (check) | ||
| 8 | - args: [--check, --diff] | ||
| 9 | - exclude: ^git/ext/ | ||
| 10 | - stages: [manual] | ||
| 11 | 2 | ||
| 12 | - - id: black | ||
| 13 | - alias: black-format | ||
| 14 | - name: black (format) | ||
| 15 | - exclude: ^git/ext/ | ||
| 16 | - | ||
| 17 | - - repo: https://github.com/PyCQA/flake8 | ||
| 18 | - rev: 6.1.0 | ||
| 3 | + - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| 4 | + rev: v0.3.0 | ||
| 19 | 5 | hooks: | |
| 20 | - - id: flake8 | ||
| 21 | - additional_dependencies: | ||
| 22 | - - flake8-bugbear==23.9.16 | ||
| 23 | - - flake8-comprehensions==3.14.0 | ||
| 24 | - - flake8-typing-imports==1.14.0 | ||
| 6 | + - id: ruff-format | ||
| 7 | + exclude: ^git/ext/ | ||
| 8 | + - id: ruff | ||
| 9 | + args: ["--fix"] | ||
| 25 | 10 | exclude: ^doc|^git/ext/ | |
| 26 | 11 | ||
| 27 | 12 | - repo: https://github.com/shellcheck-py/shellcheck-py | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,11 +1,8 @@ | |||
| 1 | - .PHONY: all lint clean release force_release | ||
| 1 | + .PHONY: all clean release force_release | ||
| 2 | 2 | ||
| 3 | 3 | all: | |
| 4 | 4 | @awk -F: '/^[[:alpha:]].*:/ && !/^all:/ {print $$1}' Makefile | |
| 5 | 5 | ||
| 6 | - lint: | ||
| 7 | - SKIP=black-format pre-commit run --all-files --hook-stage manual | ||
| 8 | - | ||
| 9 | 6 | clean: | |
| 10 | 7 | rm -rf build/ dist/ .eggs/ .tox/ | |
| 11 | 8 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,7 @@ probably the skills to scratch that itch of mine: implement `git` in a way that | |||
| 17 | 17 | If you like the idea and want to learn more, please head over to [gitoxide](https://github.com/Byron/gitoxide), an | |
| 18 | 18 | implementation of 'git' in [Rust](https://www.rust-lang.org). | |
| 19 | 19 | ||
| 20 | - *(Please note that `gitoxide` is not currently available for use in Python, and that Rust is required)* | ||
| 20 | + *(Please note that `gitoxide` is not currently available for use in Python, and that Rust is required.)* | ||
| 21 | 21 | ||
| 22 | 22 | ## GitPython | |
| 23 | 23 | ||
@@ -39,9 +39,9 @@ The project is open to contributions of all kinds, as well as new maintainers. | |||
| 39 | 39 | ||
| 40 | 40 | ### REQUIREMENTS | |
| 41 | 41 | ||
| 42 | - GitPython needs the `git` executable to be installed on the system and available in your `PATH` for most operations. | ||
| 43 | - If it is not in your `PATH`, you can help GitPython find it by setting | ||
| 44 | - the `GIT_PYTHON_GIT_EXECUTABLE=<path/to/git>` environment variable. | ||
| 42 | + GitPython needs the `git` executable to be installed on the system and available in your | ||
| 43 | + `PATH` for most operations. If it is not in your `PATH`, you can help GitPython find it | ||
| 44 | + by setting the `GIT_PYTHON_GIT_EXECUTABLE=<path/to/git>` environment variable. | ||
| 45 | 45 | ||
| 46 | 46 | - Git (1.7.x or newer) | |
| 47 | 47 | - Python >= 3.7 | |
@@ -57,7 +57,7 @@ GitPython and its required package dependencies can be installed in any of the f | |||
| 57 | 57 | ||
| 58 | 58 | To obtain and install a copy [from PyPI](https://pypi.org/project/GitPython/), run: | |
| 59 | 59 | ||
| 60 | - ```bash | ||
| 60 | + ```sh | ||
| 61 | 61 | pip install GitPython | |
| 62 | 62 | ``` | |
| 63 | 63 | ||
@@ -67,15 +67,15 @@ pip install GitPython | |||
| 67 | 67 | ||
| 68 | 68 | If you have downloaded the source code, run this from inside the unpacked `GitPython` directory: | |
| 69 | 69 | ||
| 70 | - ```bash | ||
| 70 | + ```sh | ||
| 71 | 71 | pip install . | |
| 72 | 72 | ``` | |
| 73 | 73 | ||
| 74 | 74 | #### By cloning the source code repository | |
| 75 | 75 | ||
| 76 | 76 | To clone the [the GitHub repository](https://github.com/gitpython-developers/GitPython) from source to work on the code, you can do it like so: | |
| 77 | 77 | ||
| 78 | - ```bash | ||
| 78 | + ```sh | ||
| 79 | 79 | git clone https://github.com/gitpython-developers/GitPython | |
| 80 | 80 | cd GitPython | |
| 81 | 81 | ./init-tests-after-clone.sh | |
@@ -85,15 +85,15 @@ On Windows, `./init-tests-after-clone.sh` can be run in a Git Bash shell. | |||
| 85 | 85 | ||
| 86 | 86 | If you are cloning [your own fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks), then replace the above `git clone` command with one that gives the URL of your fork. Or use this [`gh`](https://cli.github.com/) command (assuming you have `gh` and your fork is called `GitPython`): | |
| 87 | 87 | ||
| 88 | - ```bash | ||
| 88 | + ```sh | ||
| 89 | 89 | gh repo clone GitPython | |
| 90 | 90 | ``` | |
| 91 | 91 | ||
| 92 | 92 | Having cloned the repo, create and activate your [virtual environment](https://docs.python.org/3/tutorial/venv.html). | |
| 93 | 93 | ||
| 94 | 94 | Then make an [editable install](https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs): | |
| 95 | 95 | ||
| 96 | - ```bash | ||
| 96 | + ```sh | ||
| 97 | 97 | pip install -e ".[test]" | |
| 98 | 98 | ``` | |
| 99 | 99 | ||
@@ -105,7 +105,7 @@ In rare cases, you may want to work on GitPython and one or both of its [gitdb]( | |||
| 105 | 105 | ||
| 106 | 106 | If you want to do that *and* you want the versions in GitPython's git submodules to be used, then pass `-e git/ext/gitdb` and/or `-e git/ext/gitdb/gitdb/ext/smmap` to `pip install`. This can be done in any order, and in separate `pip install` commands or the same one, so long as `-e` appears before *each* path. For example, you can install GitPython, gitdb, and smmap editably in the currently active virtual environment this way: | |
| 107 | 107 | ||
| 108 | - ```bash | ||
| 108 | + ```sh | ||
| 109 | 109 | pip install -e ".[test]" -e git/ext/gitdb -e git/ext/gitdb/gitdb/ext/smmap | |
| 110 | 110 | ``` | |
| 111 | 111 | ||
@@ -141,53 +141,51 @@ you will encounter test failures. | |||
| 141 | 141 | ||
| 142 | 142 | Ensure testing libraries are installed. This is taken care of already if you installed with: | |
| 143 | 143 | ||
| 144 | - ```bash | ||
| 144 | + ```sh | ||
| 145 | 145 | pip install -e ".[test]" | |
| 146 | 146 | ``` | |
| 147 | 147 | ||
| 148 | - Otherwise, you can run: | ||
| 149 | - | ||
| 150 | - ```bash | ||
| 151 | - pip install -r test-requirements.txt | ||
| 152 | - ``` | ||
| 148 | + If you had installed with a command like `pip install -e .` instead, you can still run | ||
| 149 | + the above command to add the testing dependencies. | ||
| 153 | 150 | ||
| 154 | 151 | #### Test commands | |
| 155 | 152 | ||
| 156 | 153 | To test, run: | |
| 157 | 154 | ||
| 158 | - ```bash | ||
| 155 | + ```sh | ||
| 159 | 156 | pytest | |
| 160 | 157 | ``` | |
| 161 | 158 | ||
| 162 | - To lint, and apply automatic code formatting, run: | ||
| 159 | + To lint, and apply some linting fixes as well as automatic code formatting, run: | ||
| 163 | 160 | ||
| 164 | - ```bash | ||
| 161 | + ```sh | ||
| 165 | 162 | pre-commit run --all-files | |
| 166 | 163 | ``` | |
| 167 | 164 | ||
| 168 | - - Linting without modifying code can be done with: `make lint` | ||
| 169 | - - Auto-formatting without other lint checks can be done with: `black .` | ||
| 165 | + This includes the linting and autoformatting done by Ruff, as well as some other checks. | ||
| 170 | 166 | ||
| 171 | 167 | To typecheck, run: | |
| 172 | 168 | ||
| 173 | - ```bash | ||
| 169 | + ```sh | ||
| 174 | 170 | mypy -p git | |
| 175 | 171 | ``` | |
| 176 | 172 | ||
| 177 | 173 | #### CI (and tox) | |
| 178 | 174 | ||
| 179 | - The same linting, and running tests on all the different supported Python versions, will be performed: | ||
| 175 | + Style and formatting checks, and running tests on all the different supported Python versions, will be performed: | ||
| 180 | 176 | ||
| 181 | 177 | - Upon submitting a pull request. | |
| 182 | 178 | - On each push, *if* you have a fork with GitHub Actions enabled. | |
| 183 | 179 | - Locally, if you run [`tox`](https://tox.wiki/) (this skips any Python versions you don't have installed). | |
| 184 | 180 | ||
| 185 | 181 | #### Configuration files | |
| 186 | 182 | ||
| 187 | - Specific tools: | ||
| 183 | + Specific tools are all configured in the `./pyproject.toml` file: | ||
| 188 | 184 | ||
| 189 | - - Configurations for `mypy`, `pytest`, `coverage.py`, and `black` are in `./pyproject.toml`. | ||
| 190 | - - Configuration for `flake8` is in the `./.flake8` file. | ||
| 185 | + - `pytest` (test runner) | ||
| 186 | + - `coverage.py` (code coverage) | ||
| 187 | + - `ruff` (linter and formatter) | ||
| 188 | + - `mypy` (type checker) | ||
| 191 | 189 | ||
| 192 | 190 | Orchestration tools: | |
| 193 | 191 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments