pylapi 0.12.16__tar.gz → 1.0.2__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.
- {pylapi-0.12.16 → pylapi-1.0.2}/OVERVIEW.md +3 -1
- {pylapi-0.12.16/src/pylapi.egg-info → pylapi-1.0.2}/PKG-INFO +10 -8
- {pylapi-0.12.16 → pylapi-1.0.2}/README.md +3 -2
- {pylapi-0.12.16 → pylapi-1.0.2}/pyproject.toml +1 -1
- {pylapi-0.12.16 → pylapi-1.0.2}/setup.py +1 -1
- pylapi-1.0.2/src/pylapi/__init__.py +5 -0
- {pylapi-0.12.16 → pylapi-1.0.2}/src/pylapi/__version__.py +1 -1
- {pylapi-0.12.16 → pylapi-1.0.2}/src/pylapi/autogen.py +2 -2
- pylapi-1.0.2/src/pylapi/magic_words.py +46 -0
- {pylapi-0.12.16 → pylapi-1.0.2}/src/pylapi/pylapi.py +2 -1
- {pylapi-0.12.16 → pylapi-1.0.2/src/pylapi.egg-info}/PKG-INFO +10 -8
- {pylapi-0.12.16 → pylapi-1.0.2}/src/pylapi.egg-info/SOURCES.txt +1 -0
- {pylapi-0.12.16 → pylapi-1.0.2}/src/pylapi.egg-info/requires.txt +1 -1
- pylapi-0.12.16/src/pylapi/__init__.py +0 -1
- {pylapi-0.12.16 → pylapi-1.0.2}/LICENSE +0 -0
- {pylapi-0.12.16 → pylapi-1.0.2}/setup.cfg +0 -0
- {pylapi-0.12.16 → pylapi-1.0.2}/src/pylapi/autogen_template.py +0 -0
- {pylapi-0.12.16 → pylapi-1.0.2}/src/pylapi/config.py +0 -0
- {pylapi-0.12.16 → pylapi-1.0.2}/src/pylapi.egg-info/dependency_links.txt +0 -0
- {pylapi-0.12.16 → pylapi-1.0.2}/src/pylapi.egg-info/entry_points.txt +0 -0
- {pylapi-0.12.16 → pylapi-1.0.2}/src/pylapi.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# PyLapi
|
|
2
2
|
|
|
3
|
-
Python Lightweight API (PyLapi) is a Python API builder.
|
|
3
|
+
Python Lightweight API (PyLapi) is a Python API builder.
|
|
4
|
+
|
|
5
|
+
It takes only a few seconds to automatically generate a Python API from OpenAPI specifications or less than an hour for an experienced Python developer to create a custom Python API.
|
|
4
6
|
|
|
5
7
|
You can drive PyLapi in an [automatic](https://github.com/jackyko8/pylapi/tree/main/tutorials/2.%20How%20to%20use%20a%20PyLapi%20API.ipynb), [semiautomatic](https://github.com/jackyko8/pylapi/tree/main/tutorials/5.%20PyLapi%20Generator%20Automation.ipynb), or [manual](https://github.com/jackyko8/pylapi/tree/main/tutorials/3.%20A%20ChatGPT%20Conversation%20with%20PyLapi.ipynb) way.
|
|
6
8
|
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pylapi
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Python Lightweight API (PyLapi)
|
|
5
5
|
Home-page: https://github.com/jackyko8/pylapi
|
|
6
6
|
Author: Jacky Ko
|
|
7
7
|
Author-email:
|
|
8
|
-
License: MIT
|
|
9
8
|
Project-URL: Changelog, https://github.com/jackyko8/pylapi/blob/main/RELEASE.md
|
|
10
9
|
Project-URL: Code, https://github.com/jackyko8/pylapi
|
|
11
10
|
Project-URL: Download, https://pypi.org/project/pylapi/
|
|
12
11
|
Project-URL: Homepage, https://www.pylapi.org/
|
|
13
12
|
Project-URL: Issue tracker, https://github.com/jackyko8/pylapi/issues
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
-
Classifier: Operating System :: OS Independent
|
|
17
13
|
Requires-Python: >=3.7
|
|
18
14
|
Description-Content-Type: text/markdown
|
|
19
15
|
License-File: LICENSE
|
|
20
16
|
Requires-Dist: magico>=1.0
|
|
21
|
-
Requires-Dist: urllib3
|
|
17
|
+
Requires-Dist: urllib3>=1.26.16
|
|
22
18
|
Requires-Dist: requests>=2.5
|
|
23
19
|
Requires-Dist: PyYAML>=5.1
|
|
20
|
+
Dynamic: author
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
Dynamic: requires-python
|
|
24
24
|
|
|
25
25
|
# PyLapi
|
|
26
26
|
|
|
27
|
-
Python Lightweight API (PyLapi) is a Python API builder.
|
|
27
|
+
Python Lightweight API (PyLapi) is a Python API builder.
|
|
28
|
+
|
|
29
|
+
It takes only a few seconds to automatically generate a Python API from OpenAPI specifications or less than an hour for an experienced Python developer to create a custom Python API.
|
|
28
30
|
|
|
29
31
|
You can drive PyLapi in an [automatic](https://github.com/jackyko8/pylapi/tree/main/tutorials/2.%20How%20to%20use%20a%20PyLapi%20API.ipynb), [semiautomatic](https://github.com/jackyko8/pylapi/tree/main/tutorials/5.%20PyLapi%20Generator%20Automation.ipynb), or [manual](https://github.com/jackyko8/pylapi/tree/main/tutorials/3.%20A%20ChatGPT%20Conversation%20with%20PyLapi.ipynb) way.
|
|
30
32
|
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Python Lightweight API (PyLapi) is a Python API builder. It takes only a few seconds to automatically generate a Python API from OpenAPI specifications or less than an hour for an experienced Python developer to create a custom Python API.
|
|
4
4
|
|
|
5
|
-
You can drive PyLapi in an [automatic](./tutorials/2.%20How%20to%20use%20a%20PyLapi%20API.ipynb), [semiautomatic](./tutorials/5.%20PyLapi%20Generator%20Automation.ipynb), or [manual](./tutorials/3.%20A%20ChatGPT%20Conversation%20with%20PyLapi.ipynb) way.
|
|
6
5
|
Here is an [overview](./OVERVIEW.md).
|
|
7
6
|
|
|
8
7
|
## Install PyLapi
|
|
9
8
|
|
|
10
|
-
Please follow these instructions to install PyLapi and its generator
|
|
9
|
+
Please follow these instructions to install PyLapi and its generator.
|
|
11
10
|
|
|
12
11
|
To install the PyLapi class:
|
|
13
12
|
```bash
|
|
@@ -24,6 +23,8 @@ pylapi-autogen myapi_config.py
|
|
|
24
23
|
# MyAPI generated and saved in ./myapi.py
|
|
25
24
|
```
|
|
26
25
|
|
|
26
|
+
Please replace `myapi_config.py` with the file name you want.
|
|
27
|
+
|
|
27
28
|
## More Information
|
|
28
29
|
|
|
29
30
|
PyLapi [tutorial](https://github.com/jackyko8/pylapi/blob/main/tutorials) and [user guide](https://github.com/jackyko8/pylapi/blob/main/user_guide) are available at the [PyLapi](https://github.com/jackyko8/pylapi) GitHub repository.
|
|
@@ -20,7 +20,7 @@ import os
|
|
|
20
20
|
from enum import IntEnum
|
|
21
21
|
from getopt import getopt, GetoptError
|
|
22
22
|
from magico import MagicO
|
|
23
|
-
|
|
23
|
+
from pylapi import MagicWords
|
|
24
24
|
|
|
25
25
|
# Defaults
|
|
26
26
|
debug = False
|
|
@@ -645,7 +645,7 @@ def gen_resource_classes(config, methods, classes):
|
|
|
645
645
|
|
|
646
646
|
# Handle left-over snippet classes
|
|
647
647
|
snippets_flats = []
|
|
648
|
-
snippets_dict = snippets.
|
|
648
|
+
snippets_dict = snippets.to_data()
|
|
649
649
|
for snippet_class in snippets_dict:
|
|
650
650
|
for snippet_code in snippets_dict[snippet_class]:
|
|
651
651
|
snippets_flats.append(f"{snippet_class}.{snippet_code}")
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from abc import ABC
|
|
2
|
+
import re
|
|
3
|
+
|
|
4
|
+
class MagicWords(ABC):
|
|
5
|
+
def __init__(self, phrase: str):
|
|
6
|
+
self.phrase = phrase
|
|
7
|
+
_phrase = phrase
|
|
8
|
+
# _phrase = re.sub(r"[-_./]", " ", _phrase)
|
|
9
|
+
_phrase = re.sub(r"[^a-zA-Z0-9]", " ", _phrase)
|
|
10
|
+
_phrase = re.sub(r"([A-Z])", " \\1", _phrase)
|
|
11
|
+
_phrase = re.sub(r" +", " ", _phrase)
|
|
12
|
+
_phrase = _phrase.strip()
|
|
13
|
+
self.words = [_.lower() for _ in _phrase.split(" ")]
|
|
14
|
+
|
|
15
|
+
@property
|
|
16
|
+
def snake(self) -> str:
|
|
17
|
+
return "_".join(self.words)
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def kebab(self) -> str:
|
|
21
|
+
return "-".join(self.words)
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
def upperCamel(self) -> str:
|
|
25
|
+
return "".join([_.capitalize() for _ in self.words])
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def lowerCamel(self) -> str:
|
|
29
|
+
return self.words[0] + "".join([_.capitalize() for _ in self.words[1:]])
|
|
30
|
+
|
|
31
|
+
@property
|
|
32
|
+
def pascal(self) -> str:
|
|
33
|
+
return self.upperCamel
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def camel(self) -> str:
|
|
37
|
+
return self.lowerCamel
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def singular(self) -> str:
|
|
41
|
+
_phrase = self.phrase
|
|
42
|
+
_phrase = re.sub(r"ies$", "y", _phrase)
|
|
43
|
+
_phrase = re.sub(r"ches$", "ch", _phrase)
|
|
44
|
+
_phrase = re.sub(r"shes$", "sh", _phrase)
|
|
45
|
+
_phrase = re.sub(r"s$", "", _phrase)
|
|
46
|
+
return _phrase
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pylapi
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Python Lightweight API (PyLapi)
|
|
5
5
|
Home-page: https://github.com/jackyko8/pylapi
|
|
6
6
|
Author: Jacky Ko
|
|
7
7
|
Author-email:
|
|
8
|
-
License: MIT
|
|
9
8
|
Project-URL: Changelog, https://github.com/jackyko8/pylapi/blob/main/RELEASE.md
|
|
10
9
|
Project-URL: Code, https://github.com/jackyko8/pylapi
|
|
11
10
|
Project-URL: Download, https://pypi.org/project/pylapi/
|
|
12
11
|
Project-URL: Homepage, https://www.pylapi.org/
|
|
13
12
|
Project-URL: Issue tracker, https://github.com/jackyko8/pylapi/issues
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
-
Classifier: Operating System :: OS Independent
|
|
17
13
|
Requires-Python: >=3.7
|
|
18
14
|
Description-Content-Type: text/markdown
|
|
19
15
|
License-File: LICENSE
|
|
20
16
|
Requires-Dist: magico>=1.0
|
|
21
|
-
Requires-Dist: urllib3
|
|
17
|
+
Requires-Dist: urllib3>=1.26.16
|
|
22
18
|
Requires-Dist: requests>=2.5
|
|
23
19
|
Requires-Dist: PyYAML>=5.1
|
|
20
|
+
Dynamic: author
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
Dynamic: requires-python
|
|
24
24
|
|
|
25
25
|
# PyLapi
|
|
26
26
|
|
|
27
|
-
Python Lightweight API (PyLapi) is a Python API builder.
|
|
27
|
+
Python Lightweight API (PyLapi) is a Python API builder.
|
|
28
|
+
|
|
29
|
+
It takes only a few seconds to automatically generate a Python API from OpenAPI specifications or less than an hour for an experienced Python developer to create a custom Python API.
|
|
28
30
|
|
|
29
31
|
You can drive PyLapi in an [automatic](https://github.com/jackyko8/pylapi/tree/main/tutorials/2.%20How%20to%20use%20a%20PyLapi%20API.ipynb), [semiautomatic](https://github.com/jackyko8/pylapi/tree/main/tutorials/5.%20PyLapi%20Generator%20Automation.ipynb), or [manual](https://github.com/jackyko8/pylapi/tree/main/tutorials/3.%20A%20ChatGPT%20Conversation%20with%20PyLapi.ipynb) way.
|
|
30
32
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .pylapi import *
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|