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

Provide a mechanism to download data files for an example #67

Merged
merged 3 commits into from
Aug 14, 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
13 changes: 10 additions & 3 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,20 @@ following files inside:
- as many Python files as you want, each one will be converted to a separate
HTML page.

Keep in mind that sphinx-gallery will make it easy to download a Python file and
the notebook generated from it, but it won't give direct access to additional
files. If your example needs such data files, there are a few options available:

- (preferred) have the data file stored in a publicly accessible location, e.g.
a Zotero record, and download the data file from the script
- if the data files are small (few 10s of Kb) you may also include them in a
``data/`` folder within the example folder. A zip file will be generated that
can be downloaded from the example page.

.. _sphinx-gallery: https://sphinx-gallery.github.io/
.. _RestructuredText: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
.. _conda: https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#create-env-file-manually

Finally, you'll need to add your example to the list so it is automatically
build on CI. The list is in the ``.github/workflows/docs.yml`` file, near the
``example-name:`` section.

Converting a Jupyter notebook to a sphinx-gallery compatible Python script
--------------------------------------------------------------------------
Expand Down
283 changes: 283 additions & 0 deletions docs/_static/cookbook-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions docs/src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
"Atomistic cookbook team"
)

htmlhelp_basename = "Atomistic cookbook"
html_theme = "furo"


intersphinx_mapping = {
"ase": ("https://wiki.fysik.dtu.dk/ase/", None),
"metatensor": ("https://lab-cosmo.github.io/metatensor/latest/", None),
Expand All @@ -35,11 +31,14 @@
}

html_js_files = [
(
( # plausible.io tracking
"https://plausible.io/js/script.js",
{"data-domain": "lab-cosmo.github.io/atomistic-cookbook", "defer": "defer"},
),
]

htmlhelp_basename = "Atomistic cookbook"
html_theme = "furo"
html_static_path = [os.path.join("..", "_static")]
html_favicon = "../_static/cookbook-icon.png"
html_logo = "../_static/cookbook-icon.svg"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ bond_style class2
angle_style harmonic
kspace_style pppm/tip4p 0.0001

read_data water_32_data.lmp
read_data data/water_32_data.lmp
pair_coeff * * 0 0
pair_coeff 1 1 0.000295147 5.96946

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ffsocket>
<system>
<initialize nbeads='8'>
<file mode='pdb'> water_32.pdb </file>
<file mode='pdb'> data/water_32.pdb </file>
<velocities mode='thermal' units='kelvin'> 298 </velocities>
</initialize>
<forces>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ffsocket>
<system>
<initialize nbeads='8'>
<file mode='pdb' units='angstrom'> water_32.pdb </file>
<file mode='pdb' units='angstrom'> data/water_32.pdb </file>
<velocities mode='thermal' units='kelvin'> 298 </velocities>
</initialize>
<forces>
Expand Down
Loading