Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
408 views
in Technique[技术] by (71.8m points)

Using Python pre-commit with a local server

I am using a python package called pre-commit to standardize the git workflow for my team.

I am having some issues setting up a pre-commit hooks with this package https://github.com/pre-commit/mirrors-mypy due to company proxy with github.

I decided to download the package and upload it to our local bitbuket server and setup pre commit for it to use as a local repo.

Here's my .pre-commit-config.yaml file

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
-   repo: http://localserver/scm/~username/local_mypy.git
    rev: '03f936cbf67'
    hooks:
    -   id: mypy

I then ran pre-commit install and in the my git bash I did

git commit -a -m"let's see if pre-commit works"

But the result I get is

[INFO] Installing environment for http://localserver/scm/~username/local_mypy.git.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('H:\.cache\pre-commit\repo3yl4ty_p\py_env-python3.6\Scripts\python.EXE', '-mpip', 'install', '.')
return code: 1
expected return code: 0
stdout:
    Processing h:.cachepre-commit
epo3yl4ty_p
    Could not fetch URL https://pypi.org/simple/mypy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/mypy/ (Caused by SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:833)'),)) - skipping

stderr:
    WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:833)'),)': /simple/mypy/
    WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:833)'),)': /simple/mypy/
    WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:833)'),)': /simple/mypy/
    WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:833)'),)': /simple/mypy/
    WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:833)'),)': /simple/mypy/
    ERROR: Could not find a version that satisfies the requirement mypy==0.800 (from pre-commit-dummy-package)
    ERROR: No matching distribution found for mypy==0.800

Check the log at H:.cachepre-commitpre-commit.log
question from:https://stackoverflow.com/questions/66053557/using-python-pre-commit-with-a-local-server

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...