ckanapi-harvesters 0.0.0__py3-none-any.whl
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.
- ckanapi_harvesters/__init__.py +15 -0
- ckanapi_harvesters/divider/__init__.py +27 -0
- ckanapi_harvesters/divider/divider.py +53 -0
- ckanapi_harvesters/divider/divider_error.py +59 -0
- ckanapi_harvesters/main.py +30 -0
- ckanapi_harvesters-0.0.0.dist-info/METADATA +186 -0
- ckanapi_harvesters-0.0.0.dist-info/RECORD +9 -0
- ckanapi_harvesters-0.0.0.dist-info/WHEEL +5 -0
- ckanapi_harvesters-0.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Module for demonstrating a simple 'Hello World' function.
|
|
3
|
+
|
|
4
|
+
This module imports the hello_world function from the main module
|
|
5
|
+
and makes it available for public use.
|
|
6
|
+
|
|
7
|
+
Functions
|
|
8
|
+
---------
|
|
9
|
+
hello_world()
|
|
10
|
+
Print 'Hello World!' to the console.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from .main import hello_world
|
|
14
|
+
|
|
15
|
+
__all__ = ['hello_world']
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Module for division operations and custom exceptions.
|
|
3
|
+
|
|
4
|
+
This module provides functions and exceptions related to division operations.
|
|
5
|
+
It imports the `divide` function and the `CantDivideByZeroError` exception from
|
|
6
|
+
other modules and makes them available for use in this module.
|
|
7
|
+
|
|
8
|
+
Functions
|
|
9
|
+
---------
|
|
10
|
+
divide(a, b)
|
|
11
|
+
Divide two numbers, raising a custom exception if the divisor is zero.
|
|
12
|
+
|
|
13
|
+
Exceptions
|
|
14
|
+
----------
|
|
15
|
+
CantDivideByZeroError
|
|
16
|
+
Raised when an attempt is made to divide by zero.
|
|
17
|
+
|
|
18
|
+
Imports
|
|
19
|
+
--------
|
|
20
|
+
- divide: Function for performing division operations.
|
|
21
|
+
- CantDivideByZeroError: Exception raised for division by zero errors.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
from .divider import divide
|
|
25
|
+
from .divider_error import CantDivideByZeroError
|
|
26
|
+
|
|
27
|
+
__all__ = ['divide', 'CantDivideByZeroError']
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Module for division operations with custom exceptions.
|
|
3
|
+
|
|
4
|
+
This module provides a function for performing division
|
|
5
|
+
and raises a custom exception when attempting to divide by zero.
|
|
6
|
+
|
|
7
|
+
Functions
|
|
8
|
+
---------
|
|
9
|
+
divide(a, b)
|
|
10
|
+
Divide two numbers, raising a custom exception if the divisor is zero.
|
|
11
|
+
|
|
12
|
+
Exceptions
|
|
13
|
+
----------
|
|
14
|
+
CantDivideByZeroError
|
|
15
|
+
Raised when an attempt is made to divide by zero.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from .divider_error import CantDivideByZeroError
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def divide(a, b):
|
|
22
|
+
"""
|
|
23
|
+
Divide two numbers, raising a custom exception if the divisor is zero.
|
|
24
|
+
|
|
25
|
+
Parameters
|
|
26
|
+
----------
|
|
27
|
+
a : float
|
|
28
|
+
The dividend.
|
|
29
|
+
b : float
|
|
30
|
+
The divisor.
|
|
31
|
+
|
|
32
|
+
Returns
|
|
33
|
+
-------
|
|
34
|
+
float
|
|
35
|
+
The result of the division.
|
|
36
|
+
|
|
37
|
+
Raises
|
|
38
|
+
------
|
|
39
|
+
CantDivideByZeroError
|
|
40
|
+
If the divisor (b) is zero.
|
|
41
|
+
|
|
42
|
+
Examples
|
|
43
|
+
--------
|
|
44
|
+
>>> divide(10, 2)
|
|
45
|
+
5.0
|
|
46
|
+
>>> divide(10, 0)
|
|
47
|
+
Traceback (most recent call last):
|
|
48
|
+
...
|
|
49
|
+
CantDivideByZeroError
|
|
50
|
+
"""
|
|
51
|
+
if b == 0:
|
|
52
|
+
raise CantDivideByZeroError()
|
|
53
|
+
return a / b
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Module for custom exceptions related to calculator operations.
|
|
3
|
+
|
|
4
|
+
This module defines custom exceptions used in calculator operations,
|
|
5
|
+
including a base exception class and a specific exception for division by zero errors.
|
|
6
|
+
|
|
7
|
+
Classes
|
|
8
|
+
-------
|
|
9
|
+
CalculatorError
|
|
10
|
+
Base class for exceptions in calculator operations.
|
|
11
|
+
CantDivideByZeroError
|
|
12
|
+
Exception raised when an attempt is made to divide by zero.
|
|
13
|
+
|
|
14
|
+
Exceptions
|
|
15
|
+
----------
|
|
16
|
+
CalculatorError
|
|
17
|
+
Base class for exceptions in the calculator domain.
|
|
18
|
+
CantDivideByZeroError
|
|
19
|
+
Raised specifically for division by zero errors.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class CalculatorError(Exception):
|
|
24
|
+
"""
|
|
25
|
+
Base class for exceptions in calculator operations.
|
|
26
|
+
|
|
27
|
+
This class is intended to be used as a base class for other calculator-related
|
|
28
|
+
exceptions. It inherits from the built-in Exception class and allows for custom
|
|
29
|
+
exception handling in the calculator domain.
|
|
30
|
+
|
|
31
|
+
Parameters
|
|
32
|
+
----------
|
|
33
|
+
args : tuple
|
|
34
|
+
Variable length argument list passed to the base Exception class.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
def __init__(self, *args):
|
|
38
|
+
super().__init__(args)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class CantDivideByZeroError(CalculatorError):
|
|
42
|
+
"""
|
|
43
|
+
Exception raised when an attempt is made to divide by zero.
|
|
44
|
+
|
|
45
|
+
This exception is a specific subclass of CalculatorError and is intended to be
|
|
46
|
+
used when a division by zero error occurs. It provides a custom error message
|
|
47
|
+
indicating that division by zero is not allowed.
|
|
48
|
+
|
|
49
|
+
Parameters
|
|
50
|
+
----------
|
|
51
|
+
None
|
|
52
|
+
|
|
53
|
+
Notes
|
|
54
|
+
-----
|
|
55
|
+
The default message for this exception is "tu ne peux pas diviser par zéro".
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
def __init__(self):
|
|
59
|
+
super().__init__('tu ne peux pas diviser par zéro')
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Module containing simple demonstration functions.
|
|
3
|
+
|
|
4
|
+
This module provides basic example functions to demonstrate
|
|
5
|
+
simple Python functionality.
|
|
6
|
+
|
|
7
|
+
Functions
|
|
8
|
+
---------
|
|
9
|
+
hello_world()
|
|
10
|
+
Print 'Hello World!' to the console.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def hello_world():
|
|
15
|
+
"""
|
|
16
|
+
Print 'Hello World!' to the console.
|
|
17
|
+
|
|
18
|
+
Parameters
|
|
19
|
+
----------
|
|
20
|
+
None
|
|
21
|
+
|
|
22
|
+
Returns
|
|
23
|
+
-------
|
|
24
|
+
None
|
|
25
|
+
|
|
26
|
+
Notes
|
|
27
|
+
-----
|
|
28
|
+
- This function simply prints the message 'Hello World!' to the standard output.
|
|
29
|
+
"""
|
|
30
|
+
print('Hello World!')
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ckanapi_harvesters
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Adaptation of the template for github.
|
|
5
|
+
License: MIT License
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2024 ifpen
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
28
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
29
|
+
Classifier: Operating System :: OS Independent
|
|
30
|
+
Requires-Python: >=3.12
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
Requires-Dist: pytest==8.0.1
|
|
33
|
+
|
|
34
|
+
# ckanapi_harvesters
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Description
|
|
39
|
+
|
|
40
|
+
This "Python Package" template is a complete template designed to create a Python package according to IFPEN's development standards, deployable internally within IFPEN or on the Cloud. This template provides developers with a Python project architecture in which they can contribute, document, and make it available to all IFPEN developers.
|
|
41
|
+
|
|
42
|
+
This package includes:
|
|
43
|
+
- A unit test structure based on the [Pytest](https://docs.pytest.org/en/stable/) library
|
|
44
|
+
- Automatic documentation generation based on the [Sphinx](https://www.sphinx-doc.org/en/master/) library
|
|
45
|
+
- A CI/CD pipeline for deploying the Python package to a Python server
|
|
46
|
+
|
|
47
|
+
## Github Pages
|
|
48
|
+
|
|
49
|
+
Your automaticly generated documentation (with Sphinx) is [Here](https://mobidec.github.io/ckanapi_harvesters/)
|
|
50
|
+
|
|
51
|
+
## Python Package Template Architecture
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
.
|
|
56
|
+
├── sphinx
|
|
57
|
+
│ ├── conf.py
|
|
58
|
+
│ │ └── Sphinx documentation configuration file
|
|
59
|
+
│ └── index.rst
|
|
60
|
+
│ └── Root file for Sphinx documentation, structuring and linking source documents into complete documentation.
|
|
61
|
+
├── src
|
|
62
|
+
│ └── ckanapi_harvesters
|
|
63
|
+
│ ├── __init__.py
|
|
64
|
+
│ ├── main.py
|
|
65
|
+
│ │ └── Main file of your package, it references what is usable in your package
|
|
66
|
+
│ └── module_name
|
|
67
|
+
│ ├── __init__.py
|
|
68
|
+
│ └── module.py
|
|
69
|
+
│ └── Module file, each module holds a logic of the package
|
|
70
|
+
├── tests
|
|
71
|
+
│ └── Directory for testing the package and verifying that everything works
|
|
72
|
+
├── .gitattributes
|
|
73
|
+
│ └── Ensures that all text files use LF as the line ending, improving consistency across different development environments.
|
|
74
|
+
├── .bumpversion.toml
|
|
75
|
+
│ └── Configuration file for bumping the package version
|
|
76
|
+
├── .gitignore
|
|
77
|
+
│ └── File explicitly instructed for Git to ignore
|
|
78
|
+
├── .github
|
|
79
|
+
│ └── workflows
|
|
80
|
+
│ └── Github Ci/CD files
|
|
81
|
+
├── .pre-commit-config.yaml
|
|
82
|
+
│ └── Pre-commit configuration file
|
|
83
|
+
├── CONTRIBUTING.md
|
|
84
|
+
│ └── Contribution guidelines file
|
|
85
|
+
├── LICENSE
|
|
86
|
+
├── README.md
|
|
87
|
+
│ └── File with general information about the project
|
|
88
|
+
├── pyproject.toml
|
|
89
|
+
│ └── Package configuration file
|
|
90
|
+
└── tox.ini
|
|
91
|
+
└── Configuration file for `tox`, used to automate testing and linting tasks across multiple Python environments. This file is configured to use Python 3.12 and runs commands for the linter `ruff` as well as for tests with `pytest`. The specified commands check code style, format files according to defined standards, and run unit tests to ensure the code works as expected. This file is also used to facilitate version management tasks with `bump-my-version`.
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Getting Started
|
|
95
|
+
|
|
96
|
+
### Prerequisites
|
|
97
|
+
|
|
98
|
+
This project requires **Python 3.12**. Python 3.12 introduces many new features and improvements that are essential for the proper functioning of this project. Ensure that Python is correctly installed on your system by running `python --version`.
|
|
99
|
+
|
|
100
|
+
### About the `pyproject.toml` File
|
|
101
|
+
|
|
102
|
+
The `pyproject.toml` file is a central configuration file for the Python project. It contains TOML tables specifying the basic metadata of the project, the dependencies needed to build your project, and specific configurations for the tools used.
|
|
103
|
+
The `[project]` table is used to specify the basic metadata of your project, such as dependencies, your name, etc. The `[tool]` table contains sub-tables specific to each tool, such as `[tool.setuptools]` or `[tool.ruff]`. For more information on configuring your `pyproject.toml`, refer to the [Python documentation](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/).
|
|
104
|
+
|
|
105
|
+
### Installing Dependencies
|
|
106
|
+
|
|
107
|
+
The `pyproject.toml` file is used to manage the dependencies of this project. To install these dependencies, follow these steps:
|
|
108
|
+
|
|
109
|
+
1. Open a terminal and navigate to the project directory.
|
|
110
|
+
2. Run the command `pip install .` to install the necessary dependencies for the project.
|
|
111
|
+
|
|
112
|
+
This process ensures that all required dependencies are correctly installed in your environment, allowing you to work on the project with all necessary resources.
|
|
113
|
+
|
|
114
|
+
To add or modify project dependencies, you must list them in your `pyproject.toml` file under the `dependencies` section.
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
dependencies = [
|
|
118
|
+
"pytest == 8.0.1",
|
|
119
|
+
# add necessary dependencies
|
|
120
|
+
]
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Developing the Package
|
|
124
|
+
|
|
125
|
+
The `CONTRIBUTING.md` file is an essential guide for developing this Python package. It describes the steps to set up the development environment, the coding conventions to follow, and how to submit changes.
|
|
126
|
+
Once your changes are ready, push your contribution to the desired branch to trigger the integration pipeline, which will create the Python package and deploy it to the Python server.
|
|
127
|
+
For more details on contributing and best practices, please refer to the `CONTRIBUTING.md` file.
|
|
128
|
+
|
|
129
|
+
## Using the Python Package
|
|
130
|
+
|
|
131
|
+
### Installation
|
|
132
|
+
|
|
133
|
+
If you are using the provided `pip.conf`, you can simply run:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
pip install ckanapi_harvesters
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Otherwise, you can specify the package index depending on whether you are in an internal (on-premise) or external (cloud) environment.
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# On-premise
|
|
143
|
+
pip install ckanapi_harvesters --extra-index-url https://nexus.ifpen.fr/repository/fast-it/simple
|
|
144
|
+
|
|
145
|
+
# On Cloud
|
|
146
|
+
pip install ckanapi_harvesters --extra-index-url https://nexus.fastit.dev/repository/fast-it/simple
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Alternatively, you can set the package index URL as an environment variable:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# On-premise
|
|
153
|
+
export PIP_EXTRA_INDEX_URL=https://nexus.fastit.dev/repository/fast-it/simple
|
|
154
|
+
|
|
155
|
+
# On Cloud
|
|
156
|
+
export PIP_EXTRA_INDEX_URL=https://nexus.ifpen.fr/repository/fast-it/simple
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Example Usage of the Python Package in Your Code
|
|
160
|
+
|
|
161
|
+
After installation, you can import and use your package and its functions in your Python code:
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
from package import hello_world
|
|
165
|
+
|
|
166
|
+
hello_world()
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
To use sub-modules defined in the package:
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
from package.divider import divide
|
|
173
|
+
|
|
174
|
+
a = 4.0
|
|
175
|
+
b = 2.0
|
|
176
|
+
|
|
177
|
+
c = divide(4., 2.)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
These instructions will allow you to access the package and utilize its features effectively and in line with your development configuration.
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
This project is licensed under the MIT License, which means it is freely usable for personal and commercial purposes. The MIT License is one of the most permissive open source licenses. It allows you to do almost anything with the source code, as long as you retain the original license notice and copyright information when redistributing the software or substantial portions of it. This license comes without any warranties, so the software is provided "as is." For more details, please refer to the included LICENSE file.
|
|
185
|
+
|
|
186
|
+
---
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
ckanapi_harvesters/__init__.py,sha256=7CSKdr6QTzRii9ZgPOVpInDaT8up2AlLE603waA6rFU,306
|
|
2
|
+
ckanapi_harvesters/main.py,sha256=6BKP4FfCnsPApGT8F8sodpllBde7X55UkifXXMVY1Bw,508
|
|
3
|
+
ckanapi_harvesters/divider/__init__.py,sha256=Q93V1V4x_TVm5uMBkJIeynFYBa_PpRzc8nQ4O4mtHC4,761
|
|
4
|
+
ckanapi_harvesters/divider/divider.py,sha256=6he0tD5NeCbeVL1eWmRhU5R34h-H2fB-JFE-Ztk60-8,1038
|
|
5
|
+
ckanapi_harvesters/divider/divider_error.py,sha256=S0gdUN6RtSthnZ4NB9_UhKmZDQjEnlS3F9IiGfnEFV0,1659
|
|
6
|
+
ckanapi_harvesters-0.0.0.dist-info/METADATA,sha256=qiQRIkfzQhpjhp3sM5Jqjv42HATK4x_z9g1oF4TuK1o,8448
|
|
7
|
+
ckanapi_harvesters-0.0.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
8
|
+
ckanapi_harvesters-0.0.0.dist-info/top_level.txt,sha256=WvJprCJXBEK-Eew36dTdVdt9I_r4AdgA2Kur3RhLTPg,19
|
|
9
|
+
ckanapi_harvesters-0.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ckanapi_harvesters
|