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

pybmds #31

Merged
merged 17 commits into from
May 23, 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
32 changes: 14 additions & 18 deletions .github/workflows/python-test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Python test windows

on:
workflow_dispatch:
pull_request:
push:
branches:
- main
# pull_request:
# push:
# branches:
# - main

env:
PYTHON_LIBRARY_DIR: $Env:CONDA\Lib\site-packages
Expand All @@ -32,7 +32,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: set dependency direcory
- name: set dependency directory
run: echo "DEPENDENCY_DIR=$HOME\github-deps" >> $env:GITHUB_ENV
- name: restore github dependencies from cache
id: cache-github
Expand Down Expand Up @@ -73,22 +73,18 @@ jobs:
echo "EIGEN_DIR=${{ env.DEPENDENCY_DIR }}\eigen" >> $env:GITHUB_ENV
echo "NLOPT_DIR=${{ env.DEPENDENCY_DIR }}\nlopt\src\api;${{ env.DEPENDENCY_DIR }}\nlopt\build\Release;${{ env.DEPENDENCY_DIR }}\nlopt\build" >> $env:GITHUB_ENV
echo "GSL_DIR=${{ env.DEPENDENCY_DIR }}\gsl\build\Release;${{ env.DEPENDENCY_DIR }}\gsl\build" >> $env:GITHUB_ENV
- name: build bmds with cmake
shell: pwsh
run: |
mkdir build
cd build
cmake ..
cmake --build . --config Release
- name: Install dependencies
- name: Cache python build
uses: actions/cache@v4
with:
path: |
src/pybmds/bmdscore*
key: ${{ runner.os }}-${{ matrix.python-version }}-python-build
- name: Build package
run: |
python -m pip install -U pip wheel
python -m pip install -r requirements_dev.txt
- name: Build pybmds
run: |
python setup.py develop
python -m pip install -e ".[dev,docs]"
stubgen -p pybmds.bmdscore -o src
ruff format src\pybmds\bmdscore.pyi
ruff format src/pybmds/bmdscore.pyi
python setup.py bdist_wheel
- uses: actions/upload-artifact@v4
with:
Expand Down
46 changes: 32 additions & 14 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: Python test linux
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
# push:
# branches:
# - main

jobs:
test:
Expand All @@ -22,24 +22,42 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install dependencies
- name: Cache build
uses: actions/cache@v4
with:
path: |
./.egg-info/
./pybmds.egg-info/
./src/.egg-info/
./src/pybmds.egg-info/
./src/pybmds/bmdscore*
key: pybmds2-${{ runner.os }}-${{ matrix.python-version }}
- name: Install dependencies and build pybmds
run: |
source ./tools/linux_ci.sh
python -m pip install -U pip wheel
python -m pip install -r requirements_dev.txt
python -m pip install -e ".[dev,docs]"
stubgen -p pybmds.bmdscore -o src
ruff format src/pybmds/bmdscore.pyi
- name: Check linting
run: |
ls -laht
ls src -laht
make lint
- name: Compile bmdscore and build pybmds
run: |
source ./tools/linux_ci.sh
make build
- name: Test with pytest
run: |
make test
- name: Build package
coverage run -m pytest
echo "# Python coverage report" >> $GITHUB_STEP_SUMMARY
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
- name: Build documentation
run: |
source ./tools/linux_ci.sh
make dist
make docs
- uses: actions/upload-artifact@v4
with:
path: ./dist/*.whl
path: |
./docs/build/html
./dist/*.whl
./.egg-info/
./pybmds.egg-info/
./src/.egg-info/
./src/pybmds.egg-info/
14 changes: 4 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
*.html
*.docx
*.o
# *.tar.gz
*.a
*.la
*.so
*.Rproj.user
*.tgz
.Rproj.user
.DS_Store
*.o
*.so
.Rhistory
build/

create_dll_compile.bash

# python
Expand All @@ -21,11 +13,13 @@ create_dll_compile.bash
.ipynb_checkpoints/
.mypy_cache/
.pytest_cache/
.ruff_cache/
.vscode/
build/
dist/
htmlcov/
venv/
*.log
*.py[cod]
.coverage
.coverage/
.env
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
recursive-include * *.pyi
recursive-include * *.pyi *.json *.csv *.docx
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: clean lint format test coverage build develop
.PHONY: clean lint format test coverage build dist docs docs-clean
.DEFAULT_GOAL := help

define PRINT_HELP_PYSCRIPT
Expand Down Expand Up @@ -40,3 +40,10 @@ build: ## Rebuild in development environment
dist: ## Build wheel package for distribution
@python setup.py bdist_wheel
@ls -lh dist

docs: ## Build documentation {html}
sphinx-build -W -b html docs/source docs/build/html
@echo "HTML: \"docs/build/html/index.html\""

docs-clean: ## Clean documentation
@$(MAKE) -C docs clean
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 = source
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)
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=source
set BUILDDIR=build

%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.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

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

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

:end
popd
7 changes: 7 additions & 0 deletions docs/source/_static/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
code {
font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
}

.bd-page-width {
max-width: 100%;
}
Binary file added docs/source/_static/img/diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/img/epa_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/img/logic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
project = "pybmds"
copyright = "Public Domain"
author = "U.S. EPA"

extensions = ["myst_nb"]
souce_suffix = {
".md": "markdown",
".rst": "restructuredtext",
}
templates_path = ["_templates"]

exclude_patterns = []

# HTML settings
html_theme = "pydata_sphinx_theme"
html_static_path = ["_static"]
html_css_files = ["css/style.css"]
html_sidebars = {"**": ["globaltoc.html"]}
html_theme_options = {
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/USEPA/bmds-private",
"icon": "fa-brands fa-github",
"type": "fontawesome",
},
{
"name": "U.S. Environmental Protection Agency",
"url": "https://epa.gov/bmds",
"icon": "_static/img/epa_logo.png",
"type": "local",
},
],
"use_edit_page_button": False,
"show_toc_level": 2,
"navbar_end": [
"theme-switcher.html",
"navbar-icon-links.html",
],
}

# Latex / PDF settings
latex_elements = {
"printindex": "",
"sphinxsetup": "hmargin={0.9in,0.9in}, vmargin={0.9in,0.9in}, marginpar=1.0in",
"papersize": "letterpaper",
"pointsize": "10pt",
"figure_align": "htbp",
}
23 changes: 23 additions & 0 deletions docs/source/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
html_theme.sidebar_secondary.remove: true
---

# pybmds

A Python package for executing the U.S. EPA Benchmark Dose Modeling Software (BMDS).

## User's Guide

```{toctree}
:maxdepth: 2

reference/index
```

## Recipes

```{toctree}
:maxdepth: 2

recipes/index
```
Loading