Literal Enum
# create conda environment
$ mamba env create -f env.yml
# update conda environment
$ mamba env update -n strfix --file env.yml
pip install -e .
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
# 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'
Install latest from the GitHub repository:
$ pip install git+https://github.com/dsm-72/strfix.git
or from conda
$ conda install -c dsm-72 strfix
or from pypi
$ pip install strfix
Documentation can be found hosted on GitHub repository pages. Additionally you can find package manager specific guidelines on conda and pypi respectively.
The character used to prefix the string sep: ClassVar[str] = '' # The separator used to split the prefix into parts chainable: ClassVar[bool] = False addw_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})
'hi' + xa, f'hi{xa}'
('hi_X_a', 'hiX_a')
xa + xb, xa + xa, xb + xb
(X_a_b, X_a_a, X_b_b)
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
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})
'hi' + xa, f'hi{xa}', 'hi' + xa + xb
(hi_a_hvg, 'hia_hvg', hi_a_b_hvg)
xa + xb, xa + xa, xb + xb
(a_b_hvg, a_a_hvg, b_b_hvg)
GZ = Ext('....gz')
GZ.isaxv(GZ), GZ, GZ.addp('gz')
(True, .gz, '.gz')
'file' + GZ, f"{'file'}{GZ}", GZ + GZ
('file.gz', 'file.gz', '.gz.gz')