Skip to content

Commit

Permalink
Added github workflow to allow release to pypi (#11)
Browse files Browse the repository at this point in the history
* added build and release workflows

* Bump version: 0.7.2 → 0.7.3

* fixing readme.rst as not being uploaded to pypi due to errors

* added python 3.12 to python-versions
  • Loading branch information
coliin8 authored Feb 29, 2024
1 parent 681ffab commit e8d9756
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 7 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build unstable

on: [push]

concurrency:
group: unstable
# cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '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@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Cleanup more disk space
run: sudo rm -rf /usr/share/dotnet && sudo rm -rf /opt/ghc && sudo rm -rf "/usr/local/share/boost" && sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade flake8 pycodestyle
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with unittest
run: |
python -m unittest
40 changes: 40 additions & 0 deletions .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build release

on:
workflow_dispatch:
push:
tags:
- '*'

concurrency:
group: docker
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: "3.8"
cache: 'pip'
- name: Cleanup more disk space
run: sudo rm -rf /usr/share/dotnet && sudo rm -rf /opt/ghc && sudo rm -rf "/usr/local/share/boost" && sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade flake8 pycodestyle
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=12 --max-line-length=127 --statistics
- name: Build and Publish to PyPI
uses: conchylicultor/pypi-build-publish@v1
with:
pypi-token: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ dist
*.egg-info
build
.eggs

.vscode/
10 changes: 8 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,15 @@ Here an example:
Batch processing
######################

The batch processing is implemented in the class ``NerdBatch``.
The class can be instantiated by defining the entity-fishing url in the constructor, else the default one is used.

To run the processing, the method `process` requires the `input` directory, a callback and the number of threads/processes.
There is an already ready implementation in `script/batchSample.py`.

To run it:

- under this work branch, prepare two folders: `input` which containing the input Pdf files to be processed and `output` which collecting the processing result
- we recommend to create a new virtualenv, activate it and install all the requirements needed in this virtual environment using `$ pip install -r /path/of/entity-fishing-client-python/source/requirements.txt`
- (temporarly, until this branch is not merged) install entity-fishing **multithread branch** in edit mode (`pip install -e /path/of/entity-fishing-client-python/source`)
Expand All @@ -207,6 +209,7 @@ To run it:

KB access
#########

.. code-block:: python
nerd.get_concept("Q456")
Expand Down Expand Up @@ -333,12 +336,13 @@ Utilities

Language detection
==================

.. code-block:: python
nerd.get_language("This is a sentence. This is a second sentence.")
with response
with response:

.. code-block:: python
Expand All @@ -355,12 +359,14 @@ with response
Segmentation
============

.. code-block:: python
nerd.segment("This is a sentence. This is a second sentence.")
with response
with response:

.. code-block:: python
(
Expand Down
2 changes: 1 addition & 1 deletion nerd/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
2 changes: 1 addition & 1 deletion nerd/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from codecs import open
from os import path
from setuptools import setup
import unittest

here = path.abspath(path.dirname(__file__))

# Get the long description from the README file.
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()

import unittest


def my_test_suite():
test_loader = unittest.TestLoader()
Expand All @@ -22,6 +21,7 @@ def my_test_suite():
version='0.7.2',
description='A minimal client for entity-fishing service.',
long_description=long_description,
long_description_content_type='text/x-rst',
url='https://github.com/Hirmeos/entity-fishing-client-python',
author='Francesco de Virgilio, Luca Foppiano',
author_email='francesco.devirgilio@ubiquitypress.com, luca.foppiano@inria.fr',
Expand Down

0 comments on commit e8d9756

Please sign in to comment.