Giter Club home page Giter Club logo

sphinx_gmt's Introduction

sphinx_gmt

Sphinx extensions for the Generic Mapping Tools

Documentation | Documentation (development version) | Source Code

Latest version on PyPI GitHub Actions status Compatible Python versions. Contributor Code of Conduct

About

This package provides a Sphinx extension for including GMT code and figures in your documentation. The extension defines the gmtplot directive that will execute the given code and insert the generated figure into the document (like the matplotlib plot directive).

Features

  • Supports any GMT versions
  • Works with both Bash and Python (PyGMT)
  • Include code inline or load from a script
  • Options to show/hide the code, insert captions, link to hidden code, etc.

Contacting Us

Most discussion happens on Github. Feel free to open an issue or comment on any open issue or pull request.

Contributing

Code of conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Contributing Guidelines

Please read our Contributing Guide to see how you can help and give feedback.

Imposter syndrome disclaimer

We want your help. No, really.

There may be a little voice inside your head that is telling you that you're not ready to be an open source contributor; that your skills aren't nearly good enough to contribute. What could you possibly offer?

We assure you that the little voice in your head is wrong.

Being a contributor doesn't just mean writing code. Equality important contributions include: writing or proof-reading documentation, suggesting or implementing tests, or even giving feedback about the project (including giving feedback about the contribution process). If you're coming to the project with fresh eyes, you might see the errors and assumptions that seasoned contributors have glossed over. If you can write any code at all, you can contribute code to open source. We are constantly trying out new skills, making mistakes, and learning from those mistakes. That's how we all improve and we are happy to help others learn.

This disclaimer was adapted from the MetPy project.

License

This is free software: you can redistribute it and/or modify it under the terms of the BSD 3-clause License. A copy of this license is provided in LICENSE.txt.

sphinx_gmt's People

Contributors

dependabot[bot] avatar leouieda avatar seisman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

simrit1

sphinx_gmt's Issues

Rename to extension to gmtplot

The name of the module gmtplot is different from the actual directive gmt-plot. It would probably be easier if everything was gmtplot instead so we could include links to the API docs when mentioning the directive using :mod: links.

Convert gmt-plot directive to a rst snippet instead of HTML

If I understand the codes correctly, this extension convert gmt-plot directive to an HTML snippet using a Jinja template.

I think it's better to convert gmt-plot directive to a rst snippet.

.. gmt-plot::
    :figure: example_02.png
    
    gmt begin map ps
    gmt ...
    gmt end

should be equivalent to:

.. figure:: images/xxx.png
   :options:

.. code-block::
    
   gmt begin map pdf
   gmt ...
   gmt end

This is exactly how the matplotlib's plot directive does (see https://github.com/matplotlib/matplotlib/blob/f93222a555160bf967f02dae42cce39a03384774/lib/matplotlib/sphinxext/plot_directive.py#L348).

Option to hide the code

Some plots the GMT docs are generated by code but the code isn't included. This should be an option for the extension and there should still be a link to the code even if the code is hidden in the rst (#4).

Include code from a script

Right now the extension only allows inline code. It would be good if the code can be loaded from a script.

The gmtplot directive no longer works for PyGMT output

Full code that generated the error

.. gmtplot::
    :language: python

    import pygmt
	  
	fig = pygmt.Figure()
	fig.coast(projection="G10/52/12c", region="g", frame="g", land="gray")
	fig.show()

Full error message

Exception occurred:
  File "/Users/seisman/OSS/gmt/sphinx_gmt/sphinx_gmt/gmtplot.py", line 262, in eval_python
    catch_display.output.data
AttributeError: 'NoneType' object has no attribute 'data'

The exceptions are most likely due to the redesign of the PyGMT's Figure.show() method in GenericMappingTools/pygmt#529. The main differences between the old and new Figure.show() method is that, the new Figure.show() method no longer returns the image.

Rename the project

pip search sphinx returns a list of packages related to sphinx. It seems most sphinx extensions have a name sphinx-xxx.

sphinx-advanced
Sphinx-Julia
sphinx-epytext
sphinx-tabs
sphinx-git
sphinx-sitemap
sphinx-boost
tachyonic-sphinx
sphinx-autorun
sphinx-graphiql
sphinx-csharp
sphinx-serve
sphinx-websequencediagrams
catkin-sphinx
sphinx-navtree
sphinx-nose
schemadisplay-sphinx
sphinx-server
sphinx-icontract
sphinx-refdoc
sphinx-confluence
zuul-sphinx
sphinx-jsonschema
sphinx-tsegsearch
sphinx-fortran
sphinx-scruffy
sphinx-prompt
sphinx-markdown
dragon-sphinx
sphinx-autoapi
sphinx-theme
sphinx-reload
anarchy-sphinx
tsuru-sphinx
sphinx-jsondomain
sphinx-a4doc
sphinx-JDLinker
sphinx-gallery
allanc-sphinx
sphinx-vlaamsecodex
sphinx-swagger
sphinx-elasticsearch
sphinx-revealjs
sphinx-astropy
sphinx-asciidoc
sphinx-testing
sphinx-click
sphinx-javalink
sphinx-tosca
sphinx-patchqueue
sphinx-pdj-theme
sphinx-simulink
sbo-sphinx
sphinx-lua
sphinx-nbexamples
sphinx-intl
django-sphinx
sphinx-argparse
sphinx-js
sphinx-view
sphinx-pyreverse
sphinx-issues
sphinxcontrib-getstart-sphinx
sphinx-stylo
sphinx-paramlinks
sphinx-links
sphinx-measurement
sphinx-dust
sphinx-hwt
sphinx-multibuild
sphinx-automodapi
pytest-sphinx
sphinx-autorun-ebs
jupyter-sphinx-theme
sphinx-autorun-ng
sphinx-glpi-theme
epfl-sphinx-theme
sphinx-guillotina-theme
sphinx-readable-theme
sphinx-rigado-extensions
sphinx-typlog-theme
hachibee-sphinx-theme
sphinx-bootstrap-theme
sphinx-quickstart-plus
zerovm-sphinx-theme
sphinx-rigado-theme
sphinx-compas-theme
sphinx-nameko-theme
dask-sphinx-theme
oe-sphinx-theme
sphinx-opnfv-theme
pytorch-sphinx-theme
sphinx-kml
travis-sphinx
sphinx-me
sphinx-catalystcloud-theme
sphinx-zon-theme
sphinx-ustack-theme
sphinx-gettext-helper
nengo-sphinx-theme

Maybe we can rename the project to sphinx-gmt.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.