Skip to content

Commit 5fb93ce

Browse files
committed
Merge pull request #3 from mriehl/master
setuptools for testing and packaging
2 parents 51f5aa1 + 1cbbc83 commit 5fb93ce

File tree

7 files changed

+55
-3
lines changed

7 files changed

+55
-3
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
venv
2+
dist
3+
build
4+
*.py[co]

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,24 @@
11
PythonVerbalExpressions
22
=======================
3+
4+
## Installation
5+
```bash
6+
python setup.py install
7+
```
8+
9+
Hopefully you will also be able to use
10+
```bash
11+
pip install verbalexpressions
12+
```
13+
in the near future.
14+
15+
## Usage
16+
```python
17+
from verbalexpressions import VerEx
18+
verbal_expression = VerEx()
19+
```
20+
21+
## Developer setup : running the tests
22+
```bash
23+
python setup.py test
24+
```

setup.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python
2+
3+
from setuptools import setup
4+
5+
if __name__ == '__main__':
6+
setup(
7+
name = 'VerbalExpressions',
8+
version = '0.0.1',
9+
description = 'Make difficult regular expressions easy! Python port of the awesome VerbalExpressions repo - https://github.com/jehna/VerbalExpressions',
10+
long_description = '''Please see https://github.com/VerbalExpressions/PythonVerbalExpressions/blob/master/README.md for more information!''',
11+
author = "Mihai Ionut Vilcu, Peder Soholt",
12+
author_email = "",
13+
license = 'MIT',
14+
url = 'https://github.com/VerbalExpressions/PythonVerbalExpressions',
15+
test_suite='tests',
16+
scripts = [],
17+
packages = ['verbalexpressions'],
18+
classifiers = [],
19+
zip_safe=True
20+
)
21+

tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from verbal_expressions_test import *

tests/verbal_expressions_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- encoding: utf-8 -*-
22
import unittest
3-
from verbal_expressions import VerEx
3+
from verbalexpressions import VerEx
44
import re
55

66
class VerExTest(unittest.TestCase):
@@ -74,7 +74,7 @@ def test_line_break_false(self):
7474

7575
def test_tab_true(self):
7676
self.exp = self.v.start_of_line().anything().tab().end_of_line().regex()
77-
self.assertRegexpMatches('One tab only ', self.exp, 'No tab here!')
77+
self.assertRegexpMatches('One tab only ', self.exp, 'No tab here!')
7878

7979
def test_tab_false(self):
8080
self.exp = self.v.start_of_line().anything().tab().end_of_line().regex()
@@ -110,4 +110,4 @@ def test_email(self):
110110

111111
def test_url(self):
112112
self.exp = self.v.start_of_line().then('http').maybe('s').then('://').maybe('www.').word().then('.').word().maybe('/').end_of_line().regex()
113-
self.assertRegexpMatches('https://www.google.com/', self.exp, 'Not a valid email')
113+
self.assertRegexpMatches('https://www.google.com/', self.exp, 'Not a valid email')

verbalexpressions/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from verbal_expressions import VerEx, re_escape

verbal_expressions.py renamed to verbalexpressions/verbal_expressions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ def __getattr__(self, attr):
3131
regex = self.regex()
3232
return getattr(regex, attr)
3333

34+
def __str__(self):
35+
return self.s
36+
3437
def add(self, value):
3538
self.s += value
3639
return self

0 commit comments

Comments
 (0)