diff --git a/.gitignore b/.gitignore
index b7072359bdb..61cb89136f3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -230,6 +230,7 @@ docs/tutorial/figure.png
.history
*.orig
.tmp
+docs/sunpy-citations.bib
# Log files generated by 'vagrant up'
*.log
diff --git a/docs/conf.py b/docs/conf.py
index f1112278b1c..00c51736180 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -119,6 +119,7 @@
'sphinx_design',
'sphinx_copybutton',
'hoverxref.extension',
+ 'sphinxcontrib.bibtex',
]
# Set automodapi to generate files inside the generated directory
@@ -346,6 +347,27 @@
'is_development': not is_release,
}
+# -- Generate citation bibtex file -----------------------------------------------
+bibtex_bibfiles = [
+ 'sunpy-citations.bib',
+]
+bibtex_default_style = 'plain'
+if not os.path.exists(bibtex_bibfiles[0]):
+ bibcodes = [
+ "2020ApJ...890...68S",
+ "2015CS&D....8a4009S",
+ "2020JOSS....5.1832M",
+ ]
+ import ads
+ sunpy_papers = [list(ads.SearchQuery(bibcode=bc, fl=["citation"]))[0] for bc in bibcodes]
+ citation_bibcodes = []
+ for p in sunpy_papers:
+ citation_bibcodes += p.citation
+ citation_bibcodes = list(set(citation_bibcodes)) # remove duplicates
+ export = ads.ExportQuery(citation_bibcodes, format="bibtex")
+ bibtex_entries = export.execute()
+ with open(bibtex_bibfiles[0], mode="w") as f:
+ f.write(bibtex_entries)
def rstjinja(app, docname, source):
"""
diff --git a/setup.cfg b/setup.cfg
index 8492c35549e..cfa2186cf89 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -107,6 +107,7 @@ tests =
pytest>=6.0
docs =
astroquery
+ ads
hvpy>=1.0.1
jplephem
mplcairo
@@ -123,6 +124,7 @@ docs =
sphinxext-opengraph
sunpy-sphinx-theme
sphinx-hoverxref
+ sphinxcontrib-bibtex
dev =
%(all)s
%(tests)s
diff --git a/sunpy/CITATION.rst b/sunpy/CITATION.rst
index 430b9fc80c7..1eba7bf01b8 100644
--- a/sunpy/CITATION.rst
+++ b/sunpy/CITATION.rst
@@ -62,6 +62,17 @@ Please include the `Sunpy logo`_ on the title, conclusion slide, or about page.
For websites please link the image to `sunpy.org`_.
Other versions of the logo are available in the `sunpy-logo repository`_.
+Publications that Cite SunPy
+-----------------------
+
+The following publications use sunpy in their published work and have cited at least one of the papers listed above.
+This list is automatically generated based on citation information from `ADS `__.
+If you do not see your publication on this list, but believe it should be included, please let us know by `creating an issue on GitHub `__.
+
+.. bibliography:: ../docs/sunpy-citations.bib
+ :all:
+ :list: enumerated
+
.. _SunPy paper: https://doi.org/10.3847/1538-4357/ab4f7a
.. _Sunpy logo: https://github.com/sunpy/sunpy-logo/blob/master/sunpy_logo.svg
.. _sunpy.org: https://sunpy.org/