Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve Python version and OS compatibility, fixing deprecations#1654

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 17 commits intogitpython-developers:mainfromEliahKagan:setup
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
17 commits
Select commitHold shift + click to select a range
dba4245
Fix installation test for Python 3.12 and Windows
EliahKaganSep 9, 2023
72e48aa
Update installation instructions in readme
EliahKaganSep 10, 2023
b095aa9
Use more compatible hashbangs
EliahKaganSep 10, 2023
63c4624
Don't duplicate packages across requirements files
EliahKaganSep 10, 2023
3aacb37
Use a "test" extra instead of tests_require
EliahKaganSep 10, 2023
e1d8b40
Use "build" for building
EliahKaganSep 10, 2023
b9b6d8c
Ungroup and sort test_requirements.txt
EliahKaganSep 10, 2023
21c5f87
Don't preinstall dependencies in test_installation
EliahKaganSep 10, 2023
6b54890
Test changed setup, and Python 3.12, on CI
EliahKaganSep 10, 2023
055355d
Don't use "set -x" for "pytest" command on Cygwin
EliahKaganSep 10, 2023
a352404
List Python 3.12 as supported in setup.py
EliahKaganSep 10, 2023
415a8eb
Small clarity improvements in setup.py
EliahKaganSep 10, 2023
4eef3ec
Have actions/checkout do the full fetch
EliahKaganSep 11, 2023
5f128e8
Move effect of "set -x" into default shell command
EliahKaganSep 11, 2023
d99b2d4
prepare next release
ByronSep 11, 2023
f86f09e
Make publish process possible on MacOS
ByronSep 11, 2023
5343aa0
Let "make" install build and twine if in a virtual environment
EliahKaganSep 11, 2023
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
43 changes: 29 additions & 14 deletions.github/workflows/cygwin-test.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,38 +12,53 @@ jobs:
SHELLOPTS: igncr
TMP: "/tmp"
TEMP: "/tmp"
defaults:
run:
shell: bash.exe --noprofile --norc -exo pipefail -o igncr "{0}"

steps:
- name: Force LF line endings
run: git config --global core.autocrlf input

- uses: actions/checkout@v4
with:
fetch-depth: 9999
fetch-depth: 0
submodules: recursive

- uses: cygwin/cygwin-install-action@v4
with:
packages: python39 python39-pip python39-virtualenv git

- name: Show python and git versions
run: |
/usr/bin/python --version
/usr/bin/git version

- name: Tell git to trust this repo
shell: bash.exe -eo pipefail -o igncr "{0}"
run: |
/usr/bin/git config --global --add safe.directory "$(pwd)"
- name: Install dependencies and prepare tests
shell: bash.exe -eo pipefail -o igncr "{0}"
/usr/bin/git config --global --add safe.directory "$(pwd)"

- name: Prepare this repo for tests
run: |
set -x
/usr/bin/python -m pip install --upgrade pip setuptools wheel
/usr/bin/python --version; /usr/bin/git --version
/usr/bin/git submodule update --init --recursive
/usr/bin/git fetch --tags
/usr/bin/python -m pip install -r requirements.txt
/usr/bin/python -m pip install -r test-requirements.txt
TRAVIS=yes ./init-tests-after-clone.sh

- name: Further prepare git configuration for tests
run: |
/usr/bin/git config --global user.email "travis@ci.com"
/usr/bin/git config --global user.name "Travis Runner"
# If we rewrite the user's config by accident, we will mess it up
# and cause subsequent tests to fail
cat test/fixtures/.gitconfig >> ~/.gitconfig

- name: Update PyPA packages
run: |
/usr/bin/python -m pip install --upgrade pip setuptools wheel

- name: Install project and test dependencies
run: |
/usr/bin/python -m pip install ".[test]"

- name: Test with pytest
shell: bash.exe -eo pipefail -o igncr "{0}"
run: |
set +x
/usr/bin/python -m pytest
continue-on-error: false
53 changes: 36 additions & 17 deletions.github/workflows/pythonpackage.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,51 +15,70 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- experimental: false
- python-version: "3.12"
experimental: true
defaults:
run:
shell: /bin/bash --noprofile --norc -exo pipefail {0}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 9999
fetch-depth: 0
submodules: recursive

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies and prepare tests
run: |
set -x
allow-prereleases: ${{ matrix.experimental }}

python-m pip install --upgrade pip setuptools wheel
python --version; git --version
git submodule update --init --recursive
gitfetch --tags --force
- name: Showpythonand git versions
run: |
python --version
gitversion

pip install -r requirements.txt
pip install -r test-requirements.txt
- name: Prepare this repo for tests
run: |
TRAVIS=yes ./init-tests-after-clone.sh

- name: Prepare git configuration for tests
run: |
git config --global user.email "travis@ci.com"
git config --global user.name "Travis Runner"
# If we rewrite the user's config by accident, we will mess it up
# and cause subsequent tests to fail
cat test/fixtures/.gitconfig >> ~/.gitconfig

- name: Update PyPA packages
run: |
python -m pip install --upgrade pip
if pip freeze --all | grep --quiet '^setuptools=='; then
# Python prior to 3.12 ships setuptools. Upgrade it if present.
python -m pip install --upgrade setuptools
fi
python -m pip install --upgrade wheel

- name: Install project and test dependencies
run: |
pip install ".[test]"

- name: Check types with mypy
# With new versions of pypi new issues might arise. This is a problem if there is nobody able to fix them,
# so we have to ignore errors until that changes.
continue-on-error: true
run: |
set -x
mypy -p git
# With new versions of mypy new issues might arise. This is a problem if there is nobody able to fix them,
# so we have to ignore errors until that changes.
continue-on-error: true

- name: Test with pytest
run: |
set -x
pytest
continue-on-error: false

- name: Documentation
run: |
set -x
pip install -r doc/requirements.txt
make -C doc html
6 changes: 4 additions & 2 deletionsMakefile
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,6 +15,8 @@ release: clean
make force_release

force_release: clean
git push --tags origin main
python3 setup.py sdist bdist_wheel
# IF we're in a virtual environment, add build tools
test -z "$$VIRTUAL_ENV" || pip install -U build twine
python3 -m build --sdist --wheel
twine upload dist/*
git push --tags origin main
98 changes: 75 additions & 23 deletionsREADME.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -49,30 +49,51 @@ The installer takes care of installing them for you.

### INSTALL

If you have downloadedthesource code:
GitPython and its required package dependencies can be installed in any ofthefollowing ways, all of which should typically be done in a [virtual environment](https://docs.python.org/3/tutorial/venv.html).

```bash
python setup.py install
```
#### From PyPI

or if you want to obtaina copy fromthe Pypi repository:
To obtain and installa copy[fromPyPI](https://pypi.org/project/GitPython/), run:

```bash
pip install GitPython
```

Both commands will install the required package dependencies.
(A distribution package can also be downloaded for manual installation at [the PyPI page](https://pypi.org/project/GitPython/).)

#### From downloaded source code

If you have downloaded the source code, run this from inside the unpacked `GitPython` directory:

```bash
pip install .
```

A distribution package can be obtained for manual installation at: <http://pypi.python.org/pypi/GitPython>.
#### By cloning the source code repository

If you like to clonefrom source, you can do it like so:
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:

```bash
git clone https://github.com/gitpython-developers/GitPython
git submodule update --init --recursive
cd GitPython
git fetch --tags
./init-tests-after-clone.sh
```

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`):

```bash
gh repo clone GitPython
```

Having cloned the repo, create and activate your [virtual environment](https://docs.python.org/3/tutorial/venv.html). Then make an [editable install](https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs):

```bash
pip install -e ".[test]"
```

In the less common case that you do not want to install test dependencies, `pip install -e .` can be used instead.

### Limitations

#### Leakage of System Resources
Expand DownExpand Up@@ -101,20 +122,49 @@ On _Windows_, make sure you have `git-daemon` in your PATH. For MINGW-git, the `
exists in `Git\mingw64\libexec\git-core\`; CYGWIN has no daemon, but should get along fine
with MINGW's.

Ensure testing libraries are installed.
In the root directory, run: `pip install -r test-requirements.txt`
#### Install test dependencies

To lint, run: `pre-commit run --all-files`
Ensure testing libraries are installed. This is taken care of already if you installed with:

To typecheck, run: `mypy -p git`
```bash
pip install -e ".[test]"
```

To test,run: `pytest`
Otherwise, you canrun:

For automatic code formatting run: `black git`
```bash
pip install -r test-requirements.txt
```

#### Test commands

To test, run:

```bash
pytest
```

To lint, run:

```bash
pre-commit run --all-files
```

To typecheck, run:

```bash
mypy -p git
```

For automatic code formatting, run:

```bash
black git
```

Configuration for flake8 is in the ./.flake8 file.
Configuration for flake8 is in the`./.flake8` file.

Configurations for mypy,pytest andcoverage.pyare in ./pyproject.toml.
Configurations for`mypy`, `pytest`, `coverage.py`, and `black`are in`./pyproject.toml`.

The same linting and testing will also be performed against different supported python versions
upon submitting a pull request (or on each push if you have a fork with a "main" branch and actions enabled).
Expand All@@ -138,13 +188,15 @@ Please have a look at the [contributions file][contributing].

### How to make a new release

- Update/verify the **version** in the `VERSION` file
- Update/verify that the `doc/source/changes.rst` changelog file was updated
- Commit everything
- Run `git tag -s <version>` to tag the version in Git
- Run `make release`
- Update/verify the **version** in the `VERSION` file.
- Update/verify that the `doc/source/changes.rst` changelog file was updated.
- Commit everything.
- Run `git tag -s <version>` to tag the version in Git.
- _Optionally_ create and activate a [virtual environment](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment) using `venv` or `virtualenv`.\
(When run in a virtual environment, the next step will automatically take care of installing `build` and `twine` in it.)
- Run `make release`.
- Close the milestone mentioned in the _changelog_ and create a new one. _Do not reuse milestones by renaming them_.
-Got to [GitHub Releases](https://github.com/gitpython-developers/GitPython/releases) and publish a new one with the recently pushed tag. Generate the changelog.
-Go to [GitHub Releases](https://github.com/gitpython-developers/GitPython/releases) and publish a new one with the recently pushed tag. Generate the changelog.

### How to verify a release (DEPRECATED)

Expand Down
2 changes: 1 addition & 1 deletionVERSION
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
3.1.35
3.1.36
8 changes: 8 additions & 0 deletionsdoc/source/changes.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,14 @@
Changelog
=========

3.1.36
======

Note that this release should be a no-op, it's mainly for testing the changed release-process.

See the following for all changes.
https://github.com/gitpython-developers/gitpython/milestone/66?closed=1

3.1.35
======

Expand Down
8 changes: 5 additions & 3 deletionsinit-tests-after-clone.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
#!/bin/bash -e
#!/usr/bin/env bash

set -e

if [[ -z "$TRAVIS" ]]; then
read -p "This operation will destroy locally modified files. Continue ? [N/y]: " answer
read -rp "This operation will destroy locally modified files. Continue ? [N/y]: " answer
if [[ ! $answer =~ [yY] ]]; then
exit 2
fi
Expand All@@ -13,4 +15,4 @@ git reset --hard HEAD~1
git reset --hard HEAD~1
git reset --hard HEAD~1
git reset --hard __testing_point__
git submodule update --init --recursive
git submodule update --init --recursive
2 changes: 1 addition & 1 deletionpyproject.toml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools", "wheel"]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
Expand Down
1 change: 0 additions & 1 deletionrequirements-dev.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,6 @@
# libraries for additional local testing/linting - to be added to test-requirements.txt when all pass

flake8-type-checking;python_version>="3.8" # checks for TYPE_CHECKING only imports
black

pytest-icdiff
# pytest-profiling
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp