Update, general cleanup and overall improvements#35
Update, general cleanup and overall improvements#35rbroderi wants to merge 88 commits intoVerbalExpressions:masterfrom
Conversation
MatthijsBurgh
left a comment
There was a problem hiding this comment.
Why the archives?
Why the released version zips? These should go in the releases.
I think docs should go in a gh-pages branch
.github/workflows/main.yml
Outdated
| @@ -0,0 +1,41 @@ | |||
| # This is a basic workflow to help you get started with Actions | |||
There was a problem hiding this comment.
I would remove all the comments. When people don't understand the file, they should look at the GH documentation.
.github/workflows/main.yml
Outdated
| on: # yamllint disable-line rule:truthy | ||
| # Triggers the workflow on push or pull request events but only for the master branch | ||
| push: | ||
| branches: [master] | ||
| pull_request: | ||
| branches: [master] | ||
|
|
||
| # Allows you to run this workflow manually from the Actions tab | ||
| workflow_dispatch: |
There was a problem hiding this comment.
Allow pushes/pr to all branches. Enough capacity to check everything.
| on: # yamllint disable-line rule:truthy | |
| # Triggers the workflow on push or pull request events but only for the master branch | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| on: [push, pull_request, workflow_dispatch] |
.github/workflows/main.yml
Outdated
| run: python --version | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip |
.github/workflows/main.yml
Outdated
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
| - uses: actions/checkout@v3 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v3 |
.github/workflows/main.yml
Outdated
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest] | ||
| python-version: ['3.7', '3.8', '3.9', '3.10'] |
GPLv3_LICENSE.txt
Outdated
| @@ -0,0 +1,674 @@ | |||
| GNU GENERAL PUBLIC LICENSE | |||
LICENSE.txt
Outdated
| @@ -0,0 +1,39 @@ | |||
| Verbal Expressions | |||
| @@ -1,25 +1,34 @@ | |||
| PythonVerbalExpressions | |||
| ======================= | |||
| Verbex: Python verbal based regular expressions | |||
There was a problem hiding this comment.
| Verbex: Python verbal based regular expressions | |
| # Verbex: Python verbal based regular expressions | |
| [](https://github.com/VerbalExpressions/PythonVerbalExpressions/actions/workflows/main.yml) | |
| [](https://github.com/ambv/black) | |
| [](https://www.gnu.org/licenses/gpl-3.0.en.html) | |
| [](https://pypi.python.org/pypi/ansicolortags/) | |
| [](http://mypy-lang.org/) | |
| [](https://github.com/beartype/beartype) | |
| [](https://bandit.readthedocs.io/en/latest/) | |
| [](https://github.com/pycqa/flake8) | |
| ## Installation | |
| ```bash | |
| pip install Verbex |
Usage
from verbex import Verbex
verbex = Verbex()Documentation
Examples
Testing if we have a valid URL
# Create an example of how to test for correctly formed URLs
verbex = Verbex()
tester = (verbex.
start_of_line().
find('http').
maybe('s').
find('://').
maybe('www.').
anything_but(' ').
end_of_line()
)
# Create an example URL
test_url = "https://www.google.com"
# Test if the URL is valid
if re.match(test_url.regex,test_url):
print("Valid URL")
# Print the generated regex
print(tester) # => ^(http)(s)?(\:\/\/)(www\.)?([^\ ]*)$Replacing strings
# Create a test string
replace_me = "Replace bird with a duck"
# Create an expression that looks for the word "bird"
expression = Verbex().find('bird')
# Compile and use the regular expression using re
import re
regexp = expression.compile()
result_re = regexp.sub('duck', replace_me)
print(result_re)Developer setup : running the tests
python setup.py develop
python setup.py testOther implementations
You can view all implementations on VerbalExpressions.github.io
There was a problem hiding this comment.
This suggestion is a bit shitty...
verbex/__init__.py
Outdated
| @@ -0,0 +1,10 @@ | |||
| try: | |||
There was a problem hiding this comment.
I am not sure we should rename the library
| @@ -0,0 +1,646 @@ | |||
| """Generate regular expressions from an easier fluent verbal form.""" | |||
There was a problem hiding this comment.
By renaming the library, the entire diff is gone.
Update to python 3
Utilize beartype for runtime O(1) typechecking
Add type hints for mypy / beartype static type checking.
Update license to GPL v3