Skip to content

Commit c58af97

Browse files
authored
Merge pull request #111 from gorimaaa/python
Python modifications
2 parents 15f1247 + b05f7f2 commit c58af97

File tree

13 files changed

+1960
-48
lines changed

13 files changed

+1960
-48
lines changed

python/LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2018 The Python Packaging Authority
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

python/README.md

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,49 @@
1-
# kuliya for python
2-
## **How to Use**
3-
1. **Run the script** with the JSON file path as an argument:
4-
```bash
5-
python3 main.py <path-to-json-file>
6-
```
1+
# kulya_python
2+
3+
`kulya_python` is a Python package designed to facilitate access to structured JSON data as part of the Kulya project. It allows you to retrieve information from a centralized JSON file.
4+
5+
## Installation
6+
7+
To install `kulya_python`, you can use `pip`:
8+
9+
```bash
10+
pip install kulya_python
11+
```
12+
13+
## Usage
14+
15+
Here is a simple example of how to use the kulya_python package:
16+
17+
```python
18+
from kulya_python import getNodeByPath
19+
20+
# Example usage to retrieve a specific node
21+
node = getNodeByPath('umkb/fst')
22+
print(node.getNameFr())
23+
```
24+
25+
## Developers
26+
27+
If you want to reload the data.json (because \_data changed), set `DEVELOPMENT_MODE` to True and call `getNodeByPath(anypath)` below utils.py
28+
29+
## How to publish the package
30+
31+
Get into the root folder where `pyproject.toml` is and do these steps :
32+
`py -m build`
33+
`pip install -U packaging` (debug for twine)
34+
`py -m pip install --upgrade twine`
35+
`py -m twine upload dist/*` put your API token when asked
36+
You can then access to the package with
37+
`pip install [package-name]`
38+
39+
## Project Structure
40+
41+
kulya_python/: Main package directory.
42+
utils.py: Contains utility functions, including getNodeByPath.
43+
node.py: Defines the Node class used to encapsulate JSON data.
44+
data.json: Centralized JSON file containing the necessary data.
45+
46+
## License
47+
48+
This project is licensed under the MIT License. See the LICENSE file for details.
49+
Contact
11.3 KB
Binary file not shown.
9.82 KB
Binary file not shown.

python/main.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

python/pyproject.toml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "kulya_python"
7+
version = "1.6"
8+
authors = [
9+
{ name="Gorimaaa" },
10+
]
11+
description = "A package to make the python part of the kulya project"
12+
readme = "README.md"
13+
requires-python = ">=3.8"
14+
classifiers = [
15+
"Programming Language :: Python :: 3",
16+
"Operating System :: OS Independent",
17+
]
18+
license = "MIT"
19+
license-files = ["LICEN[CS]E*"]
20+
21+
[project.urls]
22+
Homepage = "https://github.com/dzcode-io/kuliya"
23+
Issues = "https://github.com/dzcode-io/kuliya/issues"
24+
25+
[tool.hatch.build.targets.wheel]
26+
only-include = ["src/kulya_python", "data"]
27+
28+
[tool.hatch.build.targets.wheel.sources]
29+
"src" = ""
30+
"data" = "kulya_python/src/kulya_python/data.json"
31+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .utils import getNodeByPath

0 commit comments

Comments
 (0)