Skip to content

Commit

Permalink
Merge branch 'feature/module-utilities' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
wpk committed May 3, 2023
2 parents 7888b54 + beac8d0 commit a63787f
Show file tree
Hide file tree
Showing 46 changed files with 579 additions and 2,267 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/wpk-nist-gov/cookiecutter-pypackage.git",
"commit": "fcf4e71d8ed80af9445bb1d8fed755782f699d05",
"commit": "cb20a32f67dadb4142be54898a87de1efdce6bd6",
"checkout": "feature/markdown",
"skip": [
"src/thermoextrap/__init__.py",
Expand Down
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ insert_final_newline = false
[Makefile]
indent_style = tab

[*.mk]
indent_style = tab

[*.{yaml,yml}]
indent_size = 2

Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ env/
build/
develop-eggs/
dist/
dist-conda/
downloads/
eggs/
.eggs/
Expand Down Expand Up @@ -109,4 +108,5 @@ pyrightconfig.json
.autoenv_leave.zsh
/docs/**/generated/
/monkeytype.sqlite3
/dist-conda/
/dist-conda/*
!/dist-conda/Makefile
12 changes: 8 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,19 +293,19 @@ We use [tox] to isolate the documentation build. Useful commands are as follows.
- Build the docs:

```bash
tox -e docs-build
tox -e docs -- build
```

- Spellcheck the docs:

```bash
tox -e docs-spelling
tox -e docs -- spelling
```

- Create a release of the docs:

```bash
tox -e docs-release
tox -e docs -- release
```

If you make any changes to `docs/examples`, you should run:
Expand All @@ -320,6 +320,10 @@ We use [tox] to isolate the documentation build. Useful commands are as follows.

- Live documentation updates using

```bash
make docs-livehtml
```

## Using tox

The package is setup to use tox to test, build and release pip and conda
Expand All @@ -339,7 +343,7 @@ make docs-build
To release the documentation use:

```bash
make docs-release posargs='-m "commit message" -r origin -p'
make docs-release release_args='-m "commit message" -r origin -p'
```

Where posargs is are passed to ghp-import. Note that the branch created is
Expand Down
96 changes: 54 additions & 42 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ version: version-scm version-import
# Environment files
################################################################################
ENVIRONMENTS = $(addsuffix .yaml,$(addprefix environment/, dev docs test))
PRETTIER = pre-commit run prettier --files
PRETTIER = bash scripts/run-prettier.sh

environment/%.yaml: environment.yaml environment/%-extras.yaml ## create combined environment/{dev,docs,test}.yaml
conda-merge $^ > $@
-$(PRETTIER) $@ &> /dev/null || true
$(PRETTIER) $@

environment/dev.yaml: ## development environment yaml file
environment/test.yaml: ## testing environment yaml file
Expand All @@ -157,7 +157,7 @@ enviornment/docs.yaml: ## docs environment yaml file
environment/lint.yaml: environment.yaml $(addsuffix .yaml, $(addprefix environment/, test-extras lint-extras)) ## mypy environment
echo $^
conda-merge $^ > $@
-$(PRETTIER) $@ &> /dev/null || true
$(PRETTIER) $@

ENVIRONMENTS += environment/lint.yaml

Expand Down Expand Up @@ -188,9 +188,9 @@ mamba-dev-update: environment/dev.yaml ## update development environment
################################################################################
# TOX
###############################################################################
tox_posargs?=-v
tox_args?=-v
version?=
TOX=CONDA_EXE=mamba SETUPTOOLS_SCM_PRETEND_VERSION=$(version) tox $(tox_posargs)
TOX=CONDA_EXE=mamba SETUPTOOLS_SCM_PRETEND_VERSION=$(version) tox $(tox_args)

.PHONY: tox-ipykernel-display-name
tox-ipykernel-display-name: ## Update display-name for any tox env with ipykernel
Expand All @@ -203,83 +203,95 @@ dev-env: environment/dev.yaml ## create development environment using tox

## testing
.PHONY: test-all
test-all: environment/test.yaml ## run tests on every Python version with tox
test-all: environment/test.yaml ## run tests on every Python version with tox. can pass posargs=...
$(TOX) -- $(posargs)


## docs
.PHONY: docs-examples-symlink
docs-examples-symlink: ## create symlinks to notebooks from /examples/ to /docs/examples.
bash ./scripts/docs-examples-symlinks.sh


.PHONY: docs-build docs-release docs-clean docs-spelling docs-nist-pages docs-open docs-live docs-clean-build docs-linkcheck
posargs=
.PHONY: docs-build docs-release docs-clean docs-command
docs-build: ## build docs in isolation
$(TOX) -e $@ -- $(posargs)
$(TOX) -e docs -- build
docs-clean: ## clean docs
rm -rf docs/_build/*
rm -rf docs/generated/*
rm -rf docs/reference/generated/*
docs-clean-build: docs-clean docs-build ## clean and build
docs-release: ## release docs. use posargs=... to override stuff
$(TOX) -e $@ -- $(posargs)
docs-release: ## release docs. use release_args=... to override stuff
$(TOX) -e docs -- release
docs-command: ## run command with command=...
$(TOX) -e docs -- command

.PHONY: .docs-spelling docs-nist-pages docs-open docs-livehtml docs-clean-build docs-linkcheck
docs-spelling: ## run spell check with sphinx
$(TOX) -e $@ -- $(posargs)
docs-nist-pages: ## do both build and releas
$(TOX) -e $@ -- $(posargs)
docs-live: ## use autobuild for docs
$(TOX) -e $@ -- $(posargs)
$(TOX) -e docs -- spelling
docs-livehtml: ## use autobuild for docs
$(TOX) -e docs -- livehtml
docs-open: ## open the build
$(BROWSER) docs/_build/html/index.html
docs-linkcheck: ## check links
$(TOX) -e docs-build -- linkcheck
$(TOX) -e docs -- linkcheck

docs-build docs-release docs-command docs-clean docs-livehtml docs-linkcheck: environment/docs.yaml

docs-build docs-release docs-clean docs-spelling docs-nist-pages docs-live: environment/docs.yaml
## linting
.PHONY: lint-mypy lint-pyright lint-pytype lint-all lint-command
lint-mypy: ## run mypy mypy_args=...
$(TOX) -e lint -- mypy
lint-pyright: ## run pyright pyright_args=...
$(TOX) -e lint -- pyright
lint-pytype: ## run pytype pytype_args=...
$(TOX) -e lint -- pytype
lint-all:
$(TOX) -e lint -- all
lint-command:
$(TOX) -e lint -- command

lint-mypy lint-pyright lint-pytype lint-all lint-command: environment/lint.yaml

## distribution
.PHONY: dist-pypi-build dist-pypi-testrelease dist-pypi-release dist-conda-recipe dist-conda-build
.PHONY: dist-pypi-build dist-pypi-testrelease dist-pypi-release dist-pypi-command

posargs=
dist-pypi-build: ## build dist, can pass posargs=... and tox_posargs=...
$(TOX) -e $@ -- $(posargs)
dist-pypi-testrelease: ## test release on testpypi. can pass posargs=... and tox_posargs=...
$(TOX) -e $@ -- $(posargs)
dist-pypi-build: ## build dist
$(TOX) -e dist-pypi -- build
dist-pypi-testrelease: ## test release on testpypi
$(TOX) -e dist-pypi -- testrelease
dist-pypi-release: ## release to pypi, can pass posargs=...
$(TOX) -e $@ -- $(posargs)
dist-pypi-build dist-pypi-testrelease dist-pypi-release: environment/dist-pypi.yaml
$(TOX) -e dist-pypi -- release
dist-pypi-command: ## run command with command=...
$(TOX) -e dist-pypi -- command
dist-pypi-build dist-pypi-testrelease dist-pypi-release dist-pypi-command: environment/dist-pypi.yaml

.PHONY: dist-conda-recipe dist-conda-build dist-conda-command
dist-conda-recipe: ## build conda recipe can pass posargs=...
$(TOX) -e $@ -- $(posargs)
$(TOX) -e dist-conda -- recipe
dist-conda-build: ## build conda recipe can pass posargs=...
$(TOX) -e $@ -- $(pasargs)
dist-conda-build dist-conda-recipe: environment/dist-conda.yaml
$(TOX) -e dist-conda -- build
dist-conda-command: ## run command with command=...
$(TOX) -e dist-conda -- command
dist-conda-build dist-conda-recipe dist-conda-command: environment/dist-conda.yaml


## test distribution
.PHONY: test-dist-pypi-remote test-dist-conda-remote test-dist-pypi-local test-dist-conda-local
.PHONY: testdist-pypi-remote testdist-conda-remote testdist-pypi-local testdist-conda-local

py?=310
test-dist-pypi-remote: ## test pypi install, can run as `make test-dist-pypi-remote py=39` to run test-dist-pypi-local-py39
testdist-pypi-remote: ## testdist-pypi-remote: ## test pypi install, can run as `make test-dist-pypi-remote py=39` to run test-dist-pypi-local-py39. Can specify version setting, eg, TEST_VERSION='==0.1.0'. Note that the the format should be '=={version}'.
$(TOX) -e $@-py$(py) -- $(posargs)

test-dist-conda-remote: ## test conda install, can run as `make test-dist-conda-remote py=39` to run test-dist-conda-local-py39
testdist-conda-remote: ## test conda install, can run as `make test-dist-conda-remote py=39` to run test-dist-conda-local-py39
$(TOX) -e $@-py$(py) -- $(poasargs)

test-dist-pypi-local: ## test pypi install, can run as `make test-dist-pypi-local py=39` to run test-dist-pypi-local-py39
testdist-pypi-local: ## test pypi install, can run as `make test-dist-pypi-local py=39` to run test-dist-pypi-local-py39
$(TOX) -e $@-py$(py) -- $(posargs)

test-dist-conda-local: ## test conda install, can run as `make test-dist-conda-local py=39` to run test-dist-conda-local-py39
testdist-conda-local: ## test conda install, can run as `make test-dist-conda-local py=39` to run test-dist-conda-local-py39
$(TOX) -e $@-py$(py) -- $(poasargs)


test-dist-pypi: environment/test.

testdist-pypi-remote testdist-conda-remote testdist-pypi-local testdist-conda-local: environment/test.yaml

## list all options
.PHONY: tox-list

tox-list:
$(TOX) -a

Expand Down
46 changes: 46 additions & 0 deletions changelog.d/20230503_133701_william.krekelberg_module_utilities.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!-- markdownlint-disable MD041 -->
<!--
A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Removed
- A bullet item for the Removed category.
-->
<!--
### Added
- A bullet item for the Added category.
-->

### Changed

- Moved `modesl, data, idealgas` from `thermoextrap.core` to `thermoextrap`.
These were imported at top level anyway. This fixes issues with doing things
like `from thermoextrap.data import ...`, etc.
- Moved `core._docstrings_` to `docstrings`.
- Now using `cmomy.docstrings` instead of repeating them here.

<!--
### Deprecated
- A bullet item for the Deprecated category.
-->
<!--
### Fixed
- A bullet item for the Fixed category.
-->
<!--
### Security
- A bullet item for the Security category.
-->
28 changes: 17 additions & 11 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,35 @@ ALLSPHINXAUTOOPTS = $(ALLSPHINXOPTS) \
--ignore "*/.ipynb_checkpoints/*"



.PHONY: help Makefile clean-all build livehtml showlinks release command
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(ALLSPHINXOPTS) $(O)


allclean: clean
rm -rf $(BUILDDIR)/*
rm -rf generated/*
rm -rf reference/generated/*

.PHONY: help Makefile allclean

# 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)" $(ALLSPHINXOPTS) $(O)

clean-all: clean
rm -rf $(BUILDDIR)/*
rm -rf generated/*
rm -rf reference/generated/*

# Alias to html
build: html

.PHONY: livehtml
livehtml:
$(SPHINXAUTOBUILD) "$(SOURCEDIR)" "$(BUILDDIR)/html" $(ALLSPHINXAUTOOPTS) $(O)


.PHONY: showlinks
showlinks:
python -m sphinx.ext.intersphinx $(BUILDDIR)/html/objects.inv

release_args ?= -m "update docs" -b nist-pages
release:
ghp-import -o -n $(release_args) $(BUILDDIR)/html

command ?= @echo pass "command=..."
command:
$(command)
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
"Symbol": "~sympy.core.symbol.Symbol",
"symFunction": "~sympy.core.function.Function",
"ExtrapModel": "~thermoextrap.models.ExtrapModel",
# "DataCentralMoments": "~cmomy.core.data.DataCentralMoments"
# "DataCentralMoments": "~cmomy.DataCentralMoments"
}


Expand Down
12 changes: 6 additions & 6 deletions docs/reference/api-baseclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,37 @@ Base classes
:inherited-members:
:members:

.. autoclass:: thermoextrap.core.models.PiecewiseMixin
.. autoclass:: thermoextrap.models.PiecewiseMixin
:autosummary:
:show-inheritance:
:inherited-members:
:members:

.. autoclass:: thermoextrap.core.models.SymDerivBase
.. autoclass:: thermoextrap.models.SymDerivBase
:autosummary:
:show-inheritance:
:inherited-members:
:members:

.. autoclass:: thermoextrap.core.models.SymFuncBase
.. autoclass:: thermoextrap.models.SymFuncBase
:autosummary:
:show-inheritance:
:members:


.. autoclass:: thermoextrap.core.data.AbstractData
.. autoclass:: thermoextrap.data.AbstractData
:autosummary:
:show-inheritance:
:inherited-members:
:members:

.. autoclass:: thermoextrap.core.data.DataCentralMomentsBase
.. autoclass:: thermoextrap.data.DataCentralMomentsBase
:autosummary:
:show-inheritance:
:inherited-members:
:members:

.. autoclass:: thermoextrap.core.data.DataValuesBase
.. autoclass:: thermoextrap.data.DataValuesBase
:autosummary:
:show-inheritance:
:inherited-members:
Expand Down
Loading

0 comments on commit a63787f

Please sign in to comment.