Skip to content

Add support for Python 3.7 #793

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 21, 2018
Merged

Conversation

michael-k
Copy link
Contributor

No description provided.

@codecov-io
Copy link

codecov-io commented Sep 10, 2018

Codecov Report

Merging #793 into master will decrease coverage by 0.03%.
The diff coverage is 69.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #793      +/-   ##
==========================================
- Coverage   94.71%   94.67%   -0.04%     
==========================================
  Files          59       59              
  Lines        9371     9378       +7     
==========================================
+ Hits         8876     8879       +3     
- Misses        495      499       +4
Impacted Files Coverage Δ
git/objects/submodule/base.py 94.35% <100%> (ø) ⬆️
git/repo/base.py 95.4% <66.66%> (-0.81%) ⬇️
git/test/test_repo.py 97.89% <0%> (-0.01%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a1634dc...bf00902. Read the comment docs.

@michael-k
Copy link
Contributor Author

michael-k commented Sep 10, 2018

Turns out that despite tests running against 3.7-dev (and nightly, which is actually just 3.7.0a4+), GitPython is not compatible with Python 3.7. The reason is PEP 479 which was released as part of Python 3.7.

@michael-k michael-k changed the title Document support for Python 3.7 Add support for Python 3.7 Sep 10, 2018
@Byron
Copy link
Member

Byron commented Oct 13, 2018

@michael-k Thanks for your efforts! Does that mean this PR should be closed as per your last comment? Or is it something that can be fixed, without breaking backward compatibility? Thank you.

@michael-k
Copy link
Contributor Author

@Byron Commit d6d89ad, the second one of the two included in this PR, should fix the mentioned problem in a backwards compatible way.

GitPython uses raise StopIteration inside generators directly or indirectly (calling next without handling the exception) to stop them. As PEP 479 this was never the right thing to do and Python 3.7 does no longer support this.

Most projects that run their test suite against Python 3.7-dev (aka 3.7.0a4) on travis are also compatible with Python 3.7. There are a few examples and this project is one of them. This is what my comment was about. See https://travis-ci.com/michael-k/GitPython/builds/84335704 which ran the test suite against Python 3.7 and https://travis-ci.com/michael-k/GitPython/builds/84338644 which did the same thing, but without using StopIteration.

However I missed that nightly also needs an update. I've fixed that and rebased.

@AnneTheAgile
Copy link

@michael-k but the CI job on the latest commit said it failed for two pythons. Did you see that?
For example py2.7 first failure is;
https://ci.appveyor.com/project/Byron/gitpython/builds/19502926/job/riw6uo91dbk292fh

ERROR: test_init (git.test.test_repo.TestRepo)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\gitpython\git\test\test_repo.py", line 267, in test_init
    rc = r.clone(clone_path)
  File "C:\projects\gitpython\git\repo\base.py", line 982, in clone
    return self._clone(self.git, self.common_dir, path, type(self.odb), progress, **kwargs)
  File "C:\projects\gitpython\git\repo\base.py", line 948, in _clone
    finalize_process(proc, stderr=stderr)
  File "C:\projects\gitpython\git\util.py", line 333, in finalize_process
    proc.wait(**kwargs)
  File "C:\projects\gitpython\git\cmd.py", line 415, in wait
    raise GitCommandError(self.args, status, errstr)
GitCommandError: Cmd('C:\cygwin\bin\git.exe') failed due to: exit code(128)
  cmdline: C:\cygwin\bin\git.exe clone -v /cygdrive/c/users/appveyor/appdata/local/temp/1/repos/foo/bar.git c:\users\appveyor\appdata\local\temp\1\repos\foo\bar.git_clone
  stderr: 'Cloning into 'c:\users\appveyor\appdata\local\temp\1\repos\foo\bar.git_clone'...
fatal: Invalid path '/cygdrive/c/users/appveyor/appdata/local/temp/1/repos/foo/bar.git/c:\users\appveyor\appdata\local\temp\1\repos\foo\bar.git_clone': No such file or directory

I'm not quite sure what's up with that.

@michael-k
Copy link
Contributor Author

@AnneTheAgile yeah, but is this related to this PR? They are also failing on master and the log looks similar enough to me. (I didn't compare the logs in detail.)

It looks like not a single test run of master on AppVeyor was successful.

@Byron Byron merged commit 6e4239c into gitpython-developers:master Oct 21, 2018
@Byron
Copy link
Member

Byron commented Oct 21, 2018

There we go! Thanks a lot, @michael-k , now that Travis is back I am happy to see GitPython became a little more compatible to the new ways of python 3.7!

@michael-k michael-k deleted the python3.7 branch October 29, 2018 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants