PyElastica icon indicating copy to clipboard operation
PyElastica copied to clipboard

Type-hinting elastica

Open skim0119 opened this issue 1 year ago • 0 comments

#255

Policy

  • The entire purpose of type-hinting python library is to enhance the readability and to reduce ambiguity, not to increase the codebase.
    • Often if the function is writen to be generic, correctly hinting to satisfy mypy can easily become cumbersome task. (https://www.reddit.com/r/Python/comments/10zdidm/why_type_hinting_sucks/)
    • If that is the case, simply put Anyor # type: ignore and we can discuss further during review stage.

Common Types Aliases

Any alias not listed here are subject to change in the future. included in elastica/typing.py

  • SystemType : any generic object type for simulator (i.e. Rod, RigidBody, etc.)
  • SystemCollectionType : object collection (i.e. BaseSystemCollection or simulator that user defines)
  • OperatorType : any generic step used in timestepper
  • SteppersOperationstype : collection of OperatorType used to define specific timestepper

Note: Casting

  • For now
    • Use np.floating for any float typing
    • Use int for any integer typing

Tasks (blocked by:)

  • [x] Rod modules elastica/rod #341
  • [x] elastica/timestepper #372 @skim0119
    • [x] #372
    • [x] #373
  • [ ] elastica/memory_block @armantekinalp
  • [ ] elastica/rigid_body @sy-cui
  • [ ] elastica/mesh @Ali-7800
  • [ ] elastica/module @skim0119
    • [x] #379
    • [ ] #382
  • [ ] examples
  • [ ] ....

Useful Links

  • https://peps.python.org/pep-0544/

skim0119 avatar Apr 27 '24 12:04 skim0119