Skip to main content

Literal Enum

Project description

indoc

Developer Guide

Setup

# create conda environment
$ mamba env create -f env.yml

# update conda environment
$ mamba env update -n indoc --file env.yml

Install

pip install -e .

# install from pypi
pip install indoc

nbdev

# activate conda environment
$ conda activate indoc

# make sure the indoc package is installed in development mode
$ pip install -e .

# make changes under nbs/ directory
# ...

# compile to have changes apply to the indoc 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/indoc.git

or from conda

$ conda install -c dsm-72 indoc

or from pypi

$ pip install indoc

Documentation

Documentation can be found hosted on GitHub repository pages. Additionally you can find package manager specific guidelines on conda and pypi respectively.

indoc decorator

define (base / mixin) class with a docstring we want to pass to a subclass

@dataclass
class Mix:
    r'''
    A Mixin class

    Attributes
    ----------
    a : str
        a string
    i : int, optional
        an int
    b : bool, optional
        a bool

    Methods
    -------
    is_b(self) -> bool
        checks if b is True    
    '''
    a: str
    _: KW_ONLY
    i: int = 0
    b: bool = False

    @property
    def prop(self):
        return self.a

    @abstractmethod
    def is_b(self) -> bool:
        return self.b

A subclass we want to have Mix’s docstring

foodoc = '''
    A Foo class
    
    Attributes
    ----------
    q : bool

    Methods
    -------
    is_q(self) -> bool
        checks if q is True
    '''    

@indoc
@dataclass
class Foo(Mix):
    __doc__ = foodoc
    q: bool
    def is_q(self) -> bool:
        return self.q

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

indoc-0.0.4.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

indoc-0.0.4-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file indoc-0.0.4.tar.gz.

File metadata

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

File hashes

Hashes for indoc-0.0.4.tar.gz
Algorithm Hash digest
SHA256 e0500b466d1b78339142bb1d0b92d7a4cda6be0809ecd56940a612c619f8db05
MD5 314aba520212b836cc0d322128d43be2
BLAKE2b-256 f1886a3158d416bfb3592f2f54b7770710e11276b85c00fd30b1bcd256d4c7c1

See more details on using hashes here.

File details

Details for the file indoc-0.0.4-py3-none-any.whl.

File metadata

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

File hashes

Hashes for indoc-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2d47938cdf2ec66bb599c53e373be3ec7124067cf2d72636e830c1db29a25a76
MD5 1c7c7ae28d14ec87a2d3ca3047b5f3a0
BLAKE2b-256 0545f103dea4965c96391f5c872440fbae9601f772f1cbb4a923061efb176871

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