A Python interface for the EPA CompTox Dashboard Chemical API.
PyCompTox provides a simple and intuitive Python interface to interact with the EPA's CompTox Dashboard Chemical, Bioactivity, Exposure, and Hazard API. This package allows you to search for chemicals by name, identifiers (DTXSID, DTXCID, CAS numbers), molecular formulas, mass ranges, and much more.
pip install comptox-python[all]install the latest released version.
Note: do not install the package by which is a different package with the old comptox API.pip install pycomptox
For the latest development version:
# Clone the repository
git clone https://github.com/USEtox/PyCompTox.git
cd PyCompTox
# Install the package
pip install -e .
# Or with development tools
pip install -e ".[dev]"
# Or with notebook support
pip install -e ".[notebook]"PyCompTox now uses modern Python packaging with pyproject.toml. See INSTALLATION.md for detailed installation options.
- dev: Development tools (pytest, black, mypy, flake8)
- notebook: Jupyter notebook support with pandas and matplotlib
- all: All optional dependencies
pip install -e ".[all]"To use the CompTox Dashboard API, you need an API key. You can obtain one from the CompTox Dashboard API documentation.
Save your API key once and it will be automatically loaded for all future sessions:
pycomptox-setup set YOUR_API_KEYThe API key is stored securely in your user's application data directory:
- Windows:
%APPDATA%\PyCompTox\api_key.txt - macOS/Linux:
~/.pycomptox/api_key.txt
# Test if your API key works
pycomptox-setup test
# Show your saved API key (masked)
pycomptox-setup show
# Delete your saved API key
pycomptox-setup deleteYou can also provide the API key in other ways:
- Environment Variable: Set
COMPTOX_API_KEYenvironment variable - Direct Parameter: Pass
api_keyparameter when creating the client
Your API key is stored securely in your user's application data directory:
- Windows:
C:\Users\<username>\AppData\Roaming\PyCompTox\api_key.txt - macOS/Linux:
~/.pycomptox/api_key.txt
The file is created with user-only read permissions on Unix-like systems.
For detailed API documentation, visit:
Chemical, Bioactivity, Exposure, and Hazard.
See the LICENSE file for details.
This package is not officially affiliated with or endorsed by the U.S. Environmental Protection Agency (EPA). It is an independent implementation of a Python client for the publicly available CompTox Dashboard API.
You can find the official Python client from the official USEPA GitHub page.
Also, note that there is another package called pycomptox that is registered on PyPi nder the same name, which is why this package is installed by pip install comptox-python.