unitx 0.0.1__tar.gz → 0.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.
unitx-0.0.2/PKG-INFO ADDED
@@ -0,0 +1,258 @@
1
+ Metadata-Version: 2.4
2
+ Name: unitx
3
+ Version: 0.0.2
4
+ Summary: A Python library which dynamically converts different types of units
5
+ Author-email: devs_des1re <arjunbrij8811@gmail.com>
6
+ Maintainer-email: devs_des1re <arjunbrij8811@gmail.com>
7
+ License: Copyright (c) 2025 devs_des1re
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
+ Project-URL: Homepage, https://github.com/devs-des1re/unitx
27
+ Project-URL: Issues, https://github.com/devs-des1re/unitx/issues
28
+ Keywords: app,macOS,windows,linux,flatpak
29
+ Classifier: Development Status :: 4 - Beta
30
+ Classifier: Intended Audience :: Developers
31
+ Classifier: Operating System :: OS Independent
32
+ Classifier: Programming Language :: Python :: 3
33
+ Classifier: Programming Language :: Python :: 3.10
34
+ Classifier: Programming Language :: Python :: 3.11
35
+ Classifier: Programming Language :: Python :: 3.12
36
+ Classifier: Programming Language :: Python :: 3.13
37
+ Classifier: Programming Language :: Python :: 3.14
38
+ Classifier: Programming Language :: Python :: 3 :: Only
39
+ Classifier: Topic :: Software Development
40
+ Classifier: Topic :: Utilities
41
+ Requires-Python: >=3.10
42
+ Description-Content-Type: text/markdown
43
+ License-File: LICENSE
44
+ Dynamic: license-file
45
+
46
+ # unitx
47
+ [![version](https://img.shields.io/pypi/v/unitx.svg?colorB=blue)](https://pypi.org/project/unitx/)
48
+ [![pyversions](https://img.shields.io/pypi/pyversions/unitx.svg?)](https://pypi.org/project/unitx/)
49
+ [![codecov](https://codecov.io/gh/devs-des1re/unitx/branch/main/graph/badge.svg?token=YOUR_CODECOV_TOKEN)](https://codecov.io/gh/devs-des1re/unitx)
50
+
51
+ A Python library which dynamically converts different types of units.
52
+
53
+ # Installation
54
+ To install unitx you will need `Python >= 3.10`
55
+
56
+ Run:
57
+ ```
58
+ pip install unitx
59
+ ```
60
+
61
+ Or:
62
+ ```
63
+ python -m pip install unitx
64
+ ```
65
+
66
+ Also works for MacOS and Linux with `pip3`.
67
+
68
+ # Conversions
69
+ There are different functions in unitx which help convert for you!
70
+
71
+ ## Converting Distance
72
+ To convert distance, you'll use the `convert_distance` function. This also needs to be used with the enum class `Distance`.
73
+
74
+ ```py
75
+ from unitx import convert_distance, Distance
76
+
77
+ converted_value = convert_distance(5, Distance.MILES, Distance.KILOMETERS)
78
+ print(converted_value)
79
+ ```
80
+
81
+ ## Converting Mass
82
+ To convert mass, you'll use the `convert_mass` function. This also needs to be used with the enum class `Mass`.
83
+
84
+ ```py
85
+ from unitx import convert_mass, Mass
86
+
87
+ converted_value = convert_mass(1000, Mass.KILOGRAMS, Mass.TONNE)
88
+ print(converted_value)
89
+ ```
90
+
91
+ ## Converting Volume
92
+ To convert volume, you'll use the `convert_volume` function. This also needs to be used with the enum class `Volume`.
93
+
94
+ ```py
95
+ from unitx import convert_volume, Volume
96
+
97
+ converted_value = convert_volume(10, Volume.LITER, Volume.MILLILITER)
98
+ print(converted_value)
99
+ ```
100
+
101
+ ## Converting Temperature
102
+ To convert temperature, you'll use the `convert_temperature` function. This also needs to be used with the enum class `Temperature`.
103
+
104
+ **Note:** Units `kelvin` and `rankine` can also be converted
105
+
106
+ ```py
107
+ from unitx import convert_temperature, Temperature
108
+
109
+ convert_temperature(0, Temperature.CELSIUS, Temperature.FAHRENHEIT)
110
+ print(converted_value)
111
+ ```
112
+
113
+ ## Converting Area
114
+ To convert area, you'll use the `convert_area` function. This also needs to be used with the enum class `Area`.
115
+
116
+ ```py
117
+ from unitx import convert_Area, area
118
+
119
+ converted_value = convert_area(10, Area.SQUARE_KILOMETER, Area.SQUARE_METER)
120
+ print(converted_value)
121
+ ```
122
+
123
+ # Enums
124
+ What are `enums`? `Enums` in Python are a way to define a set of symbolic names (constants) that are bound to unique, constant values. They make code more readable and organized by grouping related values under one type, instead of using plain integers or strings.
125
+
126
+ In Python, `enums` are created using the Enum class from the built-in enum module. Each member of an enum has a name and a value.
127
+
128
+ ## Distance
129
+ Enum `Distance` contains float values for dynamic conversion, which just makes it simple for you to convert quickly and efficiently.
130
+
131
+ ```py
132
+ from unitx import Distance
133
+
134
+ print(Distance.METERS)
135
+ print(Distance.KILOMETERS)
136
+ print(Distance.CENTIMETERS)
137
+ print(Distance.MILLIMETERS)
138
+ print(Distance.FEET)
139
+ print(Distance.INCHES)
140
+ print(Distance.YARDS)
141
+ print(Distance.MILES)
142
+ ```
143
+
144
+ ## Mass
145
+ Enum `Mass` contains float values for dynamic conversion, which just makes it simple for you to convert quickly and efficiently.
146
+
147
+ ```py
148
+ from unitx import Mass
149
+
150
+ print(Mass.KILOGRAM)
151
+ print(Mass.GRAM)
152
+ print(Mass.MILLIGRAM)
153
+ print(Mass.MICROGRAM)
154
+ print(Mass.TONNE)
155
+ print(Mass.POUND)
156
+ print(Mass.OUNCE)
157
+ print(Mass.STONE)
158
+ ```
159
+
160
+ ## Temperature
161
+ Enum `Temperature` is a bit different. It contains a abbreviation, and then converts between the 4 of them .
162
+
163
+ ```py
164
+ from unitx import Temperature
165
+
166
+ print(Temperature.CELSIUS)
167
+ print(Temperature.FAHRENHEIT)
168
+ print(Temperature.KELVIN)
169
+ print(Temperature.RANKINE)
170
+ ```
171
+
172
+ ## Volume
173
+ Enum `Volume` contains float values for dynamic conversion, which just makes it simple for you to convert quickly and efficiently.
174
+
175
+ ```py
176
+ from unitx import Volume
177
+
178
+ print(Volume.LITER)
179
+ print(Volume.MILLILITER)
180
+ print(Volume.CUBIC_METER)
181
+ print(Volume.CUBIC_CENTIMETER)
182
+ print(Volume.GALLON_US)
183
+ print(Volume.QUART_US)
184
+ print(Volume.PINT_US)
185
+ print(Volume.CUP_US)
186
+ print(Volume.FLUID_OUNCE_US)
187
+ print(Volume.TABLESPOON_US)
188
+ print(Volume.TEASPOON_US)
189
+ ```
190
+
191
+ ## Area
192
+ Enum `Volume` contains float values for dynamic conversion, which just makes it simple for you to convert quickly and efficiently.
193
+
194
+ ```py
195
+ from unitx import Area
196
+
197
+ print(Area.SQUARE_METER)
198
+ print(Area.SQUARE_KILOMETER)
199
+ print(Area.SQUARE_CENTIMETER)
200
+ print(Area.SQUARE_MILLIMETER)
201
+ print(Area.HECTARE)
202
+ print(Area.ACRE)
203
+ print(Area.SQUARE_FOOT)
204
+ print(Area.SQUARE_YARD)
205
+ print(Area.SQUARE_MILE)
206
+ ```
207
+
208
+ # Exceptions
209
+ In programming, an exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions. It usually happens when something goes wrong, like trying to divide by zero, accessing a file that doesn’t exist, or referencing a variable that hasn’t been defined. In `unitx` case, it tells you if you have passed invalid values for which then its raised.
210
+
211
+ ## Unsupported Unit
212
+ This is raised when you have passed a unsupported value, even when passed from another enum! This is so that you are not passing random params.
213
+
214
+ ```py
215
+ class UnsupportedUnitError(Exception):
216
+ """Raised when a unit is not recognized."""
217
+
218
+ def __init__(self, message):
219
+ super().__init__(message)
220
+ ```
221
+
222
+ ## Invalid Unit
223
+ This is raised when you pass a enum from a different category which is not related to the conversion. This is so that you are converting properly.
224
+
225
+ ```py
226
+ class InvalidUnitError(Exception):
227
+ """Raised when units are from a different category."""
228
+
229
+ def __init__(self, message):
230
+ super().__init__(message)
231
+ ```
232
+
233
+ ## Non Numeric
234
+ This is raised when `value` is not a `int`/`float` object, and is something else, e.g. `str`, `list`, `dict`. This keeps the conversion easy and not full on annoying errors!
235
+
236
+ ```py
237
+ class NonNumericError(Exception):
238
+ """Raised when value is not int or float."""
239
+
240
+ def __init__(self, message):
241
+ super().__init__(message)
242
+ ```
243
+
244
+ # Contributing
245
+ Contributions to this project are welcome! You can help by:
246
+
247
+ - Reporting bugs or issues
248
+
249
+ - Suggesting new features
250
+
251
+ - Writing or improving documentation
252
+
253
+ - Submitting code improvements or fixes
254
+
255
+ - Adding tests
256
+
257
+ ## Note
258
+ Please check if another user has already said what you thought. It helps prevent repeating the same content, keeps conversations organized, and makes it easier to follow discussions. By using this, you can ensure that ideas stay unique, reduce clutter in busy channels, and maintain clarity in group chats or collaborative projects.
unitx-0.0.2/README.md ADDED
@@ -0,0 +1,213 @@
1
+ # unitx
2
+ [![version](https://img.shields.io/pypi/v/unitx.svg?colorB=blue)](https://pypi.org/project/unitx/)
3
+ [![pyversions](https://img.shields.io/pypi/pyversions/unitx.svg?)](https://pypi.org/project/unitx/)
4
+ [![codecov](https://codecov.io/gh/devs-des1re/unitx/branch/main/graph/badge.svg?token=YOUR_CODECOV_TOKEN)](https://codecov.io/gh/devs-des1re/unitx)
5
+
6
+ A Python library which dynamically converts different types of units.
7
+
8
+ # Installation
9
+ To install unitx you will need `Python >= 3.10`
10
+
11
+ Run:
12
+ ```
13
+ pip install unitx
14
+ ```
15
+
16
+ Or:
17
+ ```
18
+ python -m pip install unitx
19
+ ```
20
+
21
+ Also works for MacOS and Linux with `pip3`.
22
+
23
+ # Conversions
24
+ There are different functions in unitx which help convert for you!
25
+
26
+ ## Converting Distance
27
+ To convert distance, you'll use the `convert_distance` function. This also needs to be used with the enum class `Distance`.
28
+
29
+ ```py
30
+ from unitx import convert_distance, Distance
31
+
32
+ converted_value = convert_distance(5, Distance.MILES, Distance.KILOMETERS)
33
+ print(converted_value)
34
+ ```
35
+
36
+ ## Converting Mass
37
+ To convert mass, you'll use the `convert_mass` function. This also needs to be used with the enum class `Mass`.
38
+
39
+ ```py
40
+ from unitx import convert_mass, Mass
41
+
42
+ converted_value = convert_mass(1000, Mass.KILOGRAMS, Mass.TONNE)
43
+ print(converted_value)
44
+ ```
45
+
46
+ ## Converting Volume
47
+ To convert volume, you'll use the `convert_volume` function. This also needs to be used with the enum class `Volume`.
48
+
49
+ ```py
50
+ from unitx import convert_volume, Volume
51
+
52
+ converted_value = convert_volume(10, Volume.LITER, Volume.MILLILITER)
53
+ print(converted_value)
54
+ ```
55
+
56
+ ## Converting Temperature
57
+ To convert temperature, you'll use the `convert_temperature` function. This also needs to be used with the enum class `Temperature`.
58
+
59
+ **Note:** Units `kelvin` and `rankine` can also be converted
60
+
61
+ ```py
62
+ from unitx import convert_temperature, Temperature
63
+
64
+ convert_temperature(0, Temperature.CELSIUS, Temperature.FAHRENHEIT)
65
+ print(converted_value)
66
+ ```
67
+
68
+ ## Converting Area
69
+ To convert area, you'll use the `convert_area` function. This also needs to be used with the enum class `Area`.
70
+
71
+ ```py
72
+ from unitx import convert_Area, area
73
+
74
+ converted_value = convert_area(10, Area.SQUARE_KILOMETER, Area.SQUARE_METER)
75
+ print(converted_value)
76
+ ```
77
+
78
+ # Enums
79
+ What are `enums`? `Enums` in Python are a way to define a set of symbolic names (constants) that are bound to unique, constant values. They make code more readable and organized by grouping related values under one type, instead of using plain integers or strings.
80
+
81
+ In Python, `enums` are created using the Enum class from the built-in enum module. Each member of an enum has a name and a value.
82
+
83
+ ## Distance
84
+ Enum `Distance` contains float values for dynamic conversion, which just makes it simple for you to convert quickly and efficiently.
85
+
86
+ ```py
87
+ from unitx import Distance
88
+
89
+ print(Distance.METERS)
90
+ print(Distance.KILOMETERS)
91
+ print(Distance.CENTIMETERS)
92
+ print(Distance.MILLIMETERS)
93
+ print(Distance.FEET)
94
+ print(Distance.INCHES)
95
+ print(Distance.YARDS)
96
+ print(Distance.MILES)
97
+ ```
98
+
99
+ ## Mass
100
+ Enum `Mass` contains float values for dynamic conversion, which just makes it simple for you to convert quickly and efficiently.
101
+
102
+ ```py
103
+ from unitx import Mass
104
+
105
+ print(Mass.KILOGRAM)
106
+ print(Mass.GRAM)
107
+ print(Mass.MILLIGRAM)
108
+ print(Mass.MICROGRAM)
109
+ print(Mass.TONNE)
110
+ print(Mass.POUND)
111
+ print(Mass.OUNCE)
112
+ print(Mass.STONE)
113
+ ```
114
+
115
+ ## Temperature
116
+ Enum `Temperature` is a bit different. It contains a abbreviation, and then converts between the 4 of them .
117
+
118
+ ```py
119
+ from unitx import Temperature
120
+
121
+ print(Temperature.CELSIUS)
122
+ print(Temperature.FAHRENHEIT)
123
+ print(Temperature.KELVIN)
124
+ print(Temperature.RANKINE)
125
+ ```
126
+
127
+ ## Volume
128
+ Enum `Volume` contains float values for dynamic conversion, which just makes it simple for you to convert quickly and efficiently.
129
+
130
+ ```py
131
+ from unitx import Volume
132
+
133
+ print(Volume.LITER)
134
+ print(Volume.MILLILITER)
135
+ print(Volume.CUBIC_METER)
136
+ print(Volume.CUBIC_CENTIMETER)
137
+ print(Volume.GALLON_US)
138
+ print(Volume.QUART_US)
139
+ print(Volume.PINT_US)
140
+ print(Volume.CUP_US)
141
+ print(Volume.FLUID_OUNCE_US)
142
+ print(Volume.TABLESPOON_US)
143
+ print(Volume.TEASPOON_US)
144
+ ```
145
+
146
+ ## Area
147
+ Enum `Volume` contains float values for dynamic conversion, which just makes it simple for you to convert quickly and efficiently.
148
+
149
+ ```py
150
+ from unitx import Area
151
+
152
+ print(Area.SQUARE_METER)
153
+ print(Area.SQUARE_KILOMETER)
154
+ print(Area.SQUARE_CENTIMETER)
155
+ print(Area.SQUARE_MILLIMETER)
156
+ print(Area.HECTARE)
157
+ print(Area.ACRE)
158
+ print(Area.SQUARE_FOOT)
159
+ print(Area.SQUARE_YARD)
160
+ print(Area.SQUARE_MILE)
161
+ ```
162
+
163
+ # Exceptions
164
+ In programming, an exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions. It usually happens when something goes wrong, like trying to divide by zero, accessing a file that doesn’t exist, or referencing a variable that hasn’t been defined. In `unitx` case, it tells you if you have passed invalid values for which then its raised.
165
+
166
+ ## Unsupported Unit
167
+ This is raised when you have passed a unsupported value, even when passed from another enum! This is so that you are not passing random params.
168
+
169
+ ```py
170
+ class UnsupportedUnitError(Exception):
171
+ """Raised when a unit is not recognized."""
172
+
173
+ def __init__(self, message):
174
+ super().__init__(message)
175
+ ```
176
+
177
+ ## Invalid Unit
178
+ This is raised when you pass a enum from a different category which is not related to the conversion. This is so that you are converting properly.
179
+
180
+ ```py
181
+ class InvalidUnitError(Exception):
182
+ """Raised when units are from a different category."""
183
+
184
+ def __init__(self, message):
185
+ super().__init__(message)
186
+ ```
187
+
188
+ ## Non Numeric
189
+ This is raised when `value` is not a `int`/`float` object, and is something else, e.g. `str`, `list`, `dict`. This keeps the conversion easy and not full on annoying errors!
190
+
191
+ ```py
192
+ class NonNumericError(Exception):
193
+ """Raised when value is not int or float."""
194
+
195
+ def __init__(self, message):
196
+ super().__init__(message)
197
+ ```
198
+
199
+ # Contributing
200
+ Contributions to this project are welcome! You can help by:
201
+
202
+ - Reporting bugs or issues
203
+
204
+ - Suggesting new features
205
+
206
+ - Writing or improving documentation
207
+
208
+ - Submitting code improvements or fixes
209
+
210
+ - Adding tests
211
+
212
+ ## Note
213
+ Please check if another user has already said what you thought. It helps prevent repeating the same content, keeps conversations organized, and makes it easier to follow discussions. By using this, you can ensure that ideas stay unique, reduce clutter in busy channels, and maintain clarity in group chats or collaborative projects.
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
  name = "unitx"
7
7
  description = "A Python library which dynamically converts different types of units"
8
8
  readme = "README.md"
9
- version = "0.0.1"
9
+ version = "0.0.2"
10
10
  requires-python = ">=3.10"
11
11
  license = { file = "LICENSE" }
12
12
 
@@ -34,4 +34,8 @@ classifiers = [
34
34
  "Topic :: Software Development",
35
35
  "Topic :: Utilities",
36
36
  ]
37
- dependencies = []
37
+ dependencies = []
38
+
39
+ [project.urls]
40
+ Homepage = "https://github.com/devs-des1re/unitx"
41
+ Issues = "https://github.com/devs-des1re/unitx/issues"
@@ -22,7 +22,7 @@ __all__ = [
22
22
  "UnsupportedUnitError"
23
23
  ]
24
24
 
25
- __version__ = "0.1.0"
25
+ __version__ = "0.0.2"
26
26
  __author__ = "devs_des1re"
27
27
  __license__ = "MIT"
28
28
  __email__ = "arjunbrij8811@gmail.com"
@@ -0,0 +1,258 @@
1
+ Metadata-Version: 2.4
2
+ Name: unitx
3
+ Version: 0.0.2
4
+ Summary: A Python library which dynamically converts different types of units
5
+ Author-email: devs_des1re <arjunbrij8811@gmail.com>
6
+ Maintainer-email: devs_des1re <arjunbrij8811@gmail.com>
7
+ License: Copyright (c) 2025 devs_des1re
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
+ Project-URL: Homepage, https://github.com/devs-des1re/unitx
27
+ Project-URL: Issues, https://github.com/devs-des1re/unitx/issues
28
+ Keywords: app,macOS,windows,linux,flatpak
29
+ Classifier: Development Status :: 4 - Beta
30
+ Classifier: Intended Audience :: Developers
31
+ Classifier: Operating System :: OS Independent
32
+ Classifier: Programming Language :: Python :: 3
33
+ Classifier: Programming Language :: Python :: 3.10
34
+ Classifier: Programming Language :: Python :: 3.11
35
+ Classifier: Programming Language :: Python :: 3.12
36
+ Classifier: Programming Language :: Python :: 3.13
37
+ Classifier: Programming Language :: Python :: 3.14
38
+ Classifier: Programming Language :: Python :: 3 :: Only
39
+ Classifier: Topic :: Software Development
40
+ Classifier: Topic :: Utilities
41
+ Requires-Python: >=3.10
42
+ Description-Content-Type: text/markdown
43
+ License-File: LICENSE
44
+ Dynamic: license-file
45
+
46
+ # unitx
47
+ [![version](https://img.shields.io/pypi/v/unitx.svg?colorB=blue)](https://pypi.org/project/unitx/)
48
+ [![pyversions](https://img.shields.io/pypi/pyversions/unitx.svg?)](https://pypi.org/project/unitx/)
49
+ [![codecov](https://codecov.io/gh/devs-des1re/unitx/branch/main/graph/badge.svg?token=YOUR_CODECOV_TOKEN)](https://codecov.io/gh/devs-des1re/unitx)
50
+
51
+ A Python library which dynamically converts different types of units.
52
+
53
+ # Installation
54
+ To install unitx you will need `Python >= 3.10`
55
+
56
+ Run:
57
+ ```
58
+ pip install unitx
59
+ ```
60
+
61
+ Or:
62
+ ```
63
+ python -m pip install unitx
64
+ ```
65
+
66
+ Also works for MacOS and Linux with `pip3`.
67
+
68
+ # Conversions
69
+ There are different functions in unitx which help convert for you!
70
+
71
+ ## Converting Distance
72
+ To convert distance, you'll use the `convert_distance` function. This also needs to be used with the enum class `Distance`.
73
+
74
+ ```py
75
+ from unitx import convert_distance, Distance
76
+
77
+ converted_value = convert_distance(5, Distance.MILES, Distance.KILOMETERS)
78
+ print(converted_value)
79
+ ```
80
+
81
+ ## Converting Mass
82
+ To convert mass, you'll use the `convert_mass` function. This also needs to be used with the enum class `Mass`.
83
+
84
+ ```py
85
+ from unitx import convert_mass, Mass
86
+
87
+ converted_value = convert_mass(1000, Mass.KILOGRAMS, Mass.TONNE)
88
+ print(converted_value)
89
+ ```
90
+
91
+ ## Converting Volume
92
+ To convert volume, you'll use the `convert_volume` function. This also needs to be used with the enum class `Volume`.
93
+
94
+ ```py
95
+ from unitx import convert_volume, Volume
96
+
97
+ converted_value = convert_volume(10, Volume.LITER, Volume.MILLILITER)
98
+ print(converted_value)
99
+ ```
100
+
101
+ ## Converting Temperature
102
+ To convert temperature, you'll use the `convert_temperature` function. This also needs to be used with the enum class `Temperature`.
103
+
104
+ **Note:** Units `kelvin` and `rankine` can also be converted
105
+
106
+ ```py
107
+ from unitx import convert_temperature, Temperature
108
+
109
+ convert_temperature(0, Temperature.CELSIUS, Temperature.FAHRENHEIT)
110
+ print(converted_value)
111
+ ```
112
+
113
+ ## Converting Area
114
+ To convert area, you'll use the `convert_area` function. This also needs to be used with the enum class `Area`.
115
+
116
+ ```py
117
+ from unitx import convert_Area, area
118
+
119
+ converted_value = convert_area(10, Area.SQUARE_KILOMETER, Area.SQUARE_METER)
120
+ print(converted_value)
121
+ ```
122
+
123
+ # Enums
124
+ What are `enums`? `Enums` in Python are a way to define a set of symbolic names (constants) that are bound to unique, constant values. They make code more readable and organized by grouping related values under one type, instead of using plain integers or strings.
125
+
126
+ In Python, `enums` are created using the Enum class from the built-in enum module. Each member of an enum has a name and a value.
127
+
128
+ ## Distance
129
+ Enum `Distance` contains float values for dynamic conversion, which just makes it simple for you to convert quickly and efficiently.
130
+
131
+ ```py
132
+ from unitx import Distance
133
+
134
+ print(Distance.METERS)
135
+ print(Distance.KILOMETERS)
136
+ print(Distance.CENTIMETERS)
137
+ print(Distance.MILLIMETERS)
138
+ print(Distance.FEET)
139
+ print(Distance.INCHES)
140
+ print(Distance.YARDS)
141
+ print(Distance.MILES)
142
+ ```
143
+
144
+ ## Mass
145
+ Enum `Mass` contains float values for dynamic conversion, which just makes it simple for you to convert quickly and efficiently.
146
+
147
+ ```py
148
+ from unitx import Mass
149
+
150
+ print(Mass.KILOGRAM)
151
+ print(Mass.GRAM)
152
+ print(Mass.MILLIGRAM)
153
+ print(Mass.MICROGRAM)
154
+ print(Mass.TONNE)
155
+ print(Mass.POUND)
156
+ print(Mass.OUNCE)
157
+ print(Mass.STONE)
158
+ ```
159
+
160
+ ## Temperature
161
+ Enum `Temperature` is a bit different. It contains a abbreviation, and then converts between the 4 of them .
162
+
163
+ ```py
164
+ from unitx import Temperature
165
+
166
+ print(Temperature.CELSIUS)
167
+ print(Temperature.FAHRENHEIT)
168
+ print(Temperature.KELVIN)
169
+ print(Temperature.RANKINE)
170
+ ```
171
+
172
+ ## Volume
173
+ Enum `Volume` contains float values for dynamic conversion, which just makes it simple for you to convert quickly and efficiently.
174
+
175
+ ```py
176
+ from unitx import Volume
177
+
178
+ print(Volume.LITER)
179
+ print(Volume.MILLILITER)
180
+ print(Volume.CUBIC_METER)
181
+ print(Volume.CUBIC_CENTIMETER)
182
+ print(Volume.GALLON_US)
183
+ print(Volume.QUART_US)
184
+ print(Volume.PINT_US)
185
+ print(Volume.CUP_US)
186
+ print(Volume.FLUID_OUNCE_US)
187
+ print(Volume.TABLESPOON_US)
188
+ print(Volume.TEASPOON_US)
189
+ ```
190
+
191
+ ## Area
192
+ Enum `Volume` contains float values for dynamic conversion, which just makes it simple for you to convert quickly and efficiently.
193
+
194
+ ```py
195
+ from unitx import Area
196
+
197
+ print(Area.SQUARE_METER)
198
+ print(Area.SQUARE_KILOMETER)
199
+ print(Area.SQUARE_CENTIMETER)
200
+ print(Area.SQUARE_MILLIMETER)
201
+ print(Area.HECTARE)
202
+ print(Area.ACRE)
203
+ print(Area.SQUARE_FOOT)
204
+ print(Area.SQUARE_YARD)
205
+ print(Area.SQUARE_MILE)
206
+ ```
207
+
208
+ # Exceptions
209
+ In programming, an exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions. It usually happens when something goes wrong, like trying to divide by zero, accessing a file that doesn’t exist, or referencing a variable that hasn’t been defined. In `unitx` case, it tells you if you have passed invalid values for which then its raised.
210
+
211
+ ## Unsupported Unit
212
+ This is raised when you have passed a unsupported value, even when passed from another enum! This is so that you are not passing random params.
213
+
214
+ ```py
215
+ class UnsupportedUnitError(Exception):
216
+ """Raised when a unit is not recognized."""
217
+
218
+ def __init__(self, message):
219
+ super().__init__(message)
220
+ ```
221
+
222
+ ## Invalid Unit
223
+ This is raised when you pass a enum from a different category which is not related to the conversion. This is so that you are converting properly.
224
+
225
+ ```py
226
+ class InvalidUnitError(Exception):
227
+ """Raised when units are from a different category."""
228
+
229
+ def __init__(self, message):
230
+ super().__init__(message)
231
+ ```
232
+
233
+ ## Non Numeric
234
+ This is raised when `value` is not a `int`/`float` object, and is something else, e.g. `str`, `list`, `dict`. This keeps the conversion easy and not full on annoying errors!
235
+
236
+ ```py
237
+ class NonNumericError(Exception):
238
+ """Raised when value is not int or float."""
239
+
240
+ def __init__(self, message):
241
+ super().__init__(message)
242
+ ```
243
+
244
+ # Contributing
245
+ Contributions to this project are welcome! You can help by:
246
+
247
+ - Reporting bugs or issues
248
+
249
+ - Suggesting new features
250
+
251
+ - Writing or improving documentation
252
+
253
+ - Submitting code improvements or fixes
254
+
255
+ - Adding tests
256
+
257
+ ## Note
258
+ Please check if another user has already said what you thought. It helps prevent repeating the same content, keeps conversations organized, and makes it easier to follow discussions. By using this, you can ensure that ideas stay unique, reduce clutter in busy channels, and maintain clarity in group chats or collaborative projects.
unitx-0.0.1/PKG-INFO DELETED
@@ -1,45 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: unitx
3
- Version: 0.0.1
4
- Summary: A Python library which dynamically converts different types of units
5
- Author-email: devs_des1re <arjunbrij8811@gmail.com>
6
- Maintainer-email: devs_des1re <arjunbrij8811@gmail.com>
7
- License: Copyright (c) 2025 devs_des1re
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
- Keywords: app,macOS,windows,linux,flatpak
27
- Classifier: Development Status :: 4 - Beta
28
- Classifier: Intended Audience :: Developers
29
- Classifier: Operating System :: OS Independent
30
- Classifier: Programming Language :: Python :: 3
31
- Classifier: Programming Language :: Python :: 3.10
32
- Classifier: Programming Language :: Python :: 3.11
33
- Classifier: Programming Language :: Python :: 3.12
34
- Classifier: Programming Language :: Python :: 3.13
35
- Classifier: Programming Language :: Python :: 3.14
36
- Classifier: Programming Language :: Python :: 3 :: Only
37
- Classifier: Topic :: Software Development
38
- Classifier: Topic :: Utilities
39
- Requires-Python: >=3.10
40
- Description-Content-Type: text/markdown
41
- License-File: LICENSE
42
- Dynamic: license-file
43
-
44
- # unitx
45
- What is unitx? Unitx is the best Python library for converting units between each other dynamically! It currently provides support to 5 different type of unit categories, but more will be added in the future!
unitx-0.0.1/README.md DELETED
@@ -1,2 +0,0 @@
1
- # unitx
2
- What is unitx? Unitx is the best Python library for converting units between each other dynamically! It currently provides support to 5 different type of unit categories, but more will be added in the future!
@@ -1,45 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: unitx
3
- Version: 0.0.1
4
- Summary: A Python library which dynamically converts different types of units
5
- Author-email: devs_des1re <arjunbrij8811@gmail.com>
6
- Maintainer-email: devs_des1re <arjunbrij8811@gmail.com>
7
- License: Copyright (c) 2025 devs_des1re
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
- Keywords: app,macOS,windows,linux,flatpak
27
- Classifier: Development Status :: 4 - Beta
28
- Classifier: Intended Audience :: Developers
29
- Classifier: Operating System :: OS Independent
30
- Classifier: Programming Language :: Python :: 3
31
- Classifier: Programming Language :: Python :: 3.10
32
- Classifier: Programming Language :: Python :: 3.11
33
- Classifier: Programming Language :: Python :: 3.12
34
- Classifier: Programming Language :: Python :: 3.13
35
- Classifier: Programming Language :: Python :: 3.14
36
- Classifier: Programming Language :: Python :: 3 :: Only
37
- Classifier: Topic :: Software Development
38
- Classifier: Topic :: Utilities
39
- Requires-Python: >=3.10
40
- Description-Content-Type: text/markdown
41
- License-File: LICENSE
42
- Dynamic: license-file
43
-
44
- # unitx
45
- What is unitx? Unitx is the best Python library for converting units between each other dynamically! It currently provides support to 5 different type of unit categories, but more will be added in the future!
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes