Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add copy button to readthedocs #211

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/catalogs/arguments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ There are several stages to the pipeline execution, and you can expect progress
reporting to look like the following:

.. code-block::
:class: no-copybutton

Mapping : 100%|██████████| 72/72 [58:55:18<00:00, 2946.09s/it]
Binning : 100%|██████████| 1/1 [01:15<00:00, 75.16s/it]
Expand Down
27 changes: 21 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,23 @@
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ["sphinx.ext.mathjax", "sphinx.ext.napoleon", "sphinx.ext.viewcode"]

extensions.append("autoapi.extension")
extensions.append("nbsphinx")

templates_path = []
exclude_patterns = ["_build", "**.ipynb_checkpoints"]

# This assumes that sphinx-build is called from the root directory
master_doc = "index"
html_theme = "sphinx_rtd_theme"

extensions = [
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx_copybutton",
"autoapi.extension",
"nbsphinx",
]

# -- autoapi configuration ----------------------------------------
# Remove 'view source code' from top of page (for html, not python)
html_show_sourcelink = False
# Remove namespaces from class/method signatures
Expand All @@ -46,4 +53,12 @@
autoapi_member_order = "bysource"

napoleon_google_docstring = True
html_theme = "sphinx_rtd_theme"

# -- sphinx-copybutton configuration ----------------------------------------
## sets up the expected prompt text from console blocks, and excludes it from
## the text that goes into the clipboard.
copybutton_exclude = ".linenos, .gp"
copybutton_prompt_text = ">> "

## lets us suppress the copy button on select code blocks.
copybutton_selector = "div:not(.no-copybutton) > div.highlight > pre"
30 changes: 15 additions & 15 deletions docs/guide/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ virtual environment. LINCC-Frameworks engineers primarily use `conda` to manage
environments. If you have conda installed locally, you can run the following to
create and activate a new environment.

.. code-block:: bash
.. code-block:: console

>> conda create env -n <env_name> python=3.10
>> conda activate <env_name>
Expand All @@ -42,7 +42,7 @@ create and activate a new environment.
Once you have created a new environment, you can install this project for local
development using the following commands:

.. code-block:: bash
.. code-block:: console

>> pip install -e .'[dev]'
>> pre-commit install
Expand Down Expand Up @@ -70,19 +70,19 @@ Notes:
`do not yet exist <https://healpy.readthedocs.io/en/latest/install.html#binary-installation-with-pip-recommended-for-most-other-python-users>`_,
so it's recommended to install via conda before proceeding to hipscat-import.

.. code-block:: bash
.. code-block:: console

$ conda config --add channels conda-forge
$ conda install healpy
$ git clone https://github.com/astronomy-commons/hipscat-import
$ cd hipscat-import
$ pip install -e .
>> conda config --add channels conda-forge
>> conda install healpy
>> git clone https://github.com/astronomy-commons/hipscat-import
>> cd hipscat-import
>> pip install -e .

When installing dev dependencies, make sure to include the single quotes.

.. code-block:: bash
.. code-block:: console

$ pip install -e '.[dev]'
>> pip install -e '.[dev]'

Testing
-------------------------------------------------------------------------------
Expand All @@ -97,17 +97,17 @@ paths. These are defined in ``conftest.py`` files. They're powerful and flexible
Please add or update unit tests for all changes made to the codebase. You can run
unit tests locally simply with:

.. code-block:: bash
.. code-block:: console

pytest
>> pytest

If you're making changes to the sphinx documentation (anything under ``docs``),
you can build the documentation locally with a command like:

.. code-block:: bash
.. code-block:: console

cd docs
make html
>> cd docs
>> make html

Create your PR
-------------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Installation
We recommend installing in a virtual environment, like venv or conda. You may
need to install or upgrade versions of dependencies to work with hipscat-import.

.. code-block:: bash
.. code-block:: console

pip install hipscat-import

Expand All @@ -21,10 +21,10 @@ need to install or upgrade versions of dependencies to work with hipscat-import.
`do not yet exist <https://healpy.readthedocs.io/en/latest/install.html#binary-installation-with-pip-recommended-for-most-other-python-users>`_,
so it's recommended to install via conda before proceeding to hipscat-import.

.. code-block:: bash
.. code-block:: console

$ conda config --append channels conda-forge
$ conda install healpy
>> conda config --append channels conda-forge
>> conda install healpy

Setting up a pipeline
-------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ nbsphinx
ipython
jupytext
jupyter
sphinx-copybutton
Loading