unitx 0.1.0__tar.gz → 0.1.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.1.2/.gitignore ADDED
@@ -0,0 +1,221 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
219
+
220
+ # vscode settings
221
+ .vscode/
@@ -1,4 +1,6 @@
1
- Copyright (c) 2025 devs_des1re
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dait
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
6
  of this software and associated documentation files (the "Software"), to deal
@@ -16,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- SOFTWARE.
21
+ SOFTWARE.
unitx-0.1.2/PKG-INFO ADDED
@@ -0,0 +1,46 @@
1
+ Metadata-Version: 2.5
2
+ Name: unitx
3
+ Version: 0.1.2
4
+ Summary: A modern, intuitive Python library for units, quantities, and dimensional analysis.
5
+ Project-URL: Homepage, https://github.com/DaitTHU/unitx
6
+ Project-URL: Issues, https://github.com/DaitTHU/unitx/issues
7
+ Author: Dait
8
+ License: MIT License
9
+
10
+ Copyright (c) 2026 Dait
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+ License-File: LICENSE
30
+ Classifier: Development Status :: 3 - Alpha
31
+ Classifier: Intended Audience :: Developers
32
+ Classifier: License :: OSI Approved :: MIT License
33
+ Classifier: Programming Language :: Python :: 3
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: Topic :: Scientific/Engineering :: Physics
39
+ Requires-Python: >=3.11
40
+ Provides-Extra: test
41
+ Requires-Dist: pytest>=8; extra == 'test'
42
+ Requires-Dist: ruff>=0.8; extra == 'test'
43
+ Description-Content-Type: text/markdown
44
+
45
+ # unitx
46
+ A modern, intuitive Python library for units, quantities, and dimensional analysis.
unitx-0.1.2/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # unitx
2
+ A modern, intuitive Python library for units, quantities, and dimensional analysis.
@@ -0,0 +1,45 @@
1
+ [build-system]
2
+ requires = ["hatchling >= 1.26"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "unitx"
7
+ version = "0.1.2"
8
+ description = "A modern, intuitive Python library for units, quantities, and dimensional analysis."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = { file = "LICENSE" }
12
+ authors = [{ name = "Dait" }]
13
+ dependencies = []
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Programming Language :: Python :: 3.14",
23
+ "Topic :: Scientific/Engineering :: Physics",
24
+ ]
25
+
26
+ [project.optional-dependencies]
27
+ test = [
28
+ "pytest>=8",
29
+ "ruff>=0.8",
30
+ ]
31
+
32
+ [project.urls]
33
+ Homepage = "https://github.com/DaitTHU/unitx"
34
+ Issues = "https://github.com/DaitTHU/unitx/issues"
35
+
36
+ [tool.hatch.build.targets.wheel]
37
+ packages = ["src/unitx"]
38
+
39
+ [tool.pytest.ini_options]
40
+ testpaths = ["tests"]
41
+ pythonpath = ["src"]
42
+
43
+ [tool.ruff]
44
+ target-version = "py311"
45
+ line-length = 100
@@ -0,0 +1,3 @@
1
+ """Utilities for working with physical units and quantities."""
2
+
3
+ __all__ = []
@@ -0,0 +1,5 @@
1
+ import unitx
2
+
3
+
4
+ def test_import() -> None:
5
+ assert unitx.__all__ == []
unitx-0.1.0/PKG-INFO DELETED
@@ -1,259 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: unitx
3
- Version: 0.1.0
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
- Project-URL: Docs, https://unitx.readthedocs.io/en/stable
29
- Keywords: app,macOS,windows,linux,flatpak
30
- Classifier: Development Status :: 4 - Beta
31
- Classifier: Intended Audience :: Developers
32
- Classifier: Operating System :: OS Independent
33
- Classifier: Programming Language :: Python :: 3
34
- Classifier: Programming Language :: Python :: 3.10
35
- Classifier: Programming Language :: Python :: 3.11
36
- Classifier: Programming Language :: Python :: 3.12
37
- Classifier: Programming Language :: Python :: 3.13
38
- Classifier: Programming Language :: Python :: 3.14
39
- Classifier: Programming Language :: Python :: 3 :: Only
40
- Classifier: Topic :: Software Development
41
- Classifier: Topic :: Utilities
42
- Requires-Python: >=3.10
43
- Description-Content-Type: text/markdown
44
- License-File: LICENSE
45
- Dynamic: license-file
46
-
47
- # unitx
48
- [![version](https://img.shields.io/pypi/v/unitx.svg?colorB=blue)](https://pypi.org/project/unitx/)
49
- [![pyversions](https://img.shields.io/pypi/pyversions/unitx.svg?)](https://pypi.org/project/unitx/)
50
- [![codecov](https://codecov.io/gh/devs-des1re/unitx/branch/main/graph/badge.svg?token=YOUR_CODECOV_TOKEN)](https://codecov.io/gh/devs-des1re/unitx)
51
-
52
- A Python library which dynamically converts different types of units.
53
-
54
- # Installation
55
- To install unitx you will need `Python >= 3.10`
56
-
57
- Run:
58
- ```
59
- pip install unitx
60
- ```
61
-
62
- Or:
63
- ```
64
- python -m pip install unitx
65
- ```
66
-
67
- Also works for MacOS and Linux with `pip3`.
68
-
69
- # Conversions
70
- There are different functions in unitx which help convert for you!
71
-
72
- ## Converting Distance
73
- To convert distance, you'll use the `convert_distance` function. This also needs to be used with the enum class `Distance`.
74
-
75
- ```py
76
- from unitx import convert_distance, Distance
77
-
78
- converted_value = convert_distance(5, Distance.MILES, Distance.KILOMETERS)
79
- print(converted_value)
80
- ```
81
-
82
- ## Converting Mass
83
- To convert mass, you'll use the `convert_mass` function. This also needs to be used with the enum class `Mass`.
84
-
85
- ```py
86
- from unitx import convert_mass, Mass
87
-
88
- converted_value = convert_mass(1000, Mass.KILOGRAMS, Mass.TONNE)
89
- print(converted_value)
90
- ```
91
-
92
- ## Converting Volume
93
- To convert volume, you'll use the `convert_volume` function. This also needs to be used with the enum class `Volume`.
94
-
95
- ```py
96
- from unitx import convert_volume, Volume
97
-
98
- converted_value = convert_volume(10, Volume.LITER, Volume.MILLILITER)
99
- print(converted_value)
100
- ```
101
-
102
- ## Converting Temperature
103
- To convert temperature, you'll use the `convert_temperature` function. This also needs to be used with the enum class `Temperature`.
104
-
105
- **Note:** Units `kelvin` and `rankine` can also be converted
106
-
107
- ```py
108
- from unitx import convert_temperature, Temperature
109
-
110
- convert_temperature(0, Temperature.CELSIUS, Temperature.FAHRENHEIT)
111
- print(converted_value)
112
- ```
113
-
114
- ## Converting Area
115
- To convert area, you'll use the `convert_area` function. This also needs to be used with the enum class `Area`.
116
-
117
- ```py
118
- from unitx import convert_Area, area
119
-
120
- converted_value = convert_area(10, Area.SQUARE_KILOMETER, Area.SQUARE_METER)
121
- print(converted_value)
122
- ```
123
-
124
- # Enums
125
- 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.
126
-
127
- 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.
128
-
129
- ## Distance
130
- Enum `Distance` contains float values for dynamic conversion, which just makes it simple for you to convert quickly and efficiently.
131
-
132
- ```py
133
- from unitx import Distance
134
-
135
- print(Distance.METERS)
136
- print(Distance.KILOMETERS)
137
- print(Distance.CENTIMETERS)
138
- print(Distance.MILLIMETERS)
139
- print(Distance.FEET)
140
- print(Distance.INCHES)
141
- print(Distance.YARDS)
142
- print(Distance.MILES)
143
- ```
144
-
145
- ## Mass
146
- Enum `Mass` contains float values for dynamic conversion, which just makes it simple for you to convert quickly and efficiently.
147
-
148
- ```py
149
- from unitx import Mass
150
-
151
- print(Mass.KILOGRAM)
152
- print(Mass.GRAM)
153
- print(Mass.MILLIGRAM)
154
- print(Mass.MICROGRAM)
155
- print(Mass.TONNE)
156
- print(Mass.POUND)
157
- print(Mass.OUNCE)
158
- print(Mass.STONE)
159
- ```
160
-
161
- ## Temperature
162
- Enum `Temperature` is a bit different. It contains a abbreviation, and then converts between the 4 of them .
163
-
164
- ```py
165
- from unitx import Temperature
166
-
167
- print(Temperature.CELSIUS)
168
- print(Temperature.FAHRENHEIT)
169
- print(Temperature.KELVIN)
170
- print(Temperature.RANKINE)
171
- ```
172
-
173
- ## Volume
174
- Enum `Volume` contains float values for dynamic conversion, which just makes it simple for you to convert quickly and efficiently.
175
-
176
- ```py
177
- from unitx import Volume
178
-
179
- print(Volume.LITER)
180
- print(Volume.MILLILITER)
181
- print(Volume.CUBIC_METER)
182
- print(Volume.CUBIC_CENTIMETER)
183
- print(Volume.GALLON_US)
184
- print(Volume.QUART_US)
185
- print(Volume.PINT_US)
186
- print(Volume.CUP_US)
187
- print(Volume.FLUID_OUNCE_US)
188
- print(Volume.TABLESPOON_US)
189
- print(Volume.TEASPOON_US)
190
- ```
191
-
192
- ## Area
193
- Enum `Volume` contains float values for dynamic conversion, which just makes it simple for you to convert quickly and efficiently.
194
-
195
- ```py
196
- from unitx import Area
197
-
198
- print(Area.SQUARE_METER)
199
- print(Area.SQUARE_KILOMETER)
200
- print(Area.SQUARE_CENTIMETER)
201
- print(Area.SQUARE_MILLIMETER)
202
- print(Area.HECTARE)
203
- print(Area.ACRE)
204
- print(Area.SQUARE_FOOT)
205
- print(Area.SQUARE_YARD)
206
- print(Area.SQUARE_MILE)
207
- ```
208
-
209
- # Exceptions
210
- 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.
211
-
212
- ## Unsupported Unit
213
- 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.
214
-
215
- ```py
216
- class UnsupportedUnitError(Exception):
217
- """Raised when a unit is not recognized."""
218
-
219
- def __init__(self, message):
220
- super().__init__(message)
221
- ```
222
-
223
- ## Invalid Unit
224
- 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.
225
-
226
- ```py
227
- class InvalidUnitError(Exception):
228
- """Raised when units are from a different category."""
229
-
230
- def __init__(self, message):
231
- super().__init__(message)
232
- ```
233
-
234
- ## Non Numeric
235
- 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!
236
-
237
- ```py
238
- class NonNumericError(Exception):
239
- """Raised when value is not int or float."""
240
-
241
- def __init__(self, message):
242
- super().__init__(message)
243
- ```
244
-
245
- # Contributing
246
- Contributions to this project are welcome! You can help by:
247
-
248
- - Reporting bugs or issues
249
-
250
- - Suggesting new features
251
-
252
- - Writing or improving documentation
253
-
254
- - Submitting code improvements or fixes
255
-
256
- - Adding tests
257
-
258
- ## Note
259
- 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.