-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b40479e
commit 69f166e
Showing
12 changed files
with
204 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Lint | ||
|
||
on: | ||
push | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.7'] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: pip install -r requirements_dev.txt | ||
|
||
- name: Install the library | ||
shell: bash | ||
run: pip install . | ||
|
||
- name: Run mypy | ||
shell: bash | ||
run: mypy full_match --strict | ||
|
||
- name: Run ruff | ||
shell: bash | ||
run: ruff full_match |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
pypi-publish: | ||
name: upload release to PyPI | ||
runs-on: ubuntu-latest | ||
# Specifying a GitHub environment is optional, but strongly encouraged | ||
environment: release | ||
permissions: | ||
# IMPORTANT: this permission is mandatory for trusted publishing | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: pip install -r requirements_dev.txt | ||
|
||
- name: Build the project | ||
shell: bash | ||
run: python -m build . | ||
|
||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Tests | ||
|
||
on: | ||
push | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [macos-latest, ubuntu-latest, windows-latest] | ||
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install the library | ||
shell: bash | ||
run: pip install . | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: pip install -r requirements_dev.txt | ||
|
||
- name: Print all libs | ||
shell: bash | ||
run: pip list | ||
|
||
- name: Run tests and show coverage on the command line | ||
run: coverage run --source=full_match --omit="*tests*" -m pytest --cache-clear --assert=plain && coverage report -m | ||
|
||
- name: Upload reports to codecov | ||
env: | ||
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} | ||
if: runner.os == 'Linux' | ||
run: | | ||
curl -Os https://uploader.codecov.io/latest/linux/codecov | ||
find . -iregex "codecov.*" | ||
chmod +x codecov | ||
./codecov -t ${CODECOV_TOKEN} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.DS_Store | ||
venv | ||
__pycache__ | ||
.pytest_cache | ||
*.egg-info | ||
dist | ||
build | ||
.ruff_cache | ||
.mypy_cache | ||
.mutmut-cache | ||
html | ||
.coverage | ||
htmlcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ignore = ['E501', 'E712'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import sys | ||
|
||
from full_match.proxy_module import ProxyModule as ProxyModule | ||
|
||
|
||
sys.modules[__name__].__class__ = ProxyModule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import sys | ||
from re import escape | ||
|
||
|
||
class ProxyModule(sys.modules[__name__].__class__): # type: ignore[misc] | ||
def __call__(self, string: str) -> str: | ||
return f'^{escape(string)}$' |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
[build-system] | ||
requires = ['setuptools==68.0.0'] | ||
build-backend = 'setuptools.build_meta' | ||
|
||
[project] | ||
name = 'full_match' | ||
version = '0.0.12' | ||
authors = [ | ||
{ name='Evgeniy Blinov', email='zheni-b@yandex.ru' }, | ||
] | ||
description = 'One function that makes the string matchable' | ||
readme = 'README.md' | ||
requires-python = '>=3.7' | ||
classifiers = [ | ||
'Operating System :: MacOS :: MacOS X', | ||
'Operating System :: Microsoft :: Windows', | ||
'Operating System :: POSIX', | ||
'Operating System :: POSIX :: Linux', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Programming Language :: Python :: 3.10', | ||
'Programming Language :: Python :: 3.11', | ||
'Programming Language :: Python :: 3.12', | ||
'License :: OSI Approved :: MIT License', | ||
'Topic :: Software Development :: Libraries', | ||
'Intended Audience :: Developers', | ||
] | ||
|
||
[tool.setuptools.package-data] | ||
"full_match" = ["py.typed"] | ||
|
||
[tool.mutmut] | ||
paths_to_mutate="full_match" | ||
runner="pytest" | ||
|
||
[project.urls] | ||
'Source' = 'https://github.com/pomponchik/full_match' | ||
'Tracker' = 'https://github.com/pomponchik/full_match/issues' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
pytest==7.4.3 | ||
coverage==7.2.7 | ||
twine==4.0.2 | ||
wheel==0.41.2 | ||
build==0.9.0 | ||
ruff==0.0.290 | ||
mypy==1.4.1 | ||
mutmut==2.4.4 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import re | ||
|
||
import pytest | ||
|
||
import full_match | ||
|
||
|
||
def test_simple_match(): | ||
assert re.search(full_match('kek'), 'XXkekXX') is None | ||
|
||
|
||
def test_exception_message(): | ||
with pytest.raises(AssertionError, match='Regex pattern did not match.'): | ||
with pytest.raises(ValueError, match=full_match('kek')): | ||
raise ValueError('XXkekXX') |