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.
@@ -1,6 +1,8 @@
1
1
  # PyLapi
2
2
 
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.
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
1
+ Metadata-Version: 2.4
2
2
  Name: pylapi
3
- Version: 0.12.16
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<1.27,>=1.21.1
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. 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.
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, replacing all variables accordingly.
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.
@@ -19,7 +19,7 @@ dynamic = ["version"]
19
19
 
20
20
  dependencies = [
21
21
  "magico>=1.0",
22
- "urllib3>=1.21.1,<1.27",
22
+ "urllib3>=1.26.16",
23
23
  "requests>=2.5",
24
24
  "PyYAML>=5.1",
25
25
  ]
@@ -26,7 +26,7 @@ setuptools.setup(
26
26
 
27
27
  install_requires=[
28
28
  "magico>=0.3.3",
29
- "urllib3>=1.21.1,<1.27",
29
+ "urllib3>=1.26.16",
30
30
  "requests>=2.5",
31
31
  "PyYAML>=5.1",
32
32
  ],
@@ -0,0 +1,5 @@
1
+ from .pylapi import *
2
+ from .magic_words import *
3
+ from .__version__ import __name__, __version__, __description__
4
+
5
+ __all__ = ["PyLapi", "PyLapiError", "MagicWords"]
@@ -1,5 +1,5 @@
1
1
  __name__ = "pylapi"
2
- __version__ = "0.12.16"
2
+ __version__ = "1.0.2"
3
3
  __description__ = "PyLapi - Python Lightweight API"
4
4
  __url__ = "https://github.com/jackyko8/pylapi"
5
5
  __author__ = "Jacky Ko"
@@ -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.to_dict()
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
@@ -28,7 +28,8 @@ logger.setLevel(config.log_level)
28
28
  # Literals
29
29
  #
30
30
 
31
-
31
+ # Simulating the `http` module in Python 3.11
32
+ # so that the code can work with a lower Python version
32
33
  class HTTPMethod(IntEnum):
33
34
  GET = 0
34
35
  HEAD = 1
@@ -1,30 +1,32 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pylapi
3
- Version: 0.12.16
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<1.27,>=1.21.1
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. 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.
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
 
@@ -8,6 +8,7 @@ src/pylapi/__version__.py
8
8
  src/pylapi/autogen.py
9
9
  src/pylapi/autogen_template.py
10
10
  src/pylapi/config.py
11
+ src/pylapi/magic_words.py
11
12
  src/pylapi/pylapi.py
12
13
  src/pylapi.egg-info/PKG-INFO
13
14
  src/pylapi.egg-info/SOURCES.txt
@@ -1,4 +1,4 @@
1
1
  magico>=1.0
2
- urllib3<1.27,>=1.21.1
2
+ urllib3>=1.26.16
3
3
  requests>=2.5
4
4
  PyYAML>=5.1
@@ -1 +0,0 @@
1
- from .pylapi import *
File without changes
File without changes
File without changes