-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: maintain Python package too (#845)
* feat: add python package * fix: update version in setup.py * ci: add missing readme and license for Python package * fix: support aarch64 platform value for Python * ci: publish to PyPI
- Loading branch information
Showing
10 changed files
with
191 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2019 Arkweid | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
![Build Status](https://github.com/evilmartians/lefthook/actions/workflows/test.yml/badge.svg?branch=master) | ||
[![Coverage Status](https://coveralls.io/repos/github/evilmartians/lefthook/badge.svg?branch=master)](https://coveralls.io/github/evilmartians/lefthook?branch=master) | ||
|
||
# Lefthook | ||
|
||
> The fastest polyglot Git hooks manager out there | ||
<img align="right" width="147" height="100" title="Lefthook logo" | ||
src="https://raw.githubusercontent.com/evilmartians/lefthook/refs/heads/master/logo_sign.svg"> | ||
|
||
A Git hooks manager for Node.js, Ruby and many other types of projects. | ||
|
||
* **Fast.** It is written in Go. Can run commands in parallel. | ||
* **Powerful.** It allows to control execution and files you pass to your commands. | ||
* **Simple.** It is single dependency-free binary which can work in any environment. | ||
|
||
📖 [Read the introduction post](https://evilmartians.com/chronicles/lefthook-knock-your-teams-code-back-into-shape?utm_source=lefthook) | ||
|
||
<a href="https://evilmartians.com/?utm_source=lefthook"> | ||
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a> | ||
|
||
## Install | ||
|
||
```bash | ||
pip install lefthook | ||
``` | ||
|
||
## Usage | ||
|
||
Configure your hooks, install them once and forget about it: rely on the magic underneath. | ||
|
||
#### TL;DR | ||
|
||
```bash | ||
# Configure your hooks | ||
vim lefthook.yml | ||
|
||
# Install them to the git project | ||
lefthook install | ||
|
||
# Enjoy your work with git | ||
git add -A && git commit -m '...' | ||
``` | ||
|
||
#### More details | ||
|
||
- [**Configuration**](https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md) for `lefthook.yml` config options. | ||
- [**Usage**](https://github.com/evilmartians/lefthook/blob/master/docs/usage.md) for **lefthook** CLI options, supported ENVs, and usage tips. | ||
- [**Discussions**](https://github.com/evilmartians/lefthook/discussions) for questions, ideas, suggestions. | ||
<!-- - [**Wiki**](https://github.com/evilmartians/lefthook/wiki) for guides, examples, and benchmarks. --> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import sys | ||
|
||
from .main import main | ||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import os | ||
import sys | ||
import platform | ||
import subprocess | ||
|
||
ISSUE_URL = "https://github.com/evilmartians/lefthook/issues/new/choose" | ||
ARCH_MAPPING = { | ||
'amd64': 'x86_64', | ||
'aarch64': 'arm64', | ||
} | ||
|
||
def main(): | ||
os_name = platform.system().lower() | ||
arch = platform.machine().lower() | ||
arch = ARCH_MAPPING.get(arch, arch) | ||
ext = os_name == "windows" and ".exe" or "" | ||
subfolder = f"lefthook-{os_name}-{arch}" | ||
executable = os.path.join(os.path.dirname(__file__), "bin", subfolder, "lefthook"+ext) | ||
if not os.path.isfile(executable): | ||
print(f"Couldn't find binary {executable}. Please create an issue: {ISSUE_URL}") | ||
return 1 | ||
|
||
result = subprocess.run([executable] + sys.argv[1:]) | ||
return result.returncode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from setuptools import setup, find_packages | ||
|
||
with open("README.md", "r") as fh: | ||
long_description = fh.read() | ||
|
||
setup( | ||
name='lefthook', | ||
version='1.7.18', | ||
author='Evil Martians', | ||
author_email='[email protected]', | ||
url='https://github.com/evilmartians/lefthook', | ||
description='Git hooks manager. Fast, powerful, simple.', | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
packages=find_packages(), | ||
entry_points={ | ||
'console_scripts': [ | ||
'lefthook=lefthook.main:main' | ||
], | ||
}, | ||
package_data={ | ||
'lefthook':[ | ||
'bin/lefthook-linux-x86_64/lefthook', | ||
'bin/lefthook-linux-arm64/lefthook', | ||
'bin/lefthook-freebsd-x86_64/lefthook', | ||
'bin/lefthook-freebsd-arm64/lefthook', | ||
'bin/lefthook-openbsd-x86_64/lefthook', | ||
'bin/lefthook-openbsd-arm64/lefthook', | ||
'bin/lefthook-windows-x86_64/lefthook.exe', | ||
'bin/lefthook-windows-arm64/lefthook.exe', | ||
'bin/lefthook-darwin-x86_64/lefthook', | ||
'bin/lefthook-darwin-arm64/lefthook', | ||
] | ||
}, | ||
classifiers=[ | ||
'License :: OSI Approved :: MIT License', | ||
'Operating System :: OS Independent', | ||
'Topic :: Software Development :: Version Control :: Git' | ||
], | ||
python_requires='>=3.6', | ||
) |