Skip to main content

Literal Enum

Project description

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')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

strfix-0.0.1.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

strfix-0.0.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file strfix-0.0.1.tar.gz.

File metadata

  • Download URL: strfix-0.0.1.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for strfix-0.0.1.tar.gz
Algorithm Hash digest
SHA256 12e2e0024721a2d7145ea6f4c6bdbaa202219f54578b279b5b626f77df06f3ac
MD5 dc8db8a95f3de6e2c06c1a274db8cfb5
BLAKE2b-256 2ae0261374d6e4921324219f8b0b40103a60293145405d245c7cf07237213a5f

See more details on using hashes here.

File details

Details for the file strfix-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: strfix-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for strfix-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fc69319c794b941e2d8109b9d4dd9ba7f3ea6ed338699036e4a410990fb3dabe
MD5 308c9516c246713fa21d043317910d89
BLAKE2b-256 0b33063474e47999194cac350f7b543cecc2c4555a7ae13402eb59fcea311e89

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page