Skip to content

Commit

Permalink
Merge branch 'release/v0.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
wpk committed May 4, 2023
2 parents 14b0bfc + c13f00e commit 776f316
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 107 deletions.
6 changes: 3 additions & 3 deletions .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": "cb20a32f67dadb4142be54898a87de1efdce6bd6",
"commit": "10a9fe1a4f0b341184e41953433c344020f92c72",
"checkout": "feature/markdown",
"skip": [
"src/thermoextrap/__init__.py",
Expand All @@ -24,8 +24,8 @@
"docs/_templates/autodocsumm/*.rst",
"docs/_static/css/*",
"docs/_static/js/*",
"changelog.d/templates/*",
"changelog.d/templates/auto-changlog/*"
"changelog.d/templates/*.j2",
"changelog.d/templates/auto-changelog/*.jinja2"
],
"project_short_description": "Thermodynamic extrapolation",
"version": "0.0.1",
Expand Down
19 changes: 19 additions & 0 deletions .recipe-append.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
test:
imports:
- thermoextrap
commands:
- pip check
requires:
- pip

about:
home: https://github.com/usnistgov/thermoextrap
summary: Thermodynamic extrapolation
description: |
A package to perform thermodynamic extrapolation of molecular simulations.
license: NIST-PD
license_file: LICENSE

extra:
recipe-maintainers:
- wpk-nist-gov
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,3 +389,14 @@ Versioning is handled with [setuptools_scm].The pacakge version is set by the
git tag. For convenience, you can override the version in the makefile (calling
tox) by setting `version=v{major}.{minor}.{micro}`. This is useful for updating
the docs, etc.

## Creating conda recipe

[grayskull]: https://github.com/conda/grayskull

For the most part, we use [grayskull] to create the conda recipe. However, I've
had issues getting it to play nice with `pyproject.toml` for some of the 'extra'
variables. So, we use grayskull to build the majority of the recipe, and append
the file `.recipe-append.yaml`. For some edge cases (install name different from
package name, etc), you'll need to manually edit this file to create the final
recipe.
46 changes: 0 additions & 46 deletions docs/examples/create-symlinks.sh

This file was deleted.

22 changes: 11 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors = [
{ name = "Jacob Monroe", email = "[email protected]" },
{ name = "William Krekelberg", email = "[email protected]" }
]
license = { text = '"NIST license https://www.nist.gov/director/licensing"' }
license = { text = "NIST-PD" }
description = "Thermodynamic extrapolation"
# if using markdown
# long_description_content_type = text/markdown
Expand Down Expand Up @@ -60,16 +60,16 @@ test = ["pytest"]

# dev = []
# docs = []
## Defer this to setup.cfg
## Will transition when everything works (grayskull in particular)
## and will remove setup.py
# [tool.setuptools]
# zip-safe = true # if using mypy, must be False
# include-package-data = true
# license-files = ["LICENSE"]
# [tool.setuptools.packages.find]
# namespaces = true
# where = ["src"]
## grayskull still messes some things up, but use scripts/recipe-append.sh for this
[tool.setuptools]
zip-safe = true # if using mypy, must be False
include-package-data = true
license-files = ["LICENSE"]

[tool.setuptools.packages.find]
namespaces = true
where = ["src"]

## include = []
## exclude = []
##
Expand Down
23 changes: 17 additions & 6 deletions scripts/dist-conda.mk
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@

project_name?=thermoextrap
sdist_path?=$(project_name)

.PHONY: help clean-recipe clean-build recipe build command
.PHONY: help clean-recipe clean-build grayskull recipe-append recipe build command

help:
@echo Makefile for building conda dist
clean-recipe:
rm -rf $(project_name)
rm -rf dist-conda/$(project_name)

clean-build:
rm -rf build

recipe: clean-recipe
grayskull pypi $(project_name) && \
cat $(project_name)/meta.yaml
# by default, only use a few sections
grayskull_args ?= --maintainers wpk-nist-gov --sections package source build requirements
grayskull: clean-recipe
grayskull pypi $(sdist_path) $(grayskull_args) -o dist-conda

# append the rest
recipe_base_path ?= dist-conda/$(project_name)/meta.yaml
recipe_append_path ?= .recipe-append.yaml
recipe-append:
bash scripts/recipe-append.sh $(recipe_base_path) $(recipe_append_path)

recipe: grayskull recipe-append

build: clean-build
conda mambabuild --output-folder=build --no-anaconda-upload .
conda mambabuild --output-folder=dist-conda/build --no-anaconda-upload dist-conda

command:
$(command)
34 changes: 34 additions & 0 deletions scripts/recipe-append.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This is to fix issues using grayskull with pyproject.toml only projects
# We fall back to using grayskull to create the majority of the recipe
# but add in the final sections
# Edit .recipe-append.yaml
if [ $# -lt 2 ]; then
echo "need recipe_base_path, recipe_append_path"
exit 1
fi

base_path=$1
append_path=$2


if [ ! -f $base_path ]; then
echo "no $base_path"
exit 1
fi

if [ ! -f $append_path ]; then
echo "no $append_path"
exit
fi


tmp_file=$(mktemp)
cp $base_path $tmp_file

echo "" >> $tmp_file

cat $append_path >> $tmp_file

mv $tmp_file $base_path

cat $base_path
26 changes: 0 additions & 26 deletions setup.cfg

This file was deleted.

12 changes: 0 additions & 12 deletions setup.py

This file was deleted.

13 changes: 10 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,20 @@ commands_test_check =
[testenv]
passenv =
SETUPTOOLS_SCM_PRETEND_VERSION
TEST_VERSION
# general command
command
# linting
mypy_args
pyright_args
pytype_args
release_args
# dist-conda stuff
project_name
TEST_VERSION
sdist_path
grayskull_args
recipe_base_path
recipe_append_path
usedevelop =
test: True
conda_env =
Expand Down Expand Up @@ -95,9 +102,9 @@ skip_install = True
envdir = {toxworkdir}/dist-conda
basepython = {[base]build_python}
conda_env = {[base]conda_env_dist_conda}
changedir = {toxinidir}/dist-conda
changedir = {toxinidir}
commands =
make -f {toxinidir}/scripts/dist-conda.mk {posargs} project_name={[base]package_name}
make -f {toxinidir}/scripts/dist-conda.mk {posargs} project_name={env:project_name:{[base]package_name}}

[testenv:testdist-{pypi, conda}-{local,remote}-py3{8, 9, 10, 11}]
conda_channels =
Expand Down

0 comments on commit 776f316

Please sign in to comment.