# string-gen
String generator by regex
Installation
----
Install using pip with
```bash
pip install string_gen
```
Example
----
```python
from string_gen import StringGen
generator = StringGen(r'(A|B)\d{4}(\.|-)\d{1}')
print(generator.render()) # B9954.4
print(generator.render()) # A5292-1
generator = StringGen(r'[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}')
print(generator.render()) # 52aabe4b-01fa-4b33-8976-b53b09f49e72
# Generate list strings
generator = StringGen(r'(A|B)\d{4}\.\d{1}')
print(generator.render_list(5)) # ['A9046.5', 'A8334.7', 'B5496-6', 'A4207-2', 'A1171-7']
# Return a set of generated unique strings
generator = StringGen(r'\d')
print(generator.render_set(10)) # {'4', '6', '3', '9', '2', '7', '5', '1', '8', '0'}
```
Changelog
----
* [Releases](https://github.com/tolstislon/string-gen/releases)
Contributing
----
#### Contributions are very welcome.
You might want to:
* Fix spelling errors
* Improve documentation
* Add tests for untested code
* Add new features
* Fix bugs
#### Getting started
* python 3.12
* pipenv 2023.11.15+
1. Clone the repository
```bash
git clone https://github.com/tolstislon/string-gen.git
cd string-gen
```
2. Install dev dependencies
```bash
pipenv install --dev
pipenv shell
```
3. Run the black
```bash
pipenv run black
```
4. Run the flake8
```bash
pipenv run flake
```
5. Run tests
```bash
pipenv run tests
```
Raw data
{
"_id": null,
"home_page": "https://github.com/tolstislon/string-gen",
"name": "string-gen",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "testing, test-data, test-data-generator, string, regex",
"author": "tolstislon",
"author_email": "tolstislon@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/f5/23/b0888d2f08ed7b72b13842607434935f11ea0d727756ff1a38031a455daf/string_gen-0.1.0.tar.gz",
"platform": null,
"description": "# string-gen\n\nString generator by regex\n\nInstallation\n----\nInstall using pip with\n\n```bash\npip install string_gen\n```\n\nExample\n----\n\n```python\nfrom string_gen import StringGen\n\ngenerator = StringGen(r'(A|B)\\d{4}(\\.|-)\\d{1}')\nprint(generator.render()) # B9954.4\nprint(generator.render()) # A5292-1\n\ngenerator = StringGen(r'[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}')\nprint(generator.render()) # 52aabe4b-01fa-4b33-8976-b53b09f49e72\n\n# Generate list strings\ngenerator = StringGen(r'(A|B)\\d{4}\\.\\d{1}')\nprint(generator.render_list(5)) # ['A9046.5', 'A8334.7', 'B5496-6', 'A4207-2', 'A1171-7']\n\n# Return a set of generated unique strings\ngenerator = StringGen(r'\\d')\nprint(generator.render_set(10)) # {'4', '6', '3', '9', '2', '7', '5', '1', '8', '0'}\n```\n\nChangelog\n----\n\n* [Releases](https://github.com/tolstislon/string-gen/releases)\n\nContributing\n----\n\n#### Contributions are very welcome.\n\nYou might want to:\n\n* Fix spelling errors\n* Improve documentation\n* Add tests for untested code\n* Add new features\n* Fix bugs\n\n#### Getting started\n\n* python 3.12\n* pipenv 2023.11.15+\n\n1. Clone the repository\n ```bash\n git clone https://github.com/tolstislon/string-gen.git\n cd string-gen\n ```\n2. Install dev dependencies\n ```bash\n pipenv install --dev\n pipenv shell\n ```\n3. Run the black\n ```bash\n pipenv run black\n ```\n4. Run the flake8\n ```bash\n pipenv run flake\n ```\n5. Run tests\n ```bash\n pipenv run tests\n ```\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "String generator by regex",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/tolstislon/string-gen"
},
"split_keywords": [
"testing",
" test-data",
" test-data-generator",
" string",
" regex"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e47cb25bc71159f90a570618f0fa6865b44df31db56903d3d1861febc6b898db",
"md5": "dd3f819bb6d1f549c866628ad0f57472",
"sha256": "80784301a09acfb30054e957b172a16b0445f569261790cd2bd53e6474f773e0"
},
"downloads": -1,
"filename": "string_gen-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dd3f819bb6d1f549c866628ad0f57472",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 5480,
"upload_time": "2024-07-26T15:42:52",
"upload_time_iso_8601": "2024-07-26T15:42:52.930561Z",
"url": "https://files.pythonhosted.org/packages/e4/7c/b25bc71159f90a570618f0fa6865b44df31db56903d3d1861febc6b898db/string_gen-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f523b0888d2f08ed7b72b13842607434935f11ea0d727756ff1a38031a455daf",
"md5": "81c0f51a9ccfbb44b5452a80b2f5c5ef",
"sha256": "65a6bd501e538df58dab647ad40dba16f4d187368d0e4afd415ad2b651f95552"
},
"downloads": -1,
"filename": "string_gen-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "81c0f51a9ccfbb44b5452a80b2f5c5ef",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 8857,
"upload_time": "2024-07-26T15:42:53",
"upload_time_iso_8601": "2024-07-26T15:42:53.756647Z",
"url": "https://files.pythonhosted.org/packages/f5/23/b0888d2f08ed7b72b13842607434935f11ea0d727756ff1a38031a455daf/string_gen-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-26 15:42:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tolstislon",
"github_project": "string-gen",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "string-gen"
}