Skip to content

Commit

Permalink
Merge pull request #14 from IvanChernyshov/dev
Browse files Browse the repository at this point in the history
First stable version 1.0.0
  • Loading branch information
IvanChernyshov authored Sep 24, 2024
2 parents cc23525 + 80a7a60 commit 4c723c4
Show file tree
Hide file tree
Showing 34 changed files with 5,249 additions and 1,639 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: documentation

on: [push, pull_request, workflow_dispatch]

permissions:
contents: write

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install dependencies
run: |
sudo apt-get install pandoc
pip install -r ./docs/requirements.txt
- name: Sphinx build
run: |
cd ./docs/
make html
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html
force_orphan: true\
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# currently useful info, not for the package
misc/
nist_map/
# project-specific
update/data/*

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# NistChemPy: Python API for NIST Chemistry WebBook

[NIST Chemistry WebBook](https://webbook.nist.gov/) is a public database containing physico-chemical data which was carifully verified by specialists. However, the only way to retrieve information is to use browser, and no API is available. Moreover, search results are limited to 400 found compounds which is convenient for manual search of several compounds but unsuitable for chemoinformatics.
**NistChemPy** is an unofficial API for the [NIST Chemistry WebBook](https://webbook.nist.gov/).

NistChemPy is designed to solve this problem. It supports search by compound name, InChI/InChI-key, CAS RN, and chemical formula, and downloading key properties of retrieved compounds. Search object is designed in a way that it is easy to automate the search for all the necessary substances without exceeding the limit of 400 pieces.
This package not only automates the search and data extraction processes but also bypasses the WebBook's limitation of 400 compounds per search.

Currently, **NistChemPy** enables the extraction of basic compound properties as well as IR, THz, MS, and UV-Vis spectra.

Additional properties are available via URLs that link to their respective web pages, with potential support for direct extraction in future updates.

At the moment the code only supports IR, MS and UV/Vis spectra; support for other thermodynamic properties may be added later.

## Installation

Expand All @@ -14,6 +17,12 @@ Install NistChemPy using [pip](https://pypi.org/project/NistChemPy/):
pip install nistchempy
```

> [!WARNING]
> Please note that versions starting with 1.0.0 are not backward compatible with the older alpha versions due to significant changes in the code structure.
> You may need to update your nistchempy-based code or use the older nistchempy versions.

## How To

The main NistChemPy features including search and compound manipulations are shown in the [tutorial](https://github.com/EPiCs-group/NistChemPy/blob/main/tutorial.ipynb).
The primary features of NistChemPy, such as search capabilities and compound manipulations, are detailed in the [documentation](https://ivanchernyshov.github.io/NistChemPy/source/api.html).

20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = ./
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
75 changes: 75 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import sys, os
sys.path.insert(0, os.path.abspath('../'))


# -- Project information -----------------------------------------------------

project = 'NistChemPy'
copyright = '2023, Ivan Yu. Chernyshov'
author = 'Ivan Yu. Chernyshov'

# The full version, including alpha/beta/rc tags
release = '0.3.0'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'nbsphinx',
#'sphinx_gallery.load_style',
#'myst_parser'
]

# Add any paths that contain templates here, relative to this directory.
#templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', '**.ipynb_checkpoints']


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path = ['_static']

# -- Logo ----------------------------------------------------------

#html_theme_options = {
# 'logo_only': False,
#}
#html_logo = 'source/images/mace_favicon.png'
#html_favicon = 'source/images/mace_favicon.png'


# -- Options for exts ----------------------------------------------

# myst-nb
nb_execution_mode = "off"
#nb_execution_cache_path = "source/cache"

74 changes: 74 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
==========================================
Welcome to the NistChemPy's documentation!
==========================================

.. toctree::
:hidden:
:maxdepth: 2
:caption: Cookbook:

Basic Search <source/basic_search.ipynb>
Compound Properties <source/compound_properties.ipynb>
Advanced Search <source/advanced_search.ipynb>


.. toctree::
:hidden:
:maxdepth: 1
:caption: Package details:

Package API <source/api>
Changelog <source/changelog>


**NistChemPy** is an unofficial API for the `NIST Chemistry WebBook`_.
This package not only automates the search and data extraction processes but also bypasses the WebBook's limitation of 400 compounds per search.
Currently, NistChemPy enables the extraction of basic compound properties as well as IR, THz, MS, and UV-Vis spectra.
Additional properties are available via URLs that link to their respective web pages, with potential support for direct extraction in future updates.


Installation
============

**NistChemPy** can be installed as a `PyPI package`_:

.. code-block::
> pip install nistchempy
Requirements
============

1. Python 3.7+;

2. requests;

3. bs4;

4. pandas;

5. importlib_resources (for Python 3.7 and 3.8).


Useful links
============

1. `NIST Chemistry WebBook`_: webapp accessing the NIST Chemistry WebBook database.
2. `GitHub`_: GitHub page of the package.
3. `PyPI package`_: PyPI page of the package.
4. `Update tools`_: script for semi-automatic update of structural information of new NIST Chemistry WebBook compounds.


Indices and tables
==================

* :ref:`genindex`
* :ref:`search`



.. _NIST Chemistry WebBook: https://webbook.nist.gov/chemistry/
.. _GitHub: https://github.com/IvanChernyshov/NistChemPy
.. _PyPI package: https://pypi.org/project/nistchempy/
.. _Update tools: https://github.com/IvanChernyshov/NistChemPy/tree/main/update
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=./
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
13 changes: 13 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# nistchempy
requests
pandas
bs4
importlib_resources ; python_version < '3.9'

# docs
sphinx
sphinx_gallery
sphinx-rtd-theme
notebook
pandoc
nbsphinx
Loading

0 comments on commit 4c723c4

Please sign in to comment.