testhellos 0.1.0__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.
- testhellos-0.1.0/PKG-INFO +249 -0
- testhellos-0.1.0/README.md +238 -0
- testhellos-0.1.0/pyproject.toml +26 -0
- testhellos-0.1.0/setup.cfg +4 -0
- testhellos-0.1.0/src/testhellos/__init__.py +9 -0
- testhellos-0.1.0/src/testhellos/math_utils.py +22 -0
- testhellos-0.1.0/src/testhellos/string_utils.py +13 -0
- testhellos-0.1.0/src/testhellos.egg-info/PKG-INFO +249 -0
- testhellos-0.1.0/src/testhellos.egg-info/SOURCES.txt +11 -0
- testhellos-0.1.0/src/testhellos.egg-info/dependency_links.txt +1 -0
- testhellos-0.1.0/src/testhellos.egg-info/top_level.txt +1 -0
- testhellos-0.1.0/tests/test_math_utils.py +24 -0
- testhellos-0.1.0/tests/test_string_utils.py +25 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: testhellos
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A collection of reusable Python utilities
|
|
5
|
+
Author: Adarsh Kumar
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# TestHellos
|
|
13
|
+
|
|
14
|
+
**A lightweight collection of reusable Python utilities for everyday development.**
|
|
15
|
+
|
|
16
|
+
TestHellos is a Python package designed to provide simple, reusable helper functions for mathematical operations and string manipulation.
|
|
17
|
+
|
|
18
|
+
Whether you're building a small script or a larger Python application, TestHellos helps you avoid rewriting common utility functions.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- Simple mathematical operations.
|
|
25
|
+
- String reversal.
|
|
26
|
+
- Word counting.
|
|
27
|
+
- Word capitalization.
|
|
28
|
+
- Lightweight and easy to use.
|
|
29
|
+
- No external runtime dependencies.
|
|
30
|
+
- Easy integration into Python projects.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
Install TestHellos using pip:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install testhellos
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from testhellos import add, subtract, multiply, divide
|
|
48
|
+
from testhellos import reverse_string, count_words, capitalize_words
|
|
49
|
+
|
|
50
|
+
# Mathematical operations
|
|
51
|
+
print(add(10, 20)) # 30
|
|
52
|
+
print(subtract(20, 10)) # 10
|
|
53
|
+
print(multiply(5, 5)) # 25
|
|
54
|
+
print(divide(20, 4)) # 5.0
|
|
55
|
+
|
|
56
|
+
# String operations
|
|
57
|
+
print(reverse_string("Python")) # nohtyP
|
|
58
|
+
print(count_words("Hello Python")) # 2
|
|
59
|
+
print(capitalize_words("hello world")) # Hello World
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Available Functions
|
|
65
|
+
|
|
66
|
+
### Mathematical Utilities
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from testhellos import add, subtract, multiply, divide
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
| Function | Description |
|
|
73
|
+
|---|---|
|
|
74
|
+
| `add(a, b)` | Adds two numbers |
|
|
75
|
+
| `subtract(a, b)` | Subtracts two numbers |
|
|
76
|
+
| `multiply(a, b)` | Multiplies two numbers |
|
|
77
|
+
| `divide(a, b)` | Divides two numbers |
|
|
78
|
+
|
|
79
|
+
Example:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
print(add(10, 5)) # 15
|
|
83
|
+
print(subtract(10, 5)) # 5
|
|
84
|
+
print(multiply(10, 5)) # 50
|
|
85
|
+
print(divide(10, 5)) # 2.0
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Note: `divide()` raises a `ValueError` when the divisor is zero.
|
|
89
|
+
|
|
90
|
+
### String Utilities
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from testhellos import reverse_string, count_words, capitalize_words
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
| Function | Description |
|
|
97
|
+
|---|---|
|
|
98
|
+
| `reverse_string(text)` | Reverses a string |
|
|
99
|
+
| `count_words(text)` | Counts words in a string |
|
|
100
|
+
| `capitalize_words(text)` | Capitalizes each word |
|
|
101
|
+
|
|
102
|
+
Example:
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
print(reverse_string("Hello")) # olleH
|
|
106
|
+
print(count_words("Python is awesome")) # 3
|
|
107
|
+
print(capitalize_words("hello world")) # Hello World
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Project Structure
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
testhellos/
|
|
116
|
+
│
|
|
117
|
+
├── dist/
|
|
118
|
+
│ ├── testhellos-0.1.0-py3-none-any.whl
|
|
119
|
+
│ └── testhellos-0.1.0.tar.gz
|
|
120
|
+
│
|
|
121
|
+
├── src/
|
|
122
|
+
│ └── testhellos/
|
|
123
|
+
│ ├── __init__.py
|
|
124
|
+
│ ├── math_utils.py
|
|
125
|
+
│ └── string_utils.py
|
|
126
|
+
│
|
|
127
|
+
├── tests/
|
|
128
|
+
│ └── test_math_utils.py
|
|
129
|
+
│
|
|
130
|
+
├── pyproject.toml
|
|
131
|
+
├── README.md
|
|
132
|
+
└── LICENSE
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Development Setup
|
|
138
|
+
|
|
139
|
+
Clone the repository:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
git clone https://github.com/YOUR_USERNAME/testhellos.git
|
|
143
|
+
cd testhellos
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Create a virtual environment:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
python -m venv venv
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Activate it:
|
|
153
|
+
|
|
154
|
+
**Linux / macOS**
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
source venv/bin/activate
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Windows**
|
|
161
|
+
|
|
162
|
+
```powershell
|
|
163
|
+
venv\Scripts\activate
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Install development tools:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
python -m pip install --upgrade pip
|
|
170
|
+
python -m pip install build twine pytest
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Install the package in editable mode:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
python -m pip install -e .
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Running Tests
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
pytest
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Building the Package
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
python -m build
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Validate the generated distributions:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
python -m twine check dist/*
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Publishing to PyPI
|
|
204
|
+
|
|
205
|
+
Upload to TestPyPI:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
python -m twine upload --repository testpypi dist/*
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
After testing, publish to the official PyPI:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
python -m twine upload dist/*
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Never commit your API tokens or credentials to GitHub.
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Requirements
|
|
222
|
+
|
|
223
|
+
- Python 3.9 or newer.
|
|
224
|
+
- pip.
|
|
225
|
+
- No third-party runtime dependencies.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## License
|
|
230
|
+
|
|
231
|
+
This project is licensed under the MIT License.
|
|
232
|
+
|
|
233
|
+
See the [LICENSE](LICENSE) file for details.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Contributing
|
|
238
|
+
|
|
239
|
+
Contributions, suggestions, and bug reports are welcome.
|
|
240
|
+
|
|
241
|
+
1. Fork the repository.
|
|
242
|
+
2. Create a feature branch.
|
|
243
|
+
3. Make your changes.
|
|
244
|
+
4. Add or update tests.
|
|
245
|
+
5. Submit a pull request.
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
**TestHellos — Small utilities, simpler Python development.**
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# TestHellos
|
|
2
|
+
|
|
3
|
+
**A lightweight collection of reusable Python utilities for everyday development.**
|
|
4
|
+
|
|
5
|
+
TestHellos is a Python package designed to provide simple, reusable helper functions for mathematical operations and string manipulation.
|
|
6
|
+
|
|
7
|
+
Whether you're building a small script or a larger Python application, TestHellos helps you avoid rewriting common utility functions.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- Simple mathematical operations.
|
|
14
|
+
- String reversal.
|
|
15
|
+
- Word counting.
|
|
16
|
+
- Word capitalization.
|
|
17
|
+
- Lightweight and easy to use.
|
|
18
|
+
- No external runtime dependencies.
|
|
19
|
+
- Easy integration into Python projects.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
Install TestHellos using pip:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install testhellos
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from testhellos import add, subtract, multiply, divide
|
|
37
|
+
from testhellos import reverse_string, count_words, capitalize_words
|
|
38
|
+
|
|
39
|
+
# Mathematical operations
|
|
40
|
+
print(add(10, 20)) # 30
|
|
41
|
+
print(subtract(20, 10)) # 10
|
|
42
|
+
print(multiply(5, 5)) # 25
|
|
43
|
+
print(divide(20, 4)) # 5.0
|
|
44
|
+
|
|
45
|
+
# String operations
|
|
46
|
+
print(reverse_string("Python")) # nohtyP
|
|
47
|
+
print(count_words("Hello Python")) # 2
|
|
48
|
+
print(capitalize_words("hello world")) # Hello World
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Available Functions
|
|
54
|
+
|
|
55
|
+
### Mathematical Utilities
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from testhellos import add, subtract, multiply, divide
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
| Function | Description |
|
|
62
|
+
|---|---|
|
|
63
|
+
| `add(a, b)` | Adds two numbers |
|
|
64
|
+
| `subtract(a, b)` | Subtracts two numbers |
|
|
65
|
+
| `multiply(a, b)` | Multiplies two numbers |
|
|
66
|
+
| `divide(a, b)` | Divides two numbers |
|
|
67
|
+
|
|
68
|
+
Example:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
print(add(10, 5)) # 15
|
|
72
|
+
print(subtract(10, 5)) # 5
|
|
73
|
+
print(multiply(10, 5)) # 50
|
|
74
|
+
print(divide(10, 5)) # 2.0
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Note: `divide()` raises a `ValueError` when the divisor is zero.
|
|
78
|
+
|
|
79
|
+
### String Utilities
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from testhellos import reverse_string, count_words, capitalize_words
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
| Function | Description |
|
|
86
|
+
|---|---|
|
|
87
|
+
| `reverse_string(text)` | Reverses a string |
|
|
88
|
+
| `count_words(text)` | Counts words in a string |
|
|
89
|
+
| `capitalize_words(text)` | Capitalizes each word |
|
|
90
|
+
|
|
91
|
+
Example:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
print(reverse_string("Hello")) # olleH
|
|
95
|
+
print(count_words("Python is awesome")) # 3
|
|
96
|
+
print(capitalize_words("hello world")) # Hello World
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Project Structure
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
testhellos/
|
|
105
|
+
│
|
|
106
|
+
├── dist/
|
|
107
|
+
│ ├── testhellos-0.1.0-py3-none-any.whl
|
|
108
|
+
│ └── testhellos-0.1.0.tar.gz
|
|
109
|
+
│
|
|
110
|
+
├── src/
|
|
111
|
+
│ └── testhellos/
|
|
112
|
+
│ ├── __init__.py
|
|
113
|
+
│ ├── math_utils.py
|
|
114
|
+
│ └── string_utils.py
|
|
115
|
+
│
|
|
116
|
+
├── tests/
|
|
117
|
+
│ └── test_math_utils.py
|
|
118
|
+
│
|
|
119
|
+
├── pyproject.toml
|
|
120
|
+
├── README.md
|
|
121
|
+
└── LICENSE
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Development Setup
|
|
127
|
+
|
|
128
|
+
Clone the repository:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
git clone https://github.com/YOUR_USERNAME/testhellos.git
|
|
132
|
+
cd testhellos
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Create a virtual environment:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
python -m venv venv
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Activate it:
|
|
142
|
+
|
|
143
|
+
**Linux / macOS**
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
source venv/bin/activate
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Windows**
|
|
150
|
+
|
|
151
|
+
```powershell
|
|
152
|
+
venv\Scripts\activate
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Install development tools:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
python -m pip install --upgrade pip
|
|
159
|
+
python -m pip install build twine pytest
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Install the package in editable mode:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
python -m pip install -e .
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Running Tests
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
pytest
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Building the Package
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
python -m build
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Validate the generated distributions:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
python -m twine check dist/*
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Publishing to PyPI
|
|
193
|
+
|
|
194
|
+
Upload to TestPyPI:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
python -m twine upload --repository testpypi dist/*
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
After testing, publish to the official PyPI:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
python -m twine upload dist/*
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Never commit your API tokens or credentials to GitHub.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Requirements
|
|
211
|
+
|
|
212
|
+
- Python 3.9 or newer.
|
|
213
|
+
- pip.
|
|
214
|
+
- No third-party runtime dependencies.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## License
|
|
219
|
+
|
|
220
|
+
This project is licensed under the MIT License.
|
|
221
|
+
|
|
222
|
+
See the [LICENSE](LICENSE) file for details.
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Contributing
|
|
227
|
+
|
|
228
|
+
Contributions, suggestions, and bug reports are welcome.
|
|
229
|
+
|
|
230
|
+
1. Fork the repository.
|
|
231
|
+
2. Create a feature branch.
|
|
232
|
+
3. Make your changes.
|
|
233
|
+
4. Add or update tests.
|
|
234
|
+
5. Submit a pull request.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
**TestHellos — Small utilities, simpler Python development.**
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "testhellos"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A collection of reusable Python utilities"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Adarsh Kumar" }
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Operating System :: OS Independent"
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[tool.setuptools]
|
|
23
|
+
package-dir = {"" = "src"}
|
|
24
|
+
|
|
25
|
+
[tool.setuptools.packages.find]
|
|
26
|
+
where = ["src"]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
def add(a, b):
|
|
2
|
+
"""Return the sum of two numbers."""
|
|
3
|
+
return a + b
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def subtract(a, b):
|
|
7
|
+
"""Return the difference between two numbers."""
|
|
8
|
+
return a - b
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def multiply(a, b):
|
|
12
|
+
"""Return the product of two numbers."""
|
|
13
|
+
return a * b
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def divide(a, b):
|
|
17
|
+
"""Divide two numbers."""
|
|
18
|
+
|
|
19
|
+
if b == 0:
|
|
20
|
+
raise ValueError("Cannot divide by zero")
|
|
21
|
+
|
|
22
|
+
return a / b
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: testhellos
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A collection of reusable Python utilities
|
|
5
|
+
Author: Adarsh Kumar
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# TestHellos
|
|
13
|
+
|
|
14
|
+
**A lightweight collection of reusable Python utilities for everyday development.**
|
|
15
|
+
|
|
16
|
+
TestHellos is a Python package designed to provide simple, reusable helper functions for mathematical operations and string manipulation.
|
|
17
|
+
|
|
18
|
+
Whether you're building a small script or a larger Python application, TestHellos helps you avoid rewriting common utility functions.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- Simple mathematical operations.
|
|
25
|
+
- String reversal.
|
|
26
|
+
- Word counting.
|
|
27
|
+
- Word capitalization.
|
|
28
|
+
- Lightweight and easy to use.
|
|
29
|
+
- No external runtime dependencies.
|
|
30
|
+
- Easy integration into Python projects.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
Install TestHellos using pip:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install testhellos
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from testhellos import add, subtract, multiply, divide
|
|
48
|
+
from testhellos import reverse_string, count_words, capitalize_words
|
|
49
|
+
|
|
50
|
+
# Mathematical operations
|
|
51
|
+
print(add(10, 20)) # 30
|
|
52
|
+
print(subtract(20, 10)) # 10
|
|
53
|
+
print(multiply(5, 5)) # 25
|
|
54
|
+
print(divide(20, 4)) # 5.0
|
|
55
|
+
|
|
56
|
+
# String operations
|
|
57
|
+
print(reverse_string("Python")) # nohtyP
|
|
58
|
+
print(count_words("Hello Python")) # 2
|
|
59
|
+
print(capitalize_words("hello world")) # Hello World
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Available Functions
|
|
65
|
+
|
|
66
|
+
### Mathematical Utilities
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from testhellos import add, subtract, multiply, divide
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
| Function | Description |
|
|
73
|
+
|---|---|
|
|
74
|
+
| `add(a, b)` | Adds two numbers |
|
|
75
|
+
| `subtract(a, b)` | Subtracts two numbers |
|
|
76
|
+
| `multiply(a, b)` | Multiplies two numbers |
|
|
77
|
+
| `divide(a, b)` | Divides two numbers |
|
|
78
|
+
|
|
79
|
+
Example:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
print(add(10, 5)) # 15
|
|
83
|
+
print(subtract(10, 5)) # 5
|
|
84
|
+
print(multiply(10, 5)) # 50
|
|
85
|
+
print(divide(10, 5)) # 2.0
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Note: `divide()` raises a `ValueError` when the divisor is zero.
|
|
89
|
+
|
|
90
|
+
### String Utilities
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from testhellos import reverse_string, count_words, capitalize_words
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
| Function | Description |
|
|
97
|
+
|---|---|
|
|
98
|
+
| `reverse_string(text)` | Reverses a string |
|
|
99
|
+
| `count_words(text)` | Counts words in a string |
|
|
100
|
+
| `capitalize_words(text)` | Capitalizes each word |
|
|
101
|
+
|
|
102
|
+
Example:
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
print(reverse_string("Hello")) # olleH
|
|
106
|
+
print(count_words("Python is awesome")) # 3
|
|
107
|
+
print(capitalize_words("hello world")) # Hello World
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Project Structure
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
testhellos/
|
|
116
|
+
│
|
|
117
|
+
├── dist/
|
|
118
|
+
│ ├── testhellos-0.1.0-py3-none-any.whl
|
|
119
|
+
│ └── testhellos-0.1.0.tar.gz
|
|
120
|
+
│
|
|
121
|
+
├── src/
|
|
122
|
+
│ └── testhellos/
|
|
123
|
+
│ ├── __init__.py
|
|
124
|
+
│ ├── math_utils.py
|
|
125
|
+
│ └── string_utils.py
|
|
126
|
+
│
|
|
127
|
+
├── tests/
|
|
128
|
+
│ └── test_math_utils.py
|
|
129
|
+
│
|
|
130
|
+
├── pyproject.toml
|
|
131
|
+
├── README.md
|
|
132
|
+
└── LICENSE
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Development Setup
|
|
138
|
+
|
|
139
|
+
Clone the repository:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
git clone https://github.com/YOUR_USERNAME/testhellos.git
|
|
143
|
+
cd testhellos
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Create a virtual environment:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
python -m venv venv
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Activate it:
|
|
153
|
+
|
|
154
|
+
**Linux / macOS**
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
source venv/bin/activate
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Windows**
|
|
161
|
+
|
|
162
|
+
```powershell
|
|
163
|
+
venv\Scripts\activate
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Install development tools:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
python -m pip install --upgrade pip
|
|
170
|
+
python -m pip install build twine pytest
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Install the package in editable mode:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
python -m pip install -e .
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Running Tests
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
pytest
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Building the Package
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
python -m build
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Validate the generated distributions:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
python -m twine check dist/*
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Publishing to PyPI
|
|
204
|
+
|
|
205
|
+
Upload to TestPyPI:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
python -m twine upload --repository testpypi dist/*
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
After testing, publish to the official PyPI:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
python -m twine upload dist/*
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Never commit your API tokens or credentials to GitHub.
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Requirements
|
|
222
|
+
|
|
223
|
+
- Python 3.9 or newer.
|
|
224
|
+
- pip.
|
|
225
|
+
- No third-party runtime dependencies.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## License
|
|
230
|
+
|
|
231
|
+
This project is licensed under the MIT License.
|
|
232
|
+
|
|
233
|
+
See the [LICENSE](LICENSE) file for details.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Contributing
|
|
238
|
+
|
|
239
|
+
Contributions, suggestions, and bug reports are welcome.
|
|
240
|
+
|
|
241
|
+
1. Fork the repository.
|
|
242
|
+
2. Create a feature branch.
|
|
243
|
+
3. Make your changes.
|
|
244
|
+
4. Add or update tests.
|
|
245
|
+
5. Submit a pull request.
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
**TestHellos — Small utilities, simpler Python development.**
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/testhellos/__init__.py
|
|
4
|
+
src/testhellos/math_utils.py
|
|
5
|
+
src/testhellos/string_utils.py
|
|
6
|
+
src/testhellos.egg-info/PKG-INFO
|
|
7
|
+
src/testhellos.egg-info/SOURCES.txt
|
|
8
|
+
src/testhellos.egg-info/dependency_links.txt
|
|
9
|
+
src/testhellos.egg-info/top_level.txt
|
|
10
|
+
tests/test_math_utils.py
|
|
11
|
+
tests/test_string_utils.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
testhellos
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from testhellos import add, subtract, multiply, divide
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_add():
|
|
7
|
+
assert add(10, 20) == 30
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_subtract():
|
|
11
|
+
assert subtract(20, 10) == 10
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_multiply():
|
|
15
|
+
assert multiply(5, 5) == 25
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_divide():
|
|
19
|
+
assert divide(20, 4) == 5
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_divide_by_zero():
|
|
23
|
+
with pytest.raises(ValueError):
|
|
24
|
+
divide(10, 0)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from testhellos import (
|
|
2
|
+
reverse_string,
|
|
3
|
+
count_words,
|
|
4
|
+
capitalize_words
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def test_reverse_string():
|
|
9
|
+
assert reverse_string("hello") == "olleh"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_count_words():
|
|
13
|
+
assert count_words("Hello Python World") == 3
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_empty_string():
|
|
17
|
+
assert count_words("") == 0
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_capitalize_words():
|
|
21
|
+
assert capitalize_words("hello world") == "Hello World"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_reverse_empty_string():
|
|
25
|
+
assert reverse_string("") == ""
|