rayoptics is a Python geometrical optics and image forming optics library. It provides a geometric ray tracing foundation for the analysis of image forming and coherent optical systems. A number of standard geometrical analysis options such as transverse ray and wavefront aberration analysis are provided on this base. Paraxial layout of optical systems is also supported by y-ybar diagrams and graphical editing of paraxial rays in lens layout views. Import of Zemax .zmx and CODEV .seq files is supported. RayOptics can be used in Python scripts, the Python and IPython shells, the Jupyter notebook, and a Qt-based graphical user interface application.