This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

zgitignore is a small library to check if a file has been excluded by a .zgitignore file (those are compatible with .gitignore files).

Installation

As simple as it can be via pip:

$ pip install zgitignore

Or direct installation from source:

$ git clone git://github.com/zb3/zgitignore.git
$ cd zgitignore
$ python setup.py install

Usage

import zgitignore

#ZgitIgnore class stores the patterns, optionally takes ignore_case parameter
#by default, it is case sensitive to match .gitignore behaviour
f = zgitignore.ZgitIgnore(['build/', 'dist/', '*egg-info'])

#Patterns ending with / will match folders only:
print('build file ignored?: ', f.is_ignored('build')) #False

#When matching directories, set second parameter to True:
print('build folder ignored?: ', f.is_ignored('build', True)) #True

#It is case sensitive by default:
print('BUILD folder ignored?: ', f.is_ignored('BUILD', True)) #False

#Want it to be case-insensitive? No problem
f = zgitignore.ZgitIgnore(['*pycache*', '*pyc'], True) #second parameter is ignore_case

print('PYCACHE file ignored?', f.is_ignored('PYCACHE')) #True

#You can also add patterns later
ignorefile = zgitignore.ZgitIgnore(ignore_case=True)

try:
    with open('.gitignore', 'r') as f:
        ignorefile.add_patterns(f.read().splitlines())
except:
    pass

#You can start path with ./ or not.
#Paths are normalized to match Unix style paths
print('./a/b/c/d/e ignored?', ignorefile.is_ignored('./a/b/c/d/e'))

Format

zgitignore supports format similar to .gitignore file format. Differences are:

  • ** works everywhere

    ``aaa**ooo``
    

    Will match aaapotato2000/beeeee/llllll/sdsdooo

  • It can embed custom regex via {}. You can use \} to pass } to regex and \\ to pass \ to regex

    aaa{12(34|56|78)oo(aa|bb|dd)ii}888
    

    Will match aaa1256oobbii888

    aaa{#[0-9a-f]{3,6\}}888
    

    Will match aaa#00ffff888

Release History

Release History

0.7.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.7

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
zgitignore-0.7.1.tar.gz (5.6 kB) Copy SHA256 Checksum SHA256 Source Aug 20, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting