A command line tool for generating .gitignore files.
Project description
pygic: Python .gitignore creator
pygic is a command line tool for generating gitignores. It is heavily inspired from gitignore.io and gig. Similar projects are pygig and pygi.
Main differences with pygig
pygigdoes not use the gitignores from gitignore.io.pygigrequiresgitif we want to update its pre-downloaded gitignores.
Main difference with pygi
pygicannot be used offline since it is a wrapper around the gitignore.io API.
Main differences with gig
gigis written in Go so it cannot be used as a Python library.gigrequiresgitinstalled to download the gitignores from toptal/gitignore the first time it is ran.gigsearch functionality depends onfzf.gigcan be easily installed on MacOS or if you have Go installed. Otherwise, you need to manually install its pre-built binaries.
What makes pygic stand out
- All you need is
uvinstalled, not even Python. pygiccan be used offline as the gitignores from toptal/gitignore are pre-downloaded.- You don't need
gitinstalled since cloning can be handled bydulwich. - The search functionality does not depend on
fzf, but usespzpwhich is a Python tool.
Other remarks
pygicdoes not support theautogencommand fromgigsince it is experimental does not seem very useful.- Similar to
gig, the content of the gitignores match the ones from gitignore.io, except for the order of the stacks which is not standardized by gitignore.io. Here, we choose the alphabetical order. - Finally
pygicfixes what seems to be a small bug in gitignore.io's implementation where they remove all duplicated lines in the generated gitignores, even in comments.pygiconly removes uncommented duplicated lines.
Install
uv
The easiest way to install pygic is to use uv as a Python tool manager. You can install uv with the following command:
curl -LsSf https://astral.sh/uv/install.sh | sh
For more information, check out uv's documentation.
Since pygic is on PyPI, once uv is installed, all you have to do to install pygic as a CLI tool is:
uv tool install pygic
If you want to be able to update the gitignore by using the last ones on toptal/gitignore, you can install pygic with the [git] extra:
uv tool install pygic[git]
The [git] extra requires git. If you don't want to install git, you can still clone the toptal/gitignore repository thanks to dulwich (a Python implementation of git), with the [dulwich] extra:
uv tool install pygic[dulwich]
If you want to use pygic search, you can install pygic with the [search] extra:
uv tool install pygic[search]
Finally, if you want all extras, you can install pygic like this:
uv tool install pygic[all]
Usage
The usage is similar to gig.
Generating a gitignore via available arguments
$ pygic gen python opencv
### OpenCV ###
#OpenCV for Mac and Linux
#build and release folders
*/CMakeFiles
*/CMakeCache.txt
*/Makefile
*/cmake_install.cmake
.DS_Store
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
...
And to directly create a .gitignore file with the previous example, run:
pygic gen python opencv > .gitignore
Using the search functionality
The search functionality allows you to search amongst the available arguments and finally generates a gitignore with the selected arguments.
pygic search
For more information, see
pygic --help
Development
uv
This project uses uv as virtual environment and package manager.
To contribute, all you have to do is clone, then run:
uv venv
uv sync --all-extras
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 pygic-1.0.0.tar.gz.
File metadata
- Download URL: pygic-1.0.0.tar.gz
- Upload date:
- Size: 107.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e48a32f6f780034dad8003aca01a64c7bf25c9007193df882d4277e1830814f1
|
|
| MD5 |
c04a97a66496b4d6d62add03d890f059
|
|
| BLAKE2b-256 |
c03c4941843cd2046be3047393d03f402c7ce7b3b9b01617fab86bde6cf4e954
|
File details
Details for the file pygic-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pygic-1.0.0-py3-none-any.whl
- Upload date:
- Size: 279.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4e1eeab0e8d3b0ba44dd316b043ac5f61ad5690be6b90ab39d8323cabd045ad
|
|
| MD5 |
d3b760af248ee72f077884b0acb2c3ae
|
|
| BLAKE2b-256 |
88e577bc6442da54380c5ab8e27d3d0e346e5aa929a5589a1d16a1d5535d7944
|