Coder Social home page Coder Social logo

proycon / clam Goto Github PK

View Code? Open in Web Editor NEW
129.0 9.0 17.0 25.96 MB

Quickly turn command-line applications into RESTful webservices with a web-application front-end. You provide a specification of your command line application, its input, output and parameters, and CLAM wraps around your application to form a fully fledged RESTful webservice.

Home Page: https://proycon.github.io/clam

License: GNU General Public License v3.0

Python 71.37% CSS 1.76% HTML 1.78% JavaScript 14.64% XSLT 9.32% Shell 0.81% Dockerfile 0.33%
python webservice rest nlp wrapper

clam's People

Contributors

arne-cl avatar bloemj avatar oktaal avatar proycon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clam's Issues

Add high-level method to get all output files *prior* to their creation

The metadata will be generated on project start so the information is there, but there is currently no good high-level function to get to it. This is needed to get the output filename directly, rather than deriving it again, prevent duplication of either filename, or code to derive it.

filename is no longer enforced??

When uploading a file with a different filename than the one in InputTemplate/filename, it should automatically get renamed. The old name persists now.

Add configurable Access-Control-Allow-Origin (Cross-Site Request Forgery)

CLAM may currently be too strict to be usable by AJAX clients.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading                                                                                                                                                                                 
the remote resource at http://www.spraak.org/webservice/transcribe/.                                                                                                                                                                                    (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).       

Allow configurable Access-Control-Allow-Origin on all CLAM responses.

CLAM gets into oblivion on empty input

Screen input: (no files present yet)
When you forget to add a filename, and push START the system presents some minimal output,
but doesn't work and doesn't tell you what went wrong.
Why not a default filename. Or warning.

Administration interface + Logging

Implement extra logging of user activity
Allow administrators to more easily manage projects (view logs, delete, pause)

(Requested by Daan Broeder, MPI)

CLAM won't install through pip

Trying to install clam through pip fails:

$ pip install --install-option="--prefix=/scratch/lars/apps" clam

gives the error message:

Downloading/unpacking clam
  Downloading CLAM-0.7.8.3.tar.gz (86Kb): 86Kb downloaded
  In the tar file /tmp/pip-zqCe0E-unpack/CLAM-0.7.8.3.tar.gz the member CLAM-0.7.8.3/clam/config/oersetter.py is invalid: 'NoneType' object has no attribute 'isreg'
  Running setup.py egg_info for package clam
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/scratch/lars/apps/src/build/clam/setup.py", line 8, in <module>
        os.chdir(os.path.dirname(sys.argv[0]))
    OSError: [Errno 2] No such file or directory: ''
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/scratch/lars/apps/src/build/clam/setup.py", line 8, in <module>

    os.chdir(os.path.dirname(sys.argv[0]))

OSError: [Errno 2] No such file or directory: ''

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /home/buitinck/.pip/pip.log

The pip.log file contains the same exception message, followed by the traceback:

Command python setup.py egg_info failed with error code 1
Exception information:
Traceback (most recent call last):
  File "/scratch/lars/apps/lib/python2.6/site-packages/pip-1.0.2-py2.6.egg/pip/basecommand.py", line 126, in main
    self.run(options, args)
  File "/scratch/lars/apps/lib/python2.6/site-packages/pip-1.0.2-py2.6.egg/pip/commands/install.py", line 223, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/scratch/lars/apps/lib/python2.6/site-packages/pip-1.0.2-py2.6.egg/pip/req.py", line 986, in prepare_files
    req_to_install.run_egg_info()
  File "/scratch/lars/apps/lib/python2.6/site-packages/pip-1.0.2-py2.6.egg/pip/req.py", line 222, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/scratch/lars/apps/lib/python2.6/site-packages/pip-1.0.2-py2.6.egg/pip/__init__.py", line 255, in call_subprocess
    % (command_desc, proc.returncode))
InstallationError: Command python setup.py egg_info failed with error code 1

Problem with XSLTViewer in Python 2, missing import

I'm using CLAM in Python 2 and I think I found a bug; in clam/common/viewers.py there's a if-else-branch that will use BytesIO if the sys.version is < 3 and lines[0] is a str, but BytesIO is not imported. Changing this occurrence to StringIO seems to resolve the issue.

There's another occurrence of this a few lines later. If you want I can make a pull request.

Disable wrapping in tableviewer

Would it be an idea to disable wrapping in the SimpleTableViewer? Or add a setting in the API?
An example use case is disabling sentences and values for that sentence in a tableviewer. Currently browsers will wrap then wrap the text.

Implement get() for CLAMData?

Maybe this is already possible, but it would be nice to be able to use Python's dictionary method get() (with a default if the key is not found) for CLAMData, so that you can put e.g.

clamdata.get('test', 1.23)

instead of

test = 1.23
if 'test' in clamdata:
     test = clamdata['test']

or something equivalent. Maybe by subclassing Mapping?

Implement mechanism to pass SSL certificate in client API

Implement mechanism to pass certificate (to requests library) in CLAM Client API. Currently fails:

See also: http://stackoverflow.com/questions/10667960/python-requests-throwing-up-sslerror

   File "<ipython-input-3-6bd0a1e6835d>", line 1, in <module>
     runfile('C:/xampp/htdocs/bramvanroy/projects/tree-visualizer/get-alpino-parse.py', wdir='C:/xampp/htdocs/bramvanroy/projects/tree-visualizer')

   File "C:\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 685, in runfile
     execfile(filename, namespace)

   File "C:\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 85, in execfile
     exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)

   File "C:/xampp/htdocs/bramvanroy/projects/tree-visualizer/get-alpino-parse.py", line 22, in <module>
     clamclient.create(project)

   File "C:\Anaconda3\lib\site-packages\clam-2.1.0-py3.4.egg\clam\common\client.py", line 212, in create
     return self.request(project + '/', 'PUT')

   File "C:\Anaconda3\lib\site-packages\clam-2.1.0-py3.4.egg\clam\common\client.py", line 134, in request
     r = request(self.url + url,**requestparams)

   File "C:\Anaconda3\lib\site-packages\requests\api.py", line 122, in put
     return request('put', url, data=data, **kwargs)

   File "C:\Anaconda3\lib\site-packages\requests\api.py", line 50, in request
     response = session.request(method=method, url=url, **kwargs)

   File "C:\Anaconda3\lib\site-packages\requests\sessions.py", line 465, in request
     resp = self.send(prep, **send_kwargs)

   File "C:\Anaconda3\lib\site-packages\requests\sessions.py", line 573, in send
     r = adapter.send(request, **kwargs)

   File "C:\Anaconda3\lib\site-packages\requests\adapters.py", line 431, in send
     if isinstance(e, _SSLError):

 SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

input url

Hi!

I wonder if it's possible to use a URL to a document as input for CLAM directly. It would be very interesting.

Proper fetching of optional inputfile

When working with optional inputtemplates, fetching the file seems a bit cumbersome (or I'm doing it wrong). If I would define an optional InputTemplate like so:

InputTemplate('nounclassification', PlainTextFormat, 'Noun Classification',
    StaticParameter(id='encoding',name='Encoding',
        description='The character encoding of the file',value='utf-8'),
    extension='.data',
    optional=True,
    unique=True,
)

Fetching the inputfile and arranging an alternative if not present seems to need a try-catch-all-block:

try:
    nc = clamdata.inputfile('nounclassification')
    # Do something useful here
except Exception:
    # When no inputfile is found, revert to the default

Is there a more clean way to work with optional inputfiles?

implement CUSTOMHTML_PROJECTFAILED

(by Stefan Fischer)
It would be nice to have a variable CUSTOMHTML_PROJECTFAILED. The user could be provided with hints about possible reasons for failure

cookie based session for annonym users

Hi!
I would like to know if it's possible to make anonymous users (CLAM without user admin) have cookie based sessions. The idea is to have different projects, files and results based on cookies instead of users. Now annoym users share their project, files, etc.
Thanks

Add support for creating webservices dynamically from a Common Workflow Language (CWL) specification

It seems feasible to add CWL support to CLAM: a CWL workflow should convertible to a CLAM profile. The CLAM wrapper can in turn invoke cwltool (the CWL reference implementation) with the cwl workflow and an input yml file with the user input (derived on the fly from the CLAM xml file).

Please upvote if this feature is desired.

Relevant resources:

Oauth2 support

Support authentication using OAuth, delegated authentication & single sign-on.. To be researched and proposed still, will have to be devised in collaboration with Max Planck Institute and CLARIN needs. Please comment if you would like this feature.

Libraries to consider: https://github.com/litl/rauth

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.