Skip to content

Commit

Permalink
setup for pypi deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzofelletti committed Mar 18, 2022
1 parent 8de359d commit dc62d98
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 61 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI

on: push

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Run Pytest

# Controls when the workflow will run
on:
# 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:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
run: |
if [ -d tests ] || [ -d test ]; then python -m pytest; fi
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
venv/

__pycache__/
*.py[cod]

# Distribution / packaging
bin/
build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

.vscode
.pytest_cache/
.coverage
62 changes: 1 addition & 61 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,53 +22,8 @@ Features implemented includes:
| curly brace quantification | {exact} {min,max} {,max} {min,} |
| range element | [^a-zA-Z059] |

## How to run it

(Linux)

Clone the repo:

```Bash
git clone https://github.com/lorenzofelletti/pyregex
```

Change to the cloned direcory:

```Bash
cd pyregex
```

Create and activate a virtualenv:

```Bash
python3 -m venv venv
source venv/bin/activate
```

Install requirements:

```Bash
pip3 install -r requirements.txt
```

Run tests and print coverage:

```Bash
chmod +x print_coverage.sh
./print_coverage.sh
```

### Play with the engine:

Activate the venv and start the python interpreter in the repo folder:

```Bash
cd pyregex
source venv/bin/activate
python3
```

Play with the engine:
## Play with the engine:

```Python
from pyregexp.engine import RegexEngine
Expand All @@ -77,18 +32,3 @@ reng = RegexEngine()

reng.match('^my_(beautiful_)+regex', '^my_beautiful_beautiful_beautiful_regex')
```

Or:

Enable execution on `regex.sh`:

```Bash
cd pyregex
chmod +x regex.sh
```

Run regex.sh

```Bash
./regex.sh 'my_regex' 'test_str_1' <'test_str2' ... 'test_str_n'>
```
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
dscription-file = README.md
26 changes: 26 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from distutils.core import setup

setup(
name='pyregexp',
packages=['pyregexp'],
version='0.1.6',
license='MIT',
description='Simple regex library',
author='Lorenzo Felletti',
url='https://github.com/lorenzofelletti/pyregex',
download_url='https://github.com/lorenzofelletti/pyregex/archive/v0.1.6.tar.gz',
keywords=['Regex', 'RegExp', 'Engine'],
install_requires=[],
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
)

0 comments on commit dc62d98

Please sign in to comment.