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

First stable version 1.0.0 #14

Merged
merged 33 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3b8d676
Restructures code and adds docs
IvanChernyshov Sep 15, 2024
d44c691
Refactors functionality distribution across modules
IvanChernyshov Sep 17, 2024
ed02a4b
Refactors search functionality
IvanChernyshov Sep 17, 2024
a31d66f
Refactors parsing and compound modules
IvanChernyshov Sep 19, 2024
162aaee
Adds first half of update script
IvanChernyshov Sep 20, 2024
413f39e
Adds spectra functionality to Compound
IvanChernyshov Sep 20, 2024
49be695
Fixes issue #13 : bug with non-numerical mass weight field
IvanChernyshov Sep 20, 2024
3ee25a5
Adds test dummies
IvanChernyshov Sep 21, 2024
a974497
Adds CLI version of script downloading compound list
IvanChernyshov Sep 21, 2024
0011c10
Adds CLI script downloading compound htmls
IvanChernyshov Sep 21, 2024
469a5e2
Adds cosmetic changes to update script
IvanChernyshov Sep 21, 2024
2312d6f
Updates docs and README
IvanChernyshov Sep 22, 2024
c8012f9
Adds compound tests & fixes found bugs
IvanChernyshov Sep 22, 2024
a3251de
Adds search tests
IvanChernyshov Sep 22, 2024
43684e1
Adds parsing tests
IvanChernyshov Sep 22, 2024
43d6f9c
Changes version to 1.0.0
IvanChernyshov Sep 22, 2024
a8ef1e7
Adds gh-pages docs recipe
IvanChernyshov Sep 22, 2024
d454029
Adds empty commit
IvanChernyshov Sep 22, 2024
b47772a
Changes gh-pages docs recipe
IvanChernyshov Sep 22, 2024
c633fb2
Fixes errors in gh-pages docs recipe
IvanChernyshov Sep 22, 2024
c5835a1
Fixes errors in gh-pages docs recipe # 2
IvanChernyshov Sep 22, 2024
7144d3a
Changes docs URL to gh-pages
IvanChernyshov Sep 22, 2024
503ac5c
Fixes some docstrings in update scripts
IvanChernyshov Sep 22, 2024
4fafe14
Adds update script checking compound initialization
IvanChernyshov Sep 22, 2024
9f3c732
Adds ultimate error handling to get_compound_htmls
IvanChernyshov Sep 23, 2024
f57d563
Adds update scripts processing errors (broken sitemap urls)
IvanChernyshov Sep 24, 2024
2a4c46f
Fixes name clash for search function and module; adds final update sc…
IvanChernyshov Sep 24, 2024
8dcd21d
Adds README to update scripts
IvanChernyshov Sep 24, 2024
e2bd688
Fixes update README typo
IvanChernyshov Sep 24, 2024
41e0ccd
Updates compound data file and related functionality
IvanChernyshov Sep 24, 2024
745b907
Adds backward compatibility warning to README
IvanChernyshov Sep 24, 2024
d7530e2
Updates docs
IvanChernyshov Sep 24, 2024
80a7a60
Changes dev branch to main in docs gh-pages recipe
IvanChernyshov Sep 24, 2024
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
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
Loading