clams-python 1.2.3__tar.gz → 1.2.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. {clams_python-1.2.3/clams_python.egg-info → clams_python-1.2.5}/PKG-INFO +2 -2
  2. clams_python-1.2.5/VERSION +1 -0
  3. {clams_python-1.2.3 → clams_python-1.2.5}/clams/app/__init__.py +2 -2
  4. {clams_python-1.2.3 → clams_python-1.2.5}/clams/develop/__init__.py +1 -0
  5. {clams_python-1.2.3 → clams_python-1.2.5}/clams/develop/templates/app/Containerfile.template +9 -9
  6. {clams_python-1.2.3 → clams_python-1.2.5}/clams/develop/templates/app/README.md.template +10 -10
  7. {clams_python-1.2.3 → clams_python-1.2.5}/clams/develop/templates/app/app.py.template +7 -7
  8. {clams_python-1.2.3 → clams_python-1.2.5}/clams/develop/templates/app/cli.py.template +1 -1
  9. {clams_python-1.2.3 → clams_python-1.2.5}/clams/develop/templates/app/metadata.py.template +4 -4
  10. clams_python-1.2.5/clams/ver/__init__.py +1 -0
  11. {clams_python-1.2.3 → clams_python-1.2.5/clams_python.egg-info}/PKG-INFO +2 -2
  12. {clams_python-1.2.3 → clams_python-1.2.5}/clams_python.egg-info/requires.txt +1 -1
  13. {clams_python-1.2.3 → clams_python-1.2.5}/requirements.txt +1 -1
  14. {clams_python-1.2.3 → clams_python-1.2.5}/tests/test_clamsapp.py +5 -2
  15. clams_python-1.2.3/VERSION +0 -1
  16. clams_python-1.2.3/clams/ver/__init__.py +0 -1
  17. {clams_python-1.2.3 → clams_python-1.2.5}/LICENSE +0 -0
  18. {clams_python-1.2.3 → clams_python-1.2.5}/MANIFEST.in +0 -0
  19. {clams_python-1.2.3 → clams_python-1.2.5}/README.md +0 -0
  20. {clams_python-1.2.3 → clams_python-1.2.5}/clams/__init__.py +0 -0
  21. {clams_python-1.2.3 → clams_python-1.2.5}/clams/appmetadata/__init__.py +0 -0
  22. {clams_python-1.2.3 → clams_python-1.2.5}/clams/develop/templates/app/.dockerignore.template +0 -0
  23. {clams_python-1.2.3 → clams_python-1.2.5}/clams/develop/templates/app/.gitignore.template +0 -0
  24. {clams_python-1.2.3 → clams_python-1.2.5}/clams/develop/templates/app/LICENSE.template +0 -0
  25. {clams_python-1.2.3 → clams_python-1.2.5}/clams/develop/templates/app/requirements.txt.template +0 -0
  26. {clams_python-1.2.3 → clams_python-1.2.5}/clams/develop/templates/gha/for-clams-team.md.template +0 -0
  27. {clams_python-1.2.3 → clams_python-1.2.5}/clams/develop/templates/gha/workflows/issue-apps-project.yml.template +0 -0
  28. {clams_python-1.2.3 → clams_python-1.2.5}/clams/develop/templates/gha/workflows/issue-assign.yml.template +0 -0
  29. {clams_python-1.2.3 → clams_python-1.2.5}/clams/develop/templates/gha/workflows/issue-close.yml.template +0 -0
  30. {clams_python-1.2.3 → clams_python-1.2.5}/clams/develop/templates/gha/workflows/publish.yml.template +0 -0
  31. {clams_python-1.2.3 → clams_python-1.2.5}/clams/mmif_utils/__init__.py +0 -0
  32. {clams_python-1.2.3 → clams_python-1.2.5}/clams/mmif_utils/rewind.py +0 -0
  33. {clams_python-1.2.3 → clams_python-1.2.5}/clams/mmif_utils/source.py +0 -0
  34. {clams_python-1.2.3 → clams_python-1.2.5}/clams/restify/__init__.py +0 -0
  35. {clams_python-1.2.3 → clams_python-1.2.5}/clams/serve/__init__.py +0 -0
  36. {clams_python-1.2.3 → clams_python-1.2.5}/clams_python.egg-info/SOURCES.txt +0 -0
  37. {clams_python-1.2.3 → clams_python-1.2.5}/clams_python.egg-info/dependency_links.txt +0 -0
  38. {clams_python-1.2.3 → clams_python-1.2.5}/clams_python.egg-info/entry_points.txt +0 -0
  39. {clams_python-1.2.3 → clams_python-1.2.5}/clams_python.egg-info/top_level.txt +0 -0
  40. {clams_python-1.2.3 → clams_python-1.2.5}/setup.cfg +0 -0
  41. {clams_python-1.2.3 → clams_python-1.2.5}/setup.py +0 -0
  42. {clams_python-1.2.3 → clams_python-1.2.5}/tests/test_clamscli.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: clams-python
3
- Version: 1.2.3
3
+ Version: 1.2.5
4
4
  Summary: A collection of APIs to develop CLAMS app for python
5
5
  Home-page: https://clams.ai
6
6
  Author: Brandeis Lab for Linguistics and Computation
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
14
14
  Requires-Python: >=3.8
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
- Requires-Dist: mmif-python==1.0.15
17
+ Requires-Dist: mmif-python==1.0.17
18
18
  Requires-Dist: Flask>=2
19
19
  Requires-Dist: Flask-RESTful>=0.3.9
20
20
  Requires-Dist: gunicorn>=20
@@ -0,0 +1 @@
1
+ 1.2.5
@@ -142,7 +142,7 @@ class ClamsApp(ABC):
142
142
  issued_warnings.extend(ws)
143
143
  if issued_warnings:
144
144
  warnings_view = annotated.new_view()
145
- self.sign_view(warnings_view, runtime_params)
145
+ self.sign_view(warnings_view, refined)
146
146
  warnings_view.metadata.warnings = issued_warnings
147
147
  return annotated.serialize(pretty=pretty, sanitize=True)
148
148
 
@@ -260,7 +260,7 @@ class ClamsApp(ABC):
260
260
  break
261
261
  if error_view is None:
262
262
  error_view = mmif.new_view()
263
- self.sign_view(error_view, runtime_conf)
263
+ self.sign_view(error_view, self._refine_params(**runtime_conf))
264
264
  exc_info = sys.exc_info()
265
265
  error_view.set_error(f'{exc_info[0]}: {exc_info[1]}',
266
266
  '\t\n'.join(traceback.format_tb(exc_info[2])))
@@ -171,6 +171,7 @@ def prep_argparser(**kwargs):
171
171
  parser.add_argument(
172
172
  '-u', '--update',
173
173
  action='count',
174
+ default=0, # > Note, the default will be None unless explicitly set to 0. (https://docs.python.org/3/library/argparse.html#action)
174
175
  help=f'Set update level by passing this flag multiple times. This is EXPERIMENTAL, and developers MUST NOT'
175
176
  f'rely on the update results, and should conduct manual checks afterward. LEVEL 0: does not update and '
176
177
  f'raise an error when existing directory found. LEVEL 1: generate non-existing files and generate '
@@ -1,11 +1,11 @@
1
1
  # Use the same base image version as the clams-python python library version
2
2
  FROM ghcr.io/clamsproject/clams-python:$CLAMS_VERSION
3
3
  # See https://github.com/orgs/clamsproject/packages?tab=packages&q=clams-python for more base images
4
- # IF you want to automatically publish this image to the clamsproject organization,
4
+ # IF you want to automatically publish this image to the clamsproject organization,
5
5
  # 1. you should have generated this template without --no-github-actions flag
6
- # 1. to add arm64 support, change relevant line in .github/workflows/container.yml
7
- # * NOTE that a lots of software doesn't install/compile or run on arm64 architecture out of the box
8
- # * make sure you locally test the compatibility of all software dependencies before using arm64 support
6
+ # 1. to add arm64 support, change relevant line in .github/workflows/container.yml
7
+ # * NOTE that a lots of software doesn't install/compile or run on arm64 architecture out of the box
8
+ # * make sure you locally test the compatibility of all software dependencies before using arm64 support
9
9
  # 1. use a git tag to trigger the github action. You need to use git tag to properly set app version anyway
10
10
 
11
11
  ################################################################################
@@ -15,17 +15,17 @@ ENV CLAMS_APP_VERSION ${CLAMS_APP_VERSION}
15
15
  ################################################################################
16
16
 
17
17
  ################################################################################
18
- # This is duplicate from the base image Containerfile
18
+ # This is duplicate from the base image Containerfile
19
19
  # but makes sure the cache directories are consistent across all CLAMS apps
20
20
 
21
21
  # https://github.com/openai/whisper/blob/ba3f3cd54b0e5b8ce1ab3de13e32122d0d5f98ab/whisper/__init__.py#L130
22
- ENV XDG_CACHE_HOME='/cache'
22
+ ENV XDG_CACHE_HOME='/cache'
23
23
  # https://huggingface.co/docs/huggingface_hub/main/en/package_reference/environment_variables#hfhome
24
24
  ENV HF_HOME="/cache/huggingface"
25
25
  # https://pytorch.org/docs/stable/hub.html#where-are-my-downloaded-models-saved
26
26
  ENV TORCH_HOME="/cache/torch"
27
27
 
28
- RUN mkdir /cache && rm -rf /root/.cache && ln -s /cache /root/.cache
28
+ RUN mkdir /cache ; rm -rf /root/.cache && ln -s /cache /root/.cache
29
29
  ################################################################################
30
30
 
31
31
  ################################################################################
@@ -37,8 +37,8 @@ RUN mkdir /cache && rm -rf /root/.cache && ln -s /cache /root/.cache
37
37
  # main app installation
38
38
  COPY ./ /app
39
39
  WORKDIR /app
40
- RUN pip3 install -r requirements.txt
40
+ RUN pip3 install --no-cache-dir -r requirements.txt
41
41
 
42
- # default command to run the CLAMS app in a production server
42
+ # default command to run the CLAMS app in a production server
43
43
  CMD ["python3", "app.py", "--production"]
44
44
  ################################################################################
@@ -1,33 +1,33 @@
1
1
  # TO_DEVS: BURN AFTER READING
2
2
 
3
- Delete this section of the document once the app development is done, before publishing the repository.
3
+ Delete this section of the document once the app development is done, before publishing the repository.
4
4
 
5
5
  ---
6
- This skeleton code is a scaffolding for Python-based CLAMS app development. Specifically, it contains
6
+ This skeleton code is a scaffolding for Python-based CLAMS app development. Specifically, it contains
7
7
 
8
- 1. `app.py` and `metadata.py` to write the app
8
+ 1. `app.py` and `metadata.py` to write the app
9
9
  1. `requirements.txt` to specify python dependencies
10
10
  1. `Containerfile` to containerize the app and specify system dependencies
11
11
  1. `.gitignore` and `.dockerignore` files listing commonly ignored files
12
12
  1. an empty `LICENSE` file to replace with an actual license information of the app
13
13
  1. This `README.md` file for additional information not specified in the general user manual at https://apps.clams.ai/clamsapp
14
- 1. A number of GitHub Actions workflows for issue/bug-report management
14
+ 1. A number of GitHub Actions workflows for issue/bugreport management
15
15
  1. A GHA workflow to publish app images upon any push of a git tag
16
16
  * **NOTE**: All GHA workflows included are designed to only work in repositories under `clamsproject` organization.
17
17
 
18
18
  Before pushing your first commit, please make sure to delete this section of the document.
19
19
 
20
- Then use the following section to document any additional information specific to this app. If your app works significantly different from what's described in the generic readme file, be as specific as possible.
20
+ Then use the following section to document any additional information specific to this app. If your app works significantly different from what's described in the generic readme file, be as specific as possible.
21
21
 
22
22
 
23
- > **warning**
23
+ > **warning**
24
24
  > TO_DEVS: Delete these `TO_DEVS` notes and warnings before publishing the repository.
25
25
 
26
26
  ---
27
27
 
28
28
  # $APP_NAME
29
29
 
30
- > **warning**
30
+ > **warning**
31
31
  > TO_DEVS: Again, delete these `TO_DEVS` notes and warnings before publishing the repository.
32
32
 
33
33
  ## Description
@@ -37,11 +37,11 @@ Then use the following section to document any additional information specific t
37
37
 
38
38
  ## User instruction
39
39
 
40
- General user instructions for CLAMS apps is available at [CLAMS Apps documentation](https://apps.clams.ai/clamsapp).
40
+ General user instructions for CLAMS apps are available at [CLAMS Apps documentation](https://apps.clams.ai/clamsapp).
41
41
 
42
42
  Below is a list of additional information specific to this app.
43
43
 
44
- > **note**
44
+ > **note**
45
45
  > TO_DEVS: Below is a list of additional information specific to this app.
46
46
 
47
47
 
@@ -57,7 +57,7 @@ Below is a list of additional information specific to this app.
57
57
 
58
58
  ### Configurable runtime parameter
59
59
 
60
- For the full list of parameters, please refer to the app metadata from [CLAMS App Directory](https://apps.clams.ai) or [`metadata.py`](metadata.py) file in this repository.
60
+ For the full list of parameters, please refer to the app metadata from the [CLAMS App Directory](https://apps.clams.ai) or the [`metadata.py`](metadata.py) file in this repository.
61
61
 
62
62
  > **warning**
63
63
  > TO_DEVS: If you're not developing this app for publishing on the CLAMS App Directory, the above paragraph is not applicable. Feel free to delete or change it.
@@ -6,7 +6,7 @@ app.py Template
6
6
  The app.py script does several things:
7
7
  - import the necessary code
8
8
  - create a subclass of ClamsApp that defines the metadata and provides a method to run the wrapped NLP tool
9
- - provide a way to run the code as a RESTful Flask service
9
+ - provide a way to run the code as a RESTful Flask service
10
10
 
11
11
 
12
12
  """
@@ -31,8 +31,8 @@ class $APP_CLASS_NAME(ClamsApp):
31
31
 
32
32
  def _appmetadata(self):
33
33
  # see https://sdk.clams.ai/autodoc/clams.app.html#clams.app.ClamsApp._load_appmetadata
34
- # Also check out ``metadata.py`` in this directory.
35
- # When using the ``metadata.py`` leave this do-nothing "pass" method here.
34
+ # Also check out ``metadata.py`` in this directory.
35
+ # When using the ``metadata.py`` leave this do-nothing "pass" method here.
36
36
  pass
37
37
 
38
38
  def _annotate(self, mmif: Mmif, **parameters) -> Mmif:
@@ -41,14 +41,14 @@ class $APP_CLASS_NAME(ClamsApp):
41
41
 
42
42
  def get_app():
43
43
  """
44
- This function effectively creates an instance of the app class, without any arguments passed in, meaning, any
44
+ This function effectively creates an instance of the app class, without any arguments passed in, meaning, any
45
45
  external information such as initial app configuration should be set without using function arguments. The easiest
46
- way to do this is to set global variables before calling this.
46
+ way to do this is to set global variables before calling this.
47
47
  """
48
- # for example:
48
+ # for example:
49
49
  # return $APP_CLASS_NAME(create, from, global, params)
50
50
  raise NotImplementedError
51
-
51
+
52
52
 
53
53
  if __name__ == "__main__":
54
54
  parser = argparse.ArgumentParser()
@@ -57,7 +57,7 @@ def metadata_to_argparser(app_metadata: AppMetadata) -> argparse.ArgumentParser:
57
57
  'open.',
58
58
  # will check if stdin is a keyboard, and return None if it is
59
59
  default=None if sys.stdin.isatty() else sys.stdin)
60
- parser.add_argument('OUT_MMIF_FILE', nargs='?', type=argparse.FileType('w'),
60
+ parser.add_argument('OUT_MMIF_FILE', nargs='?', type=argparse.FileType('w'),
61
61
  help='output MMIF file path, or STDOUT if `-` or not provided. NOTE: When this is set to '
62
62
  'STDOUT, any print statements in the app code will be redirected to stderr.',
63
63
  default=sys.stdout)
@@ -1,5 +1,5 @@
1
1
  """
2
- The purpose of this file is to define the metadata of the app with minimal imports.
2
+ The purpose of this file is to define the metadata of the app with minimal imports.
3
3
 
4
4
  DO NOT CHANGE the name of the file
5
5
  """
@@ -10,12 +10,12 @@ from clams.app import ClamsApp
10
10
  from clams.appmetadata import AppMetadata
11
11
 
12
12
 
13
- # DO NOT CHANGE the function name
13
+ # DO NOT CHANGE the function name
14
14
  def appmetadata() -> AppMetadata:
15
15
  """
16
16
  Function to set app-metadata values and return it as an ``AppMetadata`` obj.
17
17
  Read these documentations before changing the code below
18
- - https://sdk.clams.ai/appmetadata.html metadata specification.
18
+ - https://sdk.clams.ai/appmetadata.html metadata specification.
19
19
  - https://sdk.clams.ai/autodoc/clams.appmetadata.html python API
20
20
 
21
21
  :return: AppMetadata object holding all necessary information.
@@ -26,7 +26,7 @@ def appmetadata() -> AppMetadata:
26
26
  name="$APP_NAME",
27
27
  description="", # briefly describe what the purpose and features of the app
28
28
  app_license="", # short name for a software license like MIT, Apache2, GPL, etc.
29
- identifier="$APP_IDENTIFIER", # should be a single string without whitespaces. If you don't intent to publish this app to the CLAMS app-directory, please use a full IRI format.
29
+ identifier="$APP_IDENTIFIER", # should be a single string without whitespaces. If you don't intent to publish this app to the CLAMS app-directory, please use a full IRI format.
30
30
  url="https://fakegithub.com/some/repository", # a website where the source code and full documentation of the app is hosted
31
31
  # (if you are on the CLAMS team, this MUST be "https://github.com/clamsproject/app-$APP_IDENTIFIER"
32
32
  # (see ``.github/README.md`` file in this directory for the reason)
@@ -0,0 +1 @@
1
+ __version__ = "1.2.5"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: clams-python
3
- Version: 1.2.3
3
+ Version: 1.2.5
4
4
  Summary: A collection of APIs to develop CLAMS app for python
5
5
  Home-page: https://clams.ai
6
6
  Author: Brandeis Lab for Linguistics and Computation
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
14
14
  Requires-Python: >=3.8
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
- Requires-Dist: mmif-python==1.0.15
17
+ Requires-Dist: mmif-python==1.0.17
18
18
  Requires-Dist: Flask>=2
19
19
  Requires-Dist: Flask-RESTful>=0.3.9
20
20
  Requires-Dist: gunicorn>=20
@@ -1,4 +1,4 @@
1
- mmif-python==1.0.15
1
+ mmif-python==1.0.17
2
2
  Flask>=2
3
3
  Flask-RESTful>=0.3.9
4
4
  gunicorn>=20
@@ -1,4 +1,4 @@
1
- mmif-python==1.0.15
1
+ mmif-python==1.0.17
2
2
 
3
3
  Flask>=2
4
4
  Flask-RESTful>=0.3.9
@@ -10,6 +10,7 @@ from typing import Union
10
10
  import jsonschema
11
11
  import pytest
12
12
  from mmif import Mmif, Document, DocumentTypes, AnnotationTypes, View, __specver__
13
+ from mmif.serialize.mmif import ViewsList
13
14
 
14
15
  import clams.app
15
16
  import clams.restify
@@ -352,14 +353,16 @@ class TestClamsApp(unittest.TestCase):
352
353
  self.app._refine_params(param1=['p1'], param4=['4'])
353
354
 
354
355
  def test_error_handling(self):
355
- params = {'raise_error': 'true', 'pretty': 'true'}
356
+ params = {'raise_error': ['true'], 'pretty': ['true']}
356
357
  in_mmif = Mmif(self.in_mmif)
357
358
  try:
358
359
  out_mmif = self.app.annotate(in_mmif, **params)
359
360
  except Exception as e:
360
361
  out_mmif_from_str = self.app.set_error_view(self.in_mmif, **params)
361
362
  out_mmif_from_mmif = self.app.set_error_view(in_mmif, **params)
362
- self.assertEqual(out_mmif_from_mmif.views, out_mmif_from_str.views)
363
+ self.assertEqual(
364
+ out_mmif_from_mmif.views.get_last(),
365
+ out_mmif_from_str.views.get_last())
363
366
  out_mmif = out_mmif_from_str
364
367
  self.assertIsNotNone(out_mmif)
365
368
  last_view: View = next(reversed(out_mmif.views))
@@ -1 +0,0 @@
1
- 1.2.3
@@ -1 +0,0 @@
1
- __version__ = "1.2.3"
File without changes
File without changes
File without changes
File without changes
File without changes