elapi 1.0.5__tar.gz → 1.0.7.dev1__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 (60) hide show
  1. {elapi-1.0.5 → elapi-1.0.7.dev1}/PKG-INFO +30 -5
  2. {elapi-1.0.5 → elapi-1.0.7.dev1}/README.md +28 -4
  3. {elapi-1.0.5 → elapi-1.0.7.dev1}/pyproject.toml +2 -1
  4. elapi-1.0.7.dev1/src/elapi/VERSION +1 -0
  5. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/_names.py +6 -8
  6. elapi-1.0.7.dev1/src/elapi/api.py +552 -0
  7. elapi-1.0.7.dev1/src/elapi/cli/__init__.py +1 -0
  8. elapi-1.0.7.dev1/src/elapi/cli/_plugin_handler.py +44 -0
  9. elapi-1.0.7.dev1/src/elapi/cli/doc.py +86 -0
  10. elapi-1.0.7.dev1/src/elapi/cli/elapi.py +711 -0
  11. elapi-1.0.7.dev1/src/elapi/cli/helpers.py +78 -0
  12. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/configuration/__init__.py +4 -0
  13. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/configuration/config.py +11 -9
  14. elapi-1.0.7.dev1/src/elapi/endpoint.py +220 -0
  15. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/loggers/handlers/stderr.py +4 -1
  16. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/path.py +4 -2
  17. elapi-1.0.7.dev1/src/elapi/plugins/bill_teams/__init__.py +2 -0
  18. elapi-1.0.7.dev1/src/elapi/plugins/bill_teams/_doc.py +3 -0
  19. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/plugins/bill_teams/bill_teams.py +27 -21
  20. elapi-1.0.7.dev1/src/elapi/plugins/bill_teams/cli.py +143 -0
  21. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/plugins/bill_teams/invoice.py +2 -4
  22. elapi-1.0.7.dev1/src/elapi/plugins/experiments/__init__.py +3 -0
  23. elapi-1.0.7.dev1/src/elapi/plugins/experiments/_doc.py +24 -0
  24. elapi-1.0.7.dev1/src/elapi/plugins/experiments/cli.py +309 -0
  25. elapi-1.0.7.dev1/src/elapi/plugins/experiments/experiments.py +171 -0
  26. elapi-1.0.7.dev1/src/elapi/plugins/experiments/formats.py +77 -0
  27. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/plugins/show_config.py +5 -5
  28. elapi-1.0.7.dev1/src/elapi/plugins/utils/__init__.py +2 -0
  29. {elapi-1.0.5/src/elapi/plugins → elapi-1.0.7.dev1/src/elapi/plugins/utils}/export.py +17 -7
  30. elapi-1.0.7.dev1/src/elapi/plugins/utils/get_location_from_headers.py +27 -0
  31. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/styles/__init__.py +1 -0
  32. elapi-1.0.7.dev1/src/elapi/styles/base.py +4 -0
  33. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/styles/format.py +7 -11
  34. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/validators/identity.py +21 -27
  35. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/validators/permission.py +2 -2
  36. elapi-1.0.5/src/elapi/VERSION +0 -1
  37. elapi-1.0.5/src/elapi/api.py +0 -139
  38. elapi-1.0.5/src/elapi/cli/_doc.py +0 -43
  39. elapi-1.0.5/src/elapi/cli/elapi.py +0 -408
  40. elapi-1.0.5/src/elapi/endpoint.py +0 -77
  41. elapi-1.0.5/src/elapi/plugins/__init__.py +0 -0
  42. elapi-1.0.5/src/elapi/plugins/bill_teams/__init__.py +0 -3
  43. {elapi-1.0.5 → elapi-1.0.7.dev1}/LICENSE +0 -0
  44. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/__init__.py +0 -0
  45. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/cli/__main__.py +0 -0
  46. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/configuration/_config_history.py +0 -0
  47. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/configuration/log_file.py +0 -0
  48. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/loggers/__init__.py +0 -0
  49. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/loggers/base.py +0 -0
  50. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/loggers/handlers/__init__.py +0 -0
  51. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/loggers/handlers/file.py +0 -0
  52. {elapi-1.0.5/src/elapi/cli → elapi-1.0.7.dev1/src/elapi/plugins}/__init__.py +0 -0
  53. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/plugins/version.py +0 -0
  54. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/styles/_markdown_doc.py +0 -0
  55. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/styles/_missing.py +0 -0
  56. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/styles/colors.py +0 -0
  57. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/styles/highlight.py +0 -0
  58. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/validators/__init__.py +0 -0
  59. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/validators/base.py +0 -0
  60. {elapi-1.0.5 → elapi-1.0.7.dev1}/src/elapi/validators/path.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: elapi
3
- Version: 1.0.5
3
+ Version: 1.0.7.dev1
4
4
  Summary: elAPI is a powerful, extensible API interface to eLabFTW built for the University Computing Centre (URZ, FIRE division) at Universität Heidelberg.
5
5
  Home-page: https://www.urz.uni-heidelberg.de/en/service-catalogue/software-and-applications/elabftw
6
6
  License: AGPL-3.0-only
@@ -29,6 +29,7 @@ Classifier: Topic :: Utilities
29
29
  Requires-Dist: dynaconf (>=3.2.0,<4.0.0)
30
30
  Requires-Dist: httpx (>=0.24.1,<0.25.0)
31
31
  Requires-Dist: httpx-auth (>=0.17.0,<0.18.0)
32
+ Requires-Dist: mistune (>=3.0.2,<4.0.0)
32
33
  Requires-Dist: python-dateutil (>=2.8.2,<3.0.0)
33
34
  Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
34
35
  Requires-Dist: tenacity (>=8.2.3,<9.0.0)
@@ -54,12 +55,15 @@ $ elapi get users --id <id>
54
55
 
55
56
  ## Installation
56
57
 
57
- elAPI can be installed from PyPI. Make sure `pip` is not invoked from an active virtual environment.
58
+ Support for installing packages with `pip install --user` has been deprecated with the adoption of [PEP 688](https://peps.python.org/pep-0668/) on many systems like [Debian 12](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1030335#5).
59
+ We recommend [`pipx`](https://pipx.pypa.io/stable/) for installing elAPI.
58
60
 
59
- ```sh
60
- $ python3 -m pip install --user elapi
61
+ ```shell
62
+ $ pipx install elapi
61
63
  ```
62
64
 
65
+ Of course, `pip install --user elapi` might continue to work on some systems.
66
+
63
67
  ## Configuration
64
68
 
65
69
  elAPI needs to be configured first before we can do anything useful with it. elAPI supports a YAML configuration file in
@@ -126,7 +130,28 @@ $ elapi get experiments --export ~/Downoads/experiments.json
126
130
  We can create a new user by the name 'John Doe'.
127
131
 
128
132
  ```shell
129
- $ elapi post users -d '{"firstname": "John", "lastname": "Doe", "email": "test_test@itnerd.de"}'
133
+ $ elapi post users --id <user id> -d '{"firstname": "John", "lastname": "Doe", "email": "test_test@itnerd.de"}'
134
+ ```
135
+
136
+ ### `PATCH` requests
137
+
138
+ We can update an existing user's email address.
139
+
140
+ ```shell
141
+ $ elapi patch users --id <user id> -d '{"email": "new_email@itnerd.de"}'
142
+ ```
143
+
144
+ `patch` command allows us to make changes to eLabFTW server settings. E.g., we can update the time (in minutes)
145
+ after which the authentication cookie will expire.
146
+
147
+ ```shell
148
+ $ elapi patch config -d '{"cookie_validity_time": 43200}'
149
+ ```
150
+
151
+ We can publish an announcement to all the members.
152
+
153
+ ```shell
154
+ $ elapi patch config -d '{"announcement": "Notice: Server will be down tomorrow at midnight due to scheduled maintenance."}'
130
155
  ```
131
156
 
132
157
  ### Bill teams
@@ -17,12 +17,15 @@ $ elapi get users --id <id>
17
17
 
18
18
  ## Installation
19
19
 
20
- elAPI can be installed from PyPI. Make sure `pip` is not invoked from an active virtual environment.
20
+ Support for installing packages with `pip install --user` has been deprecated with the adoption of [PEP 688](https://peps.python.org/pep-0668/) on many systems like [Debian 12](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1030335#5).
21
+ We recommend [`pipx`](https://pipx.pypa.io/stable/) for installing elAPI.
21
22
 
22
- ```sh
23
- $ python3 -m pip install --user elapi
23
+ ```shell
24
+ $ pipx install elapi
24
25
  ```
25
26
 
27
+ Of course, `pip install --user elapi` might continue to work on some systems.
28
+
26
29
  ## Configuration
27
30
 
28
31
  elAPI needs to be configured first before we can do anything useful with it. elAPI supports a YAML configuration file in
@@ -89,7 +92,28 @@ $ elapi get experiments --export ~/Downoads/experiments.json
89
92
  We can create a new user by the name 'John Doe'.
90
93
 
91
94
  ```shell
92
- $ elapi post users -d '{"firstname": "John", "lastname": "Doe", "email": "test_test@itnerd.de"}'
95
+ $ elapi post users --id <user id> -d '{"firstname": "John", "lastname": "Doe", "email": "test_test@itnerd.de"}'
96
+ ```
97
+
98
+ ### `PATCH` requests
99
+
100
+ We can update an existing user's email address.
101
+
102
+ ```shell
103
+ $ elapi patch users --id <user id> -d '{"email": "new_email@itnerd.de"}'
104
+ ```
105
+
106
+ `patch` command allows us to make changes to eLabFTW server settings. E.g., we can update the time (in minutes)
107
+ after which the authentication cookie will expire.
108
+
109
+ ```shell
110
+ $ elapi patch config -d '{"cookie_validity_time": 43200}'
111
+ ```
112
+
113
+ We can publish an announcement to all the members.
114
+
115
+ ```shell
116
+ $ elapi patch config -d '{"announcement": "Notice: Server will be down tomorrow at midnight due to scheduled maintenance."}'
93
117
  ```
94
118
 
95
119
  ### Bill teams
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "elapi"
3
- version = "1.0.5"
3
+ version = "1.0.7-dev1"
4
4
  description = """elAPI is a powerful, extensible API interface to eLabFTW built for \
5
5
  the University Computing Centre (URZ, FIRE division) at Universität Heidelberg."""
6
6
  authors = [
@@ -40,6 +40,7 @@ typer = { extras = ["all"], version = "^0.9.0" }
40
40
  pyyaml = "^6.0.1"
41
41
  python-dateutil = "^2.8.2"
42
42
  tenacity = "^8.2.3"
43
+ mistune = "^3.0.2"
43
44
 
44
45
  [tool.poetry.group.dev.dependencies]
45
46
  ptpython = "^3.0.23"
@@ -0,0 +1 @@
1
+ 1.0.7-dev1
@@ -1,8 +1,5 @@
1
1
  import os
2
2
  from pathlib import Path
3
- from typing import Union
4
-
5
- from .path import ProperPath
6
3
 
7
4
  # variables with leading underscores here indicate that they are to be overwritten by config.py
8
5
  # In which case, import their counterparts from src/config.py
@@ -10,6 +7,7 @@ from .path import ProperPath
10
7
  APP_NAME: str = "elapi"
11
8
  LOG_FILE_NAME: str = f"{APP_NAME}.log"
12
9
  CONFIG_FILE_NAME: str = f"{APP_NAME}.yml"
10
+ DEFAULT_EXPORT_DATA_FORMAT: str = "json"
13
11
  user_home: Path = Path.home()
14
12
  cur_dir: Path = Path.cwd()
15
13
 
@@ -17,9 +15,9 @@ cur_dir: Path = Path.cwd()
17
15
  # https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
18
16
 
19
17
  # XDG and other convention variable definitions
20
- ENV_XDG_DATA_HOME: Union[ProperPath, Path, str] = "XDG_DATA_HOME"
21
- ENV_XDG_DOWNLOAD_DIR: Union[ProperPath, Path, str] = "XDG_DOWNLOAD_DIR"
22
- ENV_XDG_CONFIG_HOME: Union[ProperPath, Path, str] = "XDG_CONFIG_HOME"
18
+ ENV_XDG_DATA_HOME: str = "XDG_DATA_HOME"
19
+ ENV_XDG_DOWNLOAD_DIR: str = "XDG_DOWNLOAD_DIR"
20
+ ENV_XDG_CONFIG_HOME: str = "XDG_CONFIG_HOME"
23
21
  TMP_DIR: Path = Path(f"/var/tmp/{APP_NAME}")
24
22
 
25
23
  # Fallback definitions
@@ -30,8 +28,8 @@ FALLBACK_CONFIG_DIR: Path = user_home / ".config"
30
28
  # Configuration path definitions
31
29
  SYSTEM_CONFIG_LOC: Path = Path("/etc") / CONFIG_FILE_NAME
32
30
  LOCAL_CONFIG_LOC: Path = (
33
- os.getenv(ENV_XDG_CONFIG_HOME) or FALLBACK_CONFIG_DIR
34
- ) / CONFIG_FILE_NAME
31
+ Path(os.getenv(ENV_XDG_CONFIG_HOME, FALLBACK_CONFIG_DIR)) / CONFIG_FILE_NAME
32
+ )
35
33
  # In case, $XDG_CONFIG_HOME isn't defined in the machine, it falls back to $HOME/.config/elapi.yml
36
34
  PROJECT_CONFIG_LOC: Path = cur_dir / CONFIG_FILE_NAME
37
35