Skip to content

Commit

Permalink
Fix documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuald committed Feb 29, 2020
1 parent 689d81d commit 0fe7ba6
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 165 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ pyfrc.egg-info
pyfrc/version.py

.settings
docs/_build
docs/_sidebar.rst.inc

.deploy_cfg

Expand Down
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/_build
/_sidebar.rst.inc
/_sidebar.toml
40 changes: 19 additions & 21 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

#
# Imports
#

import sys
import os
from os.path import abspath, dirname

from os.path import abspath, join, dirname

# Insert module path here
sys.path.insert(0, abspath(dirname(__file__)))
sys.path.insert(0, abspath(join(dirname(__file__), "..", "lib")))

from unittest import mock

sys.modules["wpilib"] = mock.MagicMock()
sys.modules["hal_impl"] = mock.MagicMock()
sys.modules["hal_impl.data"] = mock.MagicMock()
sys.modules["hal_impl.sim_hooks"] = mock.MagicMock()
sys.modules["hal_impl.types"] = mock.MagicMock()
sys.modules["hal_impl.mode_helpers"] = mock.MagicMock()

sys.modules["tkinter"] = mock.MagicMock()

# Project must be built+installed to generate docs
import pyfrc
import pyfrc.config

pyfrc.config.config_obj["pyfrc"] = dict(game_specific_messages=[])
Expand Down Expand Up @@ -56,12 +46,16 @@

# General information about the project.
project = "pyfrc"
copyright = "2014-2017, RobotPy development team"
copyright = "2014-2020, RobotPy development team"

autoclass_content = "both"

intersphinx_mapping = {
"wpilib": ("http://robotpy-wpilib.readthedocs.io/en/%s/" % rtd_version, None)
"robotpy": ("https://robotpy.readthedocs.io/en/%s/" % rtd_version, None),
"wpilib": (
"https://robotpy.readthedocs.io/projects/wpilib/en/%s/" % rtd_version,
None,
),
}

# The version info for the project you're documenting, acts as replacement for
Expand Down Expand Up @@ -135,9 +129,13 @@

# -- Custom Document processing ----------------------------------------------

import gensidebar
from robotpy_sphinx.sidebar import generate_sidebar

gensidebar.generate_sidebar(globals(), "pyfrc")
generate_sidebar(
globals(),
"pyfrc",
"https://raw.githubusercontent.com/robotpy/docs-sidebar/master/sidebar.toml",
)

import sphinx.addnodes
import docutils.nodes
Expand Down
17 changes: 1 addition & 16 deletions docs/custom.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,4 @@
Custom Test Support
===================

.. contents::

pytest fixtures
---------------

.. automodule:: pyfrc.test_support.pytest_plugin
:members:

Controlling the robot's state
-----------------------------

.. automodule:: pyfrc.test_support.controller
:members:

.. automodule:: pyfrc.test_support.fake_time
:members:
Test support has not yet been upgraded for 2020.
97 changes: 0 additions & 97 deletions docs/gensidebar.py

This file was deleted.

1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This library contains a few primary parts:
* A built-in uploader that will upload your robot code to the robot
* Integration with the py.test testing tool to allow you to easily write unit
tests for your robot code.
* Simulation and 'robot physics' support

.. include:: _sidebar.rst.inc

Expand Down
24 changes: 0 additions & 24 deletions docs/physics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,6 @@ Unit conversions
.. automodule:: pyfrc.physics.units
:members:

Custom labels
-------------

If you write data to the 'custom' key of the ``hal_data`` dictionary, the
data will be shown on the pyfrc simulation UI. The key will be the label for
the data, and the value will be rendered as text inside the box::

# first time you set the data
hal_data.setdefault('custom', {})['My Label'] = '---'
# All other times
hal_data['custom']['My Label'] = 1


.. versionadded:: 2018.3.0

Custom drawing
--------------

.. autofunction:: pyfrc.sim.get_user_renderer

.. autoclass:: pyfrc.sim.field.user_renderer.UserRenderer
:members:

Camera 'simulator'
------------------

Expand Down
8 changes: 6 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
sphinx-autodoc-typehints
-r ../requirements.txt
# This file is intended for use on readthedocs
--find-links https://www.tortall.net/~robotpy/wheels/2020/linux_x86_64
sphinx
sphinx-rtd-theme
robotpy-sphinx-plugin
-e .
3 changes: 3 additions & 0 deletions docs/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
Tests that come with pyfrc
==========================

.. note:: pyfrc's testing functionality has not yet been updated
to work with RobotPy 2020

pyfrc comes with testing functions that can be used to test basic
functionality of just about any robot, including running through a
simulated practice match.
Expand Down
2 changes: 1 addition & 1 deletion pyfrc/physics/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

logger = logging.getLogger("pyfrc.physics")

from hal_impl.data import hal_data
# from hal_impl.data import hal_data


class PhysicsInitException(Exception):
Expand Down
3 changes: 1 addition & 2 deletions pyfrc/physics/motion.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from hal_impl.data import hal_data

import hal
import typing


Expand Down

0 comments on commit 0fe7ba6

Please sign in to comment.