-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds GitHub Actions for building and uploading a package
- Loading branch information
1 parent
ec1faa5
commit be8f8d0
Showing
8 changed files
with
112 additions
and
30 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,38 @@ | ||
name: Python package | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: [3.6, 3.7, 3.8] | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Lint with flake8 | ||
run: | | ||
pip install flake8 | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 **/*.py --count --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 **/*.py --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Test with pytest | ||
run: | | ||
pip install pytest | ||
python -m pytest -vvv test |
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,26 @@ | ||
name: Upload Python Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.6' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* |
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
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
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 |
---|---|---|
|
@@ -82,10 +82,10 @@ class UDPipeTokenizer(object): | |
>>> nlp = spacy.load('/path/to/model', udpipe_model=udpipe_model) | ||
""" | ||
|
||
to_disk = lambda self, *args, **kwargs: None | ||
from_disk = lambda self, *args, **kwargs: None | ||
to_bytes = lambda self, *args, **kwargs: None | ||
from_bytes = lambda self, *args, **kwargs: None | ||
to_disk = lambda self, *args, **kwargs: None # noqa: E731 | ||
from_disk = lambda self, *args, **kwargs: None # noqa: E731 | ||
to_bytes = lambda self, *args, **kwargs: None # noqa: E731 | ||
from_bytes = lambda self, *args, **kwargs: None # noqa: E731 | ||
_ws_pattern = re.compile(r"\s+") | ||
|
||
def __init__(self, model, vocab): | ||
|
@@ -217,15 +217,15 @@ def __init__(self, lang, path=None, meta=None): | |
raise Exception(msg) | ||
self._lang = lang.split('-')[0] | ||
if meta is None: | ||
self._meta = {'authors': ("Milan Straka, " | ||
"Jana Straková"), | ||
self._meta = {'author': ("Milan Straka & " | ||
"Jana Straková"), | ||
'description': "UDPipe pretrained model.", | ||
'email': '[email protected]', | ||
'lang': 'udpipe_' + self._lang, | ||
'license': 'CC BY-NC-SA 4.0', | ||
'name': path.split('/')[-1], | ||
'parent_package': 'spacy_udpipe', | ||
'pipeline': 'Tokenizer, POS Tagger, Lemmatizer, Parser', | ||
'pipeline': 'Tokenizer, Tagger, Lemmatizer, Parser', | ||
'source': 'Universal Dependencies 2.4', | ||
'url': 'http://ufal.mff.cuni.cz/udpipe', | ||
'version': '1.2.0' | ||
|
@@ -277,15 +277,15 @@ def tokenize(self, text): | |
return self._read(text, tokenizer) | ||
|
||
def tag(self, sentence): | ||
"""Assing part-of-speech tags (inplace). | ||
"""Assign part-of-speech tags (inplace). | ||
sentence (ufal.udpipe.Sentence): Input sentence. | ||
RETURNS (ufal.udpipe.Sentence): Tagged sentence. | ||
""" | ||
self.model.tag(sentence, self.model.DEFAULT) | ||
|
||
def parse(self, sentence): | ||
"""Assing dependency parse relations (inplace). | ||
"""Assign dependency parse relations (inplace). | ||
sentence (ufal.udpipe.Sentence): Input sentence. | ||
RETURNS (ufal.udpipe.Sentence): Tagged sentence. | ||
|
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
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
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