Python wrapper around invoking gn (https://gn.googlesource.com/gn/)
Project description
gn-build-py
A Python wrapper to provide a pip-installable GN binary, designed for use with pre-commit. This tool simplifies the process of installing and using GN for source code formatting in projects that utilize pre-commit hooks.
Using gn-build-py as a Pre-commit Hook
To use gn-build-py as a pre-commit hook for formatting GN files, add the following configuration to your .pre-commit-config.yaml:
- repo: https://github.com/KindDragon/gn-build-py.git
rev: ''
hooks:
- id: gn-build-py
Than run pre-commit autoupdate to update config to latest available gn build version.
This configuration ensures that the GN binary is available and used by pre-commit to format GN files in your repository.
Building and Publishing a New Package Version
The build_and_push.sh script is used to automate the process of building, testing, and deploying new versions of gn-build-py. It handles generating the latest setup.cfg, building the package, running tests, committing changes, and tagging the release.
Prerequisites
- Ensure you have
python,pip, andgitinstalled. - Install
toxfor running tests:pip install tox.
Steps to Build and Publish
-
Run the Script: Execute
build_and_push.shfrom the root directory of the project../build_and_push.sh
-
Automated Process: The script will:
- Generate the latest
setup.cfgwith updated GN version. - Build the package.
- Run tests using
tox. - Commit the changes to the repository.
- Tag the commit with the new version.
- Push the commit and tag to the repository.
- Generate the latest
-
Upload to PyPI (Optional): If you wish to distribute the package via PyPI, use twine to upload the distributions:
twine upload dist/*
Ensure you have the necessary credentials for PyPI and have tested the package thoroughly.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gn-build-py-2131.tar.gz.
File metadata
- Download URL: gn-build-py-2131.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4454ae558e1110856ae9b02f21dc4a1ef3801955072aebdd6c3eedfb8693f5da
|
|
| MD5 |
17fdd07b08f33887cf4674a99b8c3260
|
|
| BLAKE2b-256 |
3acc918232d2ae7f06d08ded3270aed67eb4879163647e8368c3d767a8e36f0f
|
File details
Details for the file gn_build_py-2131-py2.py3-none-macosx_14_0_x86_64.whl.
File metadata
- Download URL: gn_build_py-2131-py2.py3-none-macosx_14_0_x86_64.whl
- Upload date:
- Size: 849.5 kB
- Tags: Python 2, Python 3, macOS 14.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e3d8ea0e4132dee3069134cc60f51c8976caf7817598f7d46a4fa209850c026
|
|
| MD5 |
ec7b6f140ca16e2923db56f9fe70d331
|
|
| BLAKE2b-256 |
92c0de5411c9e1ebe2a6296eb46952964dc5a4258065848e96423b41be241f88
|