autofaker 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.
- autofaker-0.1.0/CONTRIBUTING.md +341 -0
- autofaker-0.1.0/LICENSE +21 -0
- autofaker-0.1.0/MANIFEST.in +4 -0
- autofaker-0.1.0/PKG-INFO +487 -0
- autofaker-0.1.0/README.md +702 -0
- autofaker-0.1.0/docs/pypi.md +470 -0
- autofaker-0.1.0/pyproject.toml +26 -0
- autofaker-0.1.0/setup.cfg +4 -0
- autofaker-0.1.0/setup.py +3 -0
- autofaker-0.1.0/src/autofaker/__init__.py +14 -0
- autofaker-0.1.0/src/autofaker/attributes.py +19 -0
- autofaker-0.1.0/src/autofaker/autodata.py +71 -0
- autofaker-0.1.0/src/autofaker/base.py +7 -0
- autofaker-0.1.0/src/autofaker/builtins.py +105 -0
- autofaker-0.1.0/src/autofaker/dataframe.py +38 -0
- autofaker-0.1.0/src/autofaker/dates.py +51 -0
- autofaker-0.1.0/src/autofaker/decorators.py +209 -0
- autofaker-0.1.0/src/autofaker/enums.py +16 -0
- autofaker-0.1.0/src/autofaker/fakes.py +30 -0
- autofaker-0.1.0/src/autofaker/generator.py +352 -0
- autofaker-0.1.0/src/autofaker/literals.py +23 -0
- autofaker-0.1.0/src/autofaker/registry.py +185 -0
- autofaker-0.1.0/src/autofaker.egg-info/PKG-INFO +487 -0
- autofaker-0.1.0/src/autofaker.egg-info/SOURCES.txt +75 -0
- autofaker-0.1.0/src/autofaker.egg-info/dependency_links.txt +1 -0
- autofaker-0.1.0/src/autofaker.egg-info/requires.txt +3 -0
- autofaker-0.1.0/src/autofaker.egg-info/top_level.txt +1 -0
- autofaker-0.1.0/tests/pytests/test_decorator_anonymous_builtins.py +254 -0
- autofaker-0.1.0/tests/pytests/test_decorator_anonymous_data_classes.py +93 -0
- autofaker-0.1.0/tests/pytests/test_decorator_anonymous_data_classes_nested.py +110 -0
- autofaker-0.1.0/tests/pytests/test_decorator_anonymous_dataframe_pandas.py +123 -0
- autofaker-0.1.0/tests/pytests/test_decorator_anonymous_enum_classes.py +42 -0
- autofaker-0.1.0/tests/pytests/test_decorator_anonymous_nested_classes.py +119 -0
- autofaker-0.1.0/tests/pytests/test_decorator_anonymous_new_types.py +223 -0
- autofaker-0.1.0/tests/pytests/test_decorator_anonymous_simple_classes.py +91 -0
- autofaker-0.1.0/tests/test_attributes.py +41 -0
- autofaker-0.1.0/tests/test_base.py +19 -0
- autofaker-0.1.0/tests/test_bugfixes.py +134 -0
- autofaker-0.1.0/tests/test_collection_generator.py +61 -0
- autofaker-0.1.0/tests/test_create_anonymous_builtins.py +80 -0
- autofaker-0.1.0/tests/test_create_anonymous_complex_classes.py +201 -0
- autofaker-0.1.0/tests/test_create_anonymous_data_class_with_fakes.py +108 -0
- autofaker-0.1.0/tests/test_create_anonymous_data_classes.py +131 -0
- autofaker-0.1.0/tests/test_create_anonymous_data_classes_with_fakes.py +128 -0
- autofaker-0.1.0/tests/test_create_anonymous_dataclass_new_types.py +170 -0
- autofaker-0.1.0/tests/test_create_anonymous_dataframe_pandas.py +167 -0
- autofaker-0.1.0/tests/test_create_anonymous_dataframe_with_fakes.py +48 -0
- autofaker-0.1.0/tests/test_create_anonymous_dates.py +31 -0
- autofaker-0.1.0/tests/test_create_anonymous_enum_classes.py +39 -0
- autofaker-0.1.0/tests/test_create_anonymous_lists.py +144 -0
- autofaker-0.1.0/tests/test_create_anonymous_literal.py +340 -0
- autofaker-0.1.0/tests/test_create_anonymous_nested_classes.py +59 -0
- autofaker-0.1.0/tests/test_create_anonymous_nested_classes_with_lists.py +79 -0
- autofaker-0.1.0/tests/test_create_anonymous_new_builtins.py +107 -0
- autofaker-0.1.0/tests/test_create_anonymous_simple_classes.py +33 -0
- autofaker-0.1.0/tests/test_create_anonymous_sut.py +247 -0
- autofaker-0.1.0/tests/test_create_anonymous_time_types.py +35 -0
- autofaker-0.1.0/tests/test_create_anonymous_typing_generics.py +157 -0
- autofaker-0.1.0/tests/test_create_many_anonymous_builtins.py +77 -0
- autofaker-0.1.0/tests/test_create_many_anonymous_dates.py +45 -0
- autofaker-0.1.0/tests/test_create_many_anonymous_nested_classes.py +69 -0
- autofaker-0.1.0/tests/test_create_many_anonymous_nested_classes_with_lists.py +85 -0
- autofaker-0.1.0/tests/test_create_many_anonymous_new_builtins.py +76 -0
- autofaker-0.1.0/tests/test_create_many_anonymous_simple_classes.py +42 -0
- autofaker-0.1.0/tests/test_decorator_exceptions.py +129 -0
- autofaker-0.1.0/tests/test_edge_cases.py +114 -0
- autofaker-0.1.0/tests/test_fakes.py +41 -0
- autofaker-0.1.0/tests/test_generator.py +128 -0
- autofaker-0.1.0/tests/test_literals.py +38 -0
- autofaker-0.1.0/tests/test_registry.py +180 -0
- autofaker-0.1.0/tests/unittests/test_decorator_anonymous_builtins.py +236 -0
- autofaker-0.1.0/tests/unittests/test_decorator_anonymous_data_classes.py +83 -0
- autofaker-0.1.0/tests/unittests/test_decorator_anonymous_data_classes_nested.py +102 -0
- autofaker-0.1.0/tests/unittests/test_decorator_anonymous_dataframe_pandas.py +109 -0
- autofaker-0.1.0/tests/unittests/test_decorator_anonymous_enum_classes.py +24 -0
- autofaker-0.1.0/tests/unittests/test_decorator_anonymous_nested_classes.py +108 -0
- autofaker-0.1.0/tests/unittests/test_decorator_anonymous_simple_classes.py +80 -0
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
# Contributing to AutoFaker
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to AutoFaker! This document provides guidelines and information for contributors to help maintain code quality and consistency.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Code of Conduct](#code-of-conduct)
|
|
8
|
+
- [Getting Started](#getting-started)
|
|
9
|
+
- [Development Setup](#development-setup)
|
|
10
|
+
- [Code Style and Patterns](#code-style-and-patterns)
|
|
11
|
+
- [Testing Guidelines](#testing-guidelines)
|
|
12
|
+
- [Pull Request Guidelines](#pull-request-guidelines)
|
|
13
|
+
- [Documentation Guidelines](#documentation-guidelines)
|
|
14
|
+
- [Issue Reporting](#issue-reporting)
|
|
15
|
+
|
|
16
|
+
## Code of Conduct
|
|
17
|
+
|
|
18
|
+
Please be respectful and considerate in all interactions. We aim to maintain a welcoming and inclusive environment for all contributors.
|
|
19
|
+
|
|
20
|
+
## Getting Started
|
|
21
|
+
|
|
22
|
+
1. Fork the repository on GitHub
|
|
23
|
+
2. Clone your fork locally:
|
|
24
|
+
```bash
|
|
25
|
+
git clone https://github.com/your-username/autofaker.git
|
|
26
|
+
cd autofaker
|
|
27
|
+
```
|
|
28
|
+
3. Add the upstream repository:
|
|
29
|
+
```bash
|
|
30
|
+
git remote add upstream https://github.com/christianhelle/autofaker.git
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Development Setup
|
|
34
|
+
|
|
35
|
+
### Prerequisites
|
|
36
|
+
|
|
37
|
+
- Python 3.10 or higher
|
|
38
|
+
- pip package manager
|
|
39
|
+
|
|
40
|
+
### Installation
|
|
41
|
+
|
|
42
|
+
1. Install development dependencies:
|
|
43
|
+
```bash
|
|
44
|
+
make prepare
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
2. Install the package in development mode:
|
|
48
|
+
```bash
|
|
49
|
+
python setup.py develop --user
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Note**: If you encounter permission errors with the Makefile targets, you can run commands individually:
|
|
53
|
+
```bash
|
|
54
|
+
pip install -r requirements.txt
|
|
55
|
+
python setup.py develop --user
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Available Make Targets
|
|
59
|
+
|
|
60
|
+
- `make prepare`: Install development dependencies
|
|
61
|
+
- `make debug`: Install package in development mode
|
|
62
|
+
- `make test`: Run all tests with coverage
|
|
63
|
+
- `make package`: Build distribution packages
|
|
64
|
+
- `make all`: Run complete build pipeline
|
|
65
|
+
|
|
66
|
+
## Code Style and Patterns
|
|
67
|
+
|
|
68
|
+
### Use Existing Code Patterns
|
|
69
|
+
|
|
70
|
+
When contributing, please follow the established patterns in the codebase:
|
|
71
|
+
|
|
72
|
+
#### 1. Class Structure
|
|
73
|
+
Follow the existing patterns for creating data generators:
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
# Example from existing codebase
|
|
77
|
+
class ExampleGenerator:
|
|
78
|
+
def create(self, t: type, use_fake_data: bool = False):
|
|
79
|
+
# Implementation here
|
|
80
|
+
pass
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
#### 2. Decorator Patterns
|
|
84
|
+
When adding new decorators, follow the existing pattern:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
def example_decorator(*types: object, use_fake_data: bool = False):
|
|
88
|
+
def decorator(function):
|
|
89
|
+
def wrapper(*args):
|
|
90
|
+
# Implementation following existing pattern
|
|
91
|
+
pass
|
|
92
|
+
return wrapper
|
|
93
|
+
return decorator
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### 3. Test Patterns
|
|
97
|
+
Use both unittest and pytest patterns as established:
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
import unittest
|
|
101
|
+
from autofaker import Autodata, autodata
|
|
102
|
+
|
|
103
|
+
class ExampleTestCase(unittest.TestCase):
|
|
104
|
+
def test_example_functionality(self):
|
|
105
|
+
# Test implementation
|
|
106
|
+
self.assertIsNotNone(result)
|
|
107
|
+
|
|
108
|
+
@autodata(str, int)
|
|
109
|
+
def test_with_decorator(self, text, number):
|
|
110
|
+
# Test using decorator pattern
|
|
111
|
+
self.assertIsInstance(text, str)
|
|
112
|
+
self.assertIsInstance(number, int)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
#### 4. Type Hints
|
|
116
|
+
Use type hints consistently, following existing patterns:
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
from typing import List, Optional, Union
|
|
120
|
+
|
|
121
|
+
def create_example(data_type: type, count: int = 3) -> List[object]:
|
|
122
|
+
# Implementation with proper type hints
|
|
123
|
+
pass
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### 5. Docstrings
|
|
127
|
+
Include docstrings for public methods and classes:
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
def create_anonymous_data(data_type: type) -> object:
|
|
131
|
+
"""
|
|
132
|
+
Creates anonymous data for the specified type.
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
data_type: The type to create anonymous data for
|
|
136
|
+
|
|
137
|
+
Returns:
|
|
138
|
+
An instance of the specified type with anonymous data
|
|
139
|
+
"""
|
|
140
|
+
pass
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Naming Conventions
|
|
144
|
+
|
|
145
|
+
- Use snake_case for functions and variables
|
|
146
|
+
- Use PascalCase for classes
|
|
147
|
+
- Use descriptive names that reflect functionality
|
|
148
|
+
- Follow existing naming patterns in the codebase
|
|
149
|
+
|
|
150
|
+
### Import Organization
|
|
151
|
+
|
|
152
|
+
Organize imports following the existing pattern:
|
|
153
|
+
1. Standard library imports
|
|
154
|
+
2. Third-party imports
|
|
155
|
+
3. Local imports
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
import unittest
|
|
159
|
+
from typing import List
|
|
160
|
+
from dataclasses import dataclass
|
|
161
|
+
|
|
162
|
+
import pandas
|
|
163
|
+
|
|
164
|
+
from autofaker import Autodata
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Testing Guidelines
|
|
168
|
+
|
|
169
|
+
### Test Coverage Requirements
|
|
170
|
+
|
|
171
|
+
- All new functionality must include comprehensive tests
|
|
172
|
+
- Maintain or improve existing test coverage
|
|
173
|
+
- Tests should cover both success and failure scenarios
|
|
174
|
+
|
|
175
|
+
### Test Patterns
|
|
176
|
+
|
|
177
|
+
1. **Unit Tests**: Use unittest.TestCase for traditional unit testing
|
|
178
|
+
2. **Decorator Tests**: Use the @autodata and @fakedata patterns
|
|
179
|
+
3. **Integration Tests**: Test complete workflows
|
|
180
|
+
4. **Exception Tests**: Test error conditions and edge cases
|
|
181
|
+
|
|
182
|
+
### Running Tests
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Run all tests
|
|
186
|
+
python -m pytest tests/ -v --cov --cov-report=term-missing
|
|
187
|
+
|
|
188
|
+
# Alternative: use make if you have proper permissions
|
|
189
|
+
make test
|
|
190
|
+
|
|
191
|
+
# Run specific test file
|
|
192
|
+
python -m pytest tests/test_specific_feature.py -v
|
|
193
|
+
|
|
194
|
+
# Run with coverage
|
|
195
|
+
python -m pytest tests/ -v --cov --cov-report=term-missing
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Test Organization
|
|
199
|
+
|
|
200
|
+
- Place tests in the `tests/` directory
|
|
201
|
+
- Name test files with `test_` prefix
|
|
202
|
+
- Group related tests in the same file
|
|
203
|
+
- Use descriptive test method names
|
|
204
|
+
|
|
205
|
+
## Pull Request Guidelines
|
|
206
|
+
|
|
207
|
+
### PR Description Requirements
|
|
208
|
+
|
|
209
|
+
**Pull Request descriptions must be as verbose as possible** and include:
|
|
210
|
+
|
|
211
|
+
#### Required Information
|
|
212
|
+
|
|
213
|
+
1. **Summary**: Clear, concise description of what the PR accomplishes
|
|
214
|
+
2. **Motivation**: Why this change is needed
|
|
215
|
+
3. **Changes Made**: Detailed list of all changes, including:
|
|
216
|
+
- New features added
|
|
217
|
+
- Bug fixes implemented
|
|
218
|
+
- Code refactoring performed
|
|
219
|
+
- Documentation updates
|
|
220
|
+
4. **Testing**: Description of how the changes were tested
|
|
221
|
+
5. **Breaking Changes**: Any backwards incompatible changes
|
|
222
|
+
6. **Additional Notes**: Any other relevant information
|
|
223
|
+
|
|
224
|
+
#### PR Description Template
|
|
225
|
+
|
|
226
|
+
```markdown
|
|
227
|
+
## Summary
|
|
228
|
+
[Provide a clear summary of the changes]
|
|
229
|
+
|
|
230
|
+
## Motivation
|
|
231
|
+
[Explain why this change is needed]
|
|
232
|
+
|
|
233
|
+
## Changes Made
|
|
234
|
+
- [ ] Feature A: Description of feature A
|
|
235
|
+
- [ ] Bug fix B: Description of bug fix B
|
|
236
|
+
- [ ] Documentation updates for X
|
|
237
|
+
- [ ] Added tests for Y
|
|
238
|
+
|
|
239
|
+
## Testing
|
|
240
|
+
- [ ] Added unit tests for new functionality
|
|
241
|
+
- [ ] Verified existing tests pass
|
|
242
|
+
- [ ] Tested on Python versions: [list versions]
|
|
243
|
+
- [ ] Manual testing performed: [describe scenarios]
|
|
244
|
+
|
|
245
|
+
## Breaking Changes
|
|
246
|
+
[List any breaking changes or write "None"]
|
|
247
|
+
|
|
248
|
+
## Additional Notes
|
|
249
|
+
[Any other relevant information]
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Before Submitting a PR
|
|
253
|
+
|
|
254
|
+
1. **Update Documentation**: If your changes affect user-facing functionality
|
|
255
|
+
2. **Run Tests**: Ensure all tests pass locally
|
|
256
|
+
3. **Check Coverage**: Verify test coverage is maintained
|
|
257
|
+
4. **Update README**: If adding new features or changing existing behavior
|
|
258
|
+
5. **Add Examples**: Include usage examples for new features
|
|
259
|
+
|
|
260
|
+
### PR Submission Process
|
|
261
|
+
|
|
262
|
+
1. Create a feature branch from main:
|
|
263
|
+
```bash
|
|
264
|
+
git checkout -b feature/your-feature-name
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
2. Make your changes following the established patterns
|
|
268
|
+
|
|
269
|
+
3. Test your changes thoroughly:
|
|
270
|
+
```bash
|
|
271
|
+
python -m pytest tests/ -v --cov --cov-report=term-missing
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
4. Commit with descriptive messages:
|
|
275
|
+
```bash
|
|
276
|
+
git commit -m "Add feature X with comprehensive tests"
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
5. Push to your fork:
|
|
280
|
+
```bash
|
|
281
|
+
git push origin feature/your-feature-name
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
6. Create a Pull Request with verbose description
|
|
285
|
+
|
|
286
|
+
## Documentation Guidelines
|
|
287
|
+
|
|
288
|
+
### Keep README Up to Date
|
|
289
|
+
|
|
290
|
+
**All changes that affect user-facing functionality must include README updates:**
|
|
291
|
+
|
|
292
|
+
1. **New Features**: Add examples and documentation
|
|
293
|
+
2. **API Changes**: Update existing examples
|
|
294
|
+
3. **New Supported Types**: Update the "Supported data types" section
|
|
295
|
+
4. **Installation Changes**: Update installation instructions
|
|
296
|
+
|
|
297
|
+
### Documentation Standards
|
|
298
|
+
|
|
299
|
+
- Use clear, concise language
|
|
300
|
+
- Include code examples for new features
|
|
301
|
+
- Ensure examples are tested and work correctly
|
|
302
|
+
- Update both README.md and docs/pypi.md if applicable
|
|
303
|
+
|
|
304
|
+
### Example Documentation
|
|
305
|
+
|
|
306
|
+
When adding new features, include examples like:
|
|
307
|
+
|
|
308
|
+
```python
|
|
309
|
+
# Create anonymous data using new feature
|
|
310
|
+
from autofaker import Autodata
|
|
311
|
+
|
|
312
|
+
result = Autodata.create_new_feature(YourClass)
|
|
313
|
+
print(f'Result: {result}')
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## Issue Reporting
|
|
317
|
+
|
|
318
|
+
When reporting issues:
|
|
319
|
+
|
|
320
|
+
1. **Use Issue Templates**: Follow any provided templates
|
|
321
|
+
2. **Provide Context**: Include Python version, OS, and package version
|
|
322
|
+
3. **Include Examples**: Provide minimal reproducible examples
|
|
323
|
+
4. **Check Existing Issues**: Search for similar issues first
|
|
324
|
+
|
|
325
|
+
## Development Best Practices
|
|
326
|
+
|
|
327
|
+
1. **Small, Focused Changes**: Keep PRs focused on single features or fixes
|
|
328
|
+
2. **Maintain Backwards Compatibility**: Avoid breaking existing functionality
|
|
329
|
+
3. **Follow Existing Patterns**: Consistency is key
|
|
330
|
+
4. **Test Thoroughly**: Include comprehensive tests
|
|
331
|
+
5. **Document Changes**: Update documentation for user-facing changes
|
|
332
|
+
|
|
333
|
+
## Getting Help
|
|
334
|
+
|
|
335
|
+
If you need help or have questions:
|
|
336
|
+
|
|
337
|
+
1. Check existing documentation and issues
|
|
338
|
+
2. Create an issue with the "question" label
|
|
339
|
+
3. Be specific about what you're trying to accomplish
|
|
340
|
+
|
|
341
|
+
Thank you for contributing to AutoFaker! Your contributions help make this library better for everyone.
|
autofaker-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Christian Resma Helle
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|