strfix
Developer Guide
Setup
# create conda environment
$ mamba env create -f env.yml
# update conda environment
$ mamba env update -n strfix --file env.yml
Install
pip install -e .
# install from pypi
pip install strfix
nbdev
# 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
# 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:
$ 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
Documentation can be found hosted on GitHub repository pages. Additionally you can find package manager specific guidelines on conda and pypi respectively.
Examples
Prefix
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
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)
Postfix
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)
Extension
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')
Metadata
Release files for strfix 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| strfix-0.0.1.tar.gz | 13.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| strfix-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.8 kB
Release files / strfix-0.0.1.tar.gz
| Download URL | strfix-0.0.1.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12e2e0024721a2d7145ea6f4c6bdbaa202219f54578b279b5b626f77df06f3ac
|
|
BLAKE2b-256 checksum How to use checksums |
2ae0261374d6e4921324219f8b0b40103a60293145405d245c7cf07237213a5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / strfix-0.0.1-py3-none-any.whl
| Download URL | strfix-0.0.1-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc69319c794b941e2d8109b9d4dd9ba7f3ea6ed338699036e4a410990fb3dabe
|
|
BLAKE2b-256 checksum How to use checksums |
0b33063474e47999194cac350f7b543cecc2c4555a7ae13402eb59fcea311e89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|