-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update, general cleanup and overall improvements #35
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to update 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use v4
.github/workflows/main.yml
Outdated
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest] | ||
python-version: ['3.7', '3.8', '3.9', '3.10'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extend to use 3.11 too
GPLv3_LICENSE.txt
Outdated
@@ -0,0 +1,674 @@ | |||
GNU GENERAL PUBLIC LICENSE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just rename to LICENSE.txt
LICENSE.txt
Outdated
@@ -0,0 +1,39 @@ | |||
Verbal Expressions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why two licenses?
@@ -1,25 +1,34 @@ | |||
PythonVerbalExpressions | |||
======================= | |||
Verbex: Python verbal based regular expressions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verbex: Python verbal based regular expressions | |
# Verbex: Python verbal based regular expressions | |
[![CI](https://github.com/VerbalExpressions/PythonVerbalExpressions/actions/workflows/main.yml/badge.svg)](https://github.com/VerbalExpressions/PythonVerbalExpressions/actions/workflows/main.yml) | |
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) | |
[![PyPI license](https://img.shields.io/pypi/l/verbex)](https://www.gnu.org/licenses/gpl-3.0.en.html) | |
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/verbex)](https://pypi.python.org/pypi/ansicolortags/) | |
[![Generic badge](https://img.shields.io/badge/mypy-typed-purple.svg)](http://mypy-lang.org/) | |
[![Generic badge](https://img.shields.io/badge/beartype-runtime_typed-cyan.svg)](https://github.com/beartype/beartype) | |
[![Generic badge](https://img.shields.io/badge/bandit-checked-magenta.svg)](https://bandit.readthedocs.io/en/latest/) | |
[![Generic badge](https://img.shields.io/badge/flake8-linted-yellow.svg)](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 test
Other implementations
You can view all implementations on VerbalExpressions.github.io
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This suggestion is a bit shitty...
verbex/__init__.py
Outdated
@@ -0,0 +1,10 @@ | |||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure we should rename the library
verbex/verbex.py
Outdated
@@ -0,0 +1,646 @@ | |||
"""Generate regular expressions from an easier fluent verbal form.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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