# strfix
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
## Developer Guide
### Setup
``` sh
# create conda environment
$ mamba env create -f env.yml
# update conda environment
$ mamba env update -n strfix --file env.yml
```
### Install
``` sh
pip install -e .
# install from pypi
pip install strfix
```
### nbdev
``` sh
# activate conda environment
$ conda activate strfix
# make sure the strfix package is installed in development mode
$ pip install -e .
# make changes under nbs/ directory
# ...
# compile to have changes apply to the strfix package
$ nbdev_prepare
```
### Publishing
``` sh
# publish to pypi
$ nbdev_pypi
# publish to conda
$ nbdev_conda --build_args '-c conda-forge'
$ nbdev_conda --mambabuild --build_args '-c conda-forge -c dsm-72'
```
# Usage
## Installation
Install latest from the GitHub
[repository](https://github.com/dsm-72/strfix):
``` sh
$ pip install git+https://github.com/dsm-72/strfix.git
```
or from [conda](https://anaconda.org/dsm-72/strfix)
``` sh
$ conda install -c dsm-72 strfix
```
or from [pypi](https://pypi.org/project/strfix/)
``` sh
$ pip install strfix
```
## Documentation
Documentation can be found hosted on GitHub
[repository](https://github.com/dsm-72/strfix)
[pages](https://dsm-72.github.io/strfix/). Additionally you can find
package manager specific guidelines on
[conda](https://anaconda.org/dsm-72/strfix) and
[pypi](https://pypi.org/project/strfix/) respectively.
## Examples
### Prefix
``` python
class X_(Prefix):
fix: ClassVar[str] = 'X' # The character used to prefix the string
sep: ClassVar[str] = '_' # The separator used to split the prefix into parts
chainable: ClassVar[bool] = False
add_w_sep: ClassVar[bool] = True
pass
```
``` python
xa = X_('a')
xb = X_('b')
da = dict(X_a='hi', X_b=2)
xa, xb, da
```
(X_a, X_b, {'X_a': 'hi', 'X_b': 2})
``` python
'hi' + xa, f'hi{xa}'
```
('hi_X_a', 'hiX_a')
``` python
xa + xb, xa + xa, xb + xb
```
(X_a_b, X_a_a, X_b_b)
### Postfix
``` python
class _hvg(Postfix):
fix: ClassVar[str] = 'hvg' # The character used to prefix the string
sep: ClassVar[str] = '_' # The separator used to split the prefix into parts
chainable: ClassVar[bool] = True
add_w_sep: ClassVar[bool] = True
pass
```
``` python
xa = _hvg('a')
xb = _hvg('b')
da = dict(a_hvg='hi', b_hvg=2)
xa, xb, da
```
(a_hvg, b_hvg, {'a_hvg': 'hi', 'b_hvg': 2})
``` python
'hi' + xa, f'hi{xa}', 'hi' + xa + xb
```
(hi_a_hvg, 'hia_hvg', hi_a_b_hvg)
``` python
xa + xb, xa + xa, xb + xb
```
(a_b_hvg, a_a_hvg, b_b_hvg)
### Extension
``` python
GZ = Ext('....gz')
GZ.isaxv(GZ), GZ, GZ.addp('gz')
```
(True, .gz, '.gz')
``` python
'file' + GZ, f"{'file'}{GZ}", GZ + GZ
```
('file.gz', 'file.gz', '.gz.gz')
Raw data
{
"_id": null,
"home_page": "https://github.com/dsm-72/strfix",
"name": "strfix",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": "",
"keywords": "nbdev jupyter notebook python",
"author": "dsm-72",
"author_email": "sumner.magruder@yale.edu",
"download_url": "https://files.pythonhosted.org/packages/2a/e0/261374d6e4921324219f8b0b40103a60293145405d245c7cf07237213a5f/strfix-0.0.1.tar.gz",
"platform": null,
"description": "# strfix\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n## Developer Guide\n\n### Setup\n\n``` sh\n# create conda environment\n$ mamba env create -f env.yml\n\n# update conda environment\n$ mamba env update -n strfix --file env.yml\n```\n\n### Install\n\n``` sh\npip install -e .\n\n# install from pypi\npip install strfix\n```\n\n### nbdev\n\n``` sh\n# activate conda environment\n$ conda activate strfix\n\n# make sure the strfix package is installed in development mode\n$ pip install -e .\n\n# make changes under nbs/ directory\n# ...\n\n# compile to have changes apply to the strfix package\n$ nbdev_prepare\n```\n\n### Publishing\n\n``` sh\n# publish to pypi\n$ nbdev_pypi\n\n# publish to conda\n$ nbdev_conda --build_args '-c conda-forge'\n$ nbdev_conda --mambabuild --build_args '-c conda-forge -c dsm-72'\n```\n\n# Usage\n\n## Installation\n\nInstall latest from the GitHub\n[repository](https://github.com/dsm-72/strfix):\n\n``` sh\n$ pip install git+https://github.com/dsm-72/strfix.git\n```\n\nor from [conda](https://anaconda.org/dsm-72/strfix)\n\n``` sh\n$ conda install -c dsm-72 strfix\n```\n\nor from [pypi](https://pypi.org/project/strfix/)\n\n``` sh\n$ pip install strfix\n```\n\n## Documentation\n\nDocumentation can be found hosted on GitHub\n[repository](https://github.com/dsm-72/strfix)\n[pages](https://dsm-72.github.io/strfix/). Additionally you can find\npackage manager specific guidelines on\n[conda](https://anaconda.org/dsm-72/strfix) and\n[pypi](https://pypi.org/project/strfix/) respectively.\n\n## Examples\n\n### Prefix\n\n``` python\nclass X_(Prefix):\n fix: ClassVar[str] = 'X' # The character used to prefix the string\n sep: ClassVar[str] = '_' # The separator used to split the prefix into parts\n chainable: ClassVar[bool] = False\n add_w_sep: ClassVar[bool] = True\n pass\n```\n\n``` python\nxa = X_('a')\nxb = X_('b')\nda = dict(X_a='hi', X_b=2)\nxa, xb, da\n```\n\n (X_a, X_b, {'X_a': 'hi', 'X_b': 2})\n\n``` python\n'hi' + xa, f'hi{xa}'\n```\n\n ('hi_X_a', 'hiX_a')\n\n``` python\nxa + xb, xa + xa, xb + xb\n```\n\n (X_a_b, X_a_a, X_b_b)\n\n### Postfix\n\n``` python\nclass _hvg(Postfix):\n fix: ClassVar[str] = 'hvg' # The character used to prefix the string\n sep: ClassVar[str] = '_' # The separator used to split the prefix into parts\n chainable: ClassVar[bool] = True\n add_w_sep: ClassVar[bool] = True\n pass\n```\n\n``` python\nxa = _hvg('a')\nxb = _hvg('b')\nda = dict(a_hvg='hi', b_hvg=2)\nxa, xb, da\n```\n\n (a_hvg, b_hvg, {'a_hvg': 'hi', 'b_hvg': 2})\n\n``` python\n'hi' + xa, f'hi{xa}', 'hi' + xa + xb\n```\n\n (hi_a_hvg, 'hia_hvg', hi_a_b_hvg)\n\n``` python\nxa + xb, xa + xa, xb + xb\n```\n\n (a_b_hvg, a_a_hvg, b_b_hvg)\n\n### Extension\n\n``` python\nGZ = Ext('....gz')\nGZ.isaxv(GZ), GZ, GZ.addp('gz')\n```\n\n (True, .gz, '.gz')\n\n``` python\n'file' + GZ, f\"{'file'}{GZ}\", GZ + GZ\n```\n\n ('file.gz', 'file.gz', '.gz.gz')\n",
"bugtrack_url": null,
"license": "Apache Software License 2.0",
"summary": "Literal Enum",
"version": "0.0.1",
"project_urls": {
"Homepage": "https://github.com/dsm-72/strfix"
},
"split_keywords": [
"nbdev",
"jupyter",
"notebook",
"python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0b33063474e47999194cac350f7b543cecc2c4555a7ae13402eb59fcea311e89",
"md5": "308c9516c246713fa21d043317910d89",
"sha256": "fc69319c794b941e2d8109b9d4dd9ba7f3ea6ed338699036e4a410990fb3dabe"
},
"downloads": -1,
"filename": "strfix-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "308c9516c246713fa21d043317910d89",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 12202,
"upload_time": "2023-08-29T18:24:14",
"upload_time_iso_8601": "2023-08-29T18:24:14.179389Z",
"url": "https://files.pythonhosted.org/packages/0b/33/063474e47999194cac350f7b543cecc2c4555a7ae13402eb59fcea311e89/strfix-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2ae0261374d6e4921324219f8b0b40103a60293145405d245c7cf07237213a5f",
"md5": "dc8db8a95f3de6e2c06c1a274db8cfb5",
"sha256": "12e2e0024721a2d7145ea6f4c6bdbaa202219f54578b279b5b626f77df06f3ac"
},
"downloads": -1,
"filename": "strfix-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "dc8db8a95f3de6e2c06c1a274db8cfb5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 13619,
"upload_time": "2023-08-29T18:24:16",
"upload_time_iso_8601": "2023-08-29T18:24:16.094857Z",
"url": "https://files.pythonhosted.org/packages/2a/e0/261374d6e4921324219f8b0b40103a60293145405d245c7cf07237213a5f/strfix-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-29 18:24:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "dsm-72",
"github_project": "strfix",
"github_not_found": true,
"lcname": "strfix"
}