Modern scientific Python tooling

  • Challenges of academic code
  • Goals and principles in this talk
  • Code levels
  • Integrated development environments
    • Index
    • Installing VS Code
    • Install extensions
    • How are settings managed
    • Setting up VS Code
      • Appearance
      • Telemetry and user experiments
      • Spell checking
      • Python environment
    • Additional extensions
    • Keyboard shortcuts
  • Code formatting
    • Index
    • Level 1: Formatting defaults for all your projects
    • Level 2: Formatting project by project
    • Additional formatting/linting
    • Source code regions
  • Typing and modularizing code
    • Index
    • Root-finding solver based on Brent’s method
    • First step: making a Python script
    • Second step: script to module
    • Third step: breaking the code into functions
    • Fourth step: breaking the data into dicts
    • Fifth step: dataclasses
    • Fifth step without comments
    • Tricky parts of type annotations
  • Testing
  • Documenting published code
    • Index
    • Level 1: documenting the code using a paper + Jupyter notebooks
    • Level 2 (or 3?): documenting the code using Sphinx
    • Additions
  • Specifying dependencies and publishing code
    • Index
    • Python versions
    • Level 1: requirements.txt, “clone the repo” deployment
    • Level 2: Use Poetry and Python virtual environments
    • Python modules
    • Level 3: Manage compatibility guarantees
    • Tricky parts
  • References
Theme by the Executable Book Project

References

References¶

I use most of the tools outlined in:

  • the Hypermodern Python series

Great general resource:

  • https://realpython.com/

General typing resources:

  • https://github.com/typeddjango/awesome-python-typing

  • https://github.com/ramonhagenaars/nptyping

  • https://github.com/beartype/beartype

  • https://github.com/agronholm/typeguard/

  • https://github.com/Instagram/MonkeyType

Publishing using Poetry:

  • https://d39l7znklsxxzt.cloudfront.net/zh/blog/2021/01/19/publishing-a-proprietary-python-package-on-pypi-using-poetry/

  • https://towardsdatascience.com/packages-part-2-how-to-publish-test-your-package-on-pypi-with-poetry-9fc7295df1a5

Documentation:

  • https://realpython.com/documenting-python-code/

  • https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html

  • https://docs.pytest.org/en/6.2.x/doctest.html

  • https://pypi.org/project/sphinx-autodoc-typehints/

By Denis Rosset
© Copyright 2022, Denis Rosset.