Skip to content

Commit

Permalink
Merge pull request #13 from dprada/main
Browse files Browse the repository at this point in the history
Fixing the to update conda-envs and conda-build yaml files
  • Loading branch information
dprada authored Nov 10, 2021
2 parents 866d9ad + ed2950e commit 20135b0
Show file tree
Hide file tree
Showing 14 changed files with 169 additions and 126 deletions.
105 changes: 105 additions & 0 deletions devtools/broadcast_requirements.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import yaml

def heal(arg):

output = []

for ii in arg:
if type(ii) is list:
for jj in ii:
if type(jj) is list:
for kk in jj:
if kk not in output:
output.append(kk)
else:
if jj not in output:
output.append(jj)
else:
if ii not in output:
output.append(ii)

return output

with open('requirements.yaml') as fff:
all_requirements = yaml.load(fff, Loader=yaml.FullLoader)

# Broadcasting to conda-build

## meta.yaml

with open('conda-build/meta.yaml') as fff:
meta = yaml.load(fff, Loader=yaml.FullLoader)

meta["requirements"]["build"] = heal(all_requirements["setup"]["dependencies"])
meta["requirements"]["run"] = heal(all_requirements["production"]["dependencies"])

fff = open("conda-build/meta.yaml", "w")
yaml.dump(meta, fff, sort_keys=False)
fff.close()

with open("conda-build/meta.yaml", "r") as fff:
meta_lines = fff.readlines()

with open("conda-build/meta.yaml", "w") as fff:
for line in meta_lines:
if line.startswith(' version:'):
line = ' version: \"{{ environ[\'GIT_DESCRIBE_TAG\'] }}\"\n'
fff.write(line)

# Broadcasting to conda-envs

## Production

env_dict={}
env_dict["channels"]=heal(all_requirements["production"]["channels"])
env_dict["dependencies"]=heal(all_requirements["production"]["dependencies"])
fff = open("conda-envs/production_env.yaml", "w")
yaml.dump(env_dict, fff, sort_keys=False)
fff.close()

## Development

env_dict={}
env_dict["channels"]=heal(all_requirements["development"]["channels"])
env_dict["dependencies"]=heal(all_requirements["development"]["dependencies"])
fff = open("conda-envs/development_env.yaml", "w")
yaml.dump(env_dict, fff, sort_keys=False)
fff.close()

## Test

env_dict={}
env_dict["channels"]=heal(all_requirements["test"]["channels"])
env_dict["dependencies"]=heal(all_requirements["test"]["dependencies"])
fff = open("conda-envs/test_env.yaml", "w")
yaml.dump(env_dict, fff, sort_keys=False)
fff.close()

## Docs

env_dict={}
env_dict["channels"]=heal(all_requirements["docs"]["channels"])
env_dict["dependencies"]=heal(all_requirements["docs"]["dependencies"])
fff = open("conda-envs/docs_env.yaml", "w")
yaml.dump(env_dict, fff, sort_keys=False)
fff.close()

## Setup

env_dict={}
env_dict["channels"]=heal(all_requirements["setup"]["channels"])
env_dict["dependencies"]=heal(all_requirements["setup"]["dependencies"])
fff = open("conda-envs/setup_env.yaml", "w")
yaml.dump(env_dict, fff, sort_keys=False)
fff.close()

## Build

env_dict={}
env_dict["channels"]=heal(all_requirements["conda-build"]["channels"])
env_dict["dependencies"]=heal(all_requirements["conda-build"]["dependencies"])
fff = open("conda-envs/build_env.yaml", "w")
yaml.dump(env_dict, fff, sort_keys=False)
fff.close()


2 changes: 1 addition & 1 deletion devtools/conda-build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ conda config --set anaconda_upload no
conda build .
PACKAGE_OUTPUT=`conda build . --output`
anaconda login
anaconda upload --user uibcdf $PACKAGE_OUTPUT
anaconda upload --user uibcdf $PACKAGE_OUTPUT --label main #label:main, dev, tests
conda build purge
anaconda logout
```
Expand Down
27 changes: 10 additions & 17 deletions devtools/conda-build/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
package:
name: pyunitwizard
version: "{{ environ['GIT_DESCRIBE_TAG'] }}"

source:
path: ../../

build:
number: 1

requirements:
build:
- python
- setuptools
- numpy
- versioneer

- python
- setuptools
- numpy
run:
- python
- numpy
- pint

- python
- pint
about:
home: https://uibcdf.org
license: MIT License
summary: ""
description: |
This library provides some useful methods to work with quantities
dev_url: https://github.com/uibcdf/PyUnitWizard
doc_url: https://uibcdf.org/PyUnitWizard
summary: ''
description: 'This library provides some useful methods to work with quantities
'
dev_url: https://github.com/uibcdf/pyunitwizard
doc_url: https://uibcdf.org/pyynitwizard
3 changes: 3 additions & 0 deletions devtools/conda-envs/build_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ channels:
- conda-forge
- default
dependencies:
- python
- setuptools
- numpy
- anaconda-client
- conda-build
10 changes: 10 additions & 0 deletions devtools/conda-envs/development_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ channels:
dependencies:
- python
- pint
- pytest
- pip
- pytest-cov
- codecov
- openmm
- unyt
- sphinx
- sphinx_rtd_theme
- sphinxcontrib-bibtex
- nbsphinx
- recommonmark
- sphinx-markdown-tables
- jupyterlab
2 changes: 1 addition & 1 deletion devtools/conda-envs/docs_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ channels:
- default
dependencies:
- python
- pint
- sphinx
- sphinx_rtd_theme
- sphinxcontrib-bibtex
- nbsphinx
- recommonmark
- sphinx-markdown-tables
- jupyterlab
- pint
- openmm
- unyt
2 changes: 1 addition & 1 deletion devtools/conda-envs/setup_env.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
channels:
- conda-forge
- default
dependencies:
- python
- setuptools
- numpy
- versioneer
2 changes: 1 addition & 1 deletion devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ channels:
- default
dependencies:
- python
- pint
- pytest
- pip
- pytest-cov
- codecov
- pint
- openmm
- unyt
54 changes: 0 additions & 54 deletions devtools/conda-envs/update_yaml_files.py

This file was deleted.

8 changes: 0 additions & 8 deletions devtools/local-build/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions devtools/playground/README.md

This file was deleted.

67 changes: 28 additions & 39 deletions devtools/requirements.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,37 @@
production:
channels:
setup:
channels: &setup_channels
- conda-forge
- default
dependencies:
- pint
dependencies: &setup_dependencies
- python
- setuptools
- numpy

development:
channels:
- conda-forge
- default
dependencies:
production:
channels: &production_channels
- *setup_channels
dependencies: &production_dependencies
- python
- pint
- openmm
- unyt
- jupyterlab
- pytest
- pip
- pytest-cov
- codecov
- sphinx
- sphinx_rtd_theme
- sphinxcontrib-bibtex
- nbsphinx
- recommonmark
- sphinx-markdown-tables

test:
channels:
- conda-forge
- default
dependencies:
channels: &test_channels
- *production_channels
dependencies: &test_dependencies
- *production_dependencies
- pytest
- pip
- pytest-cov
- codecov
- pint
- openmm
- unyt

docs:
channels:
- conda-forge
- default
dependencies:
channels: &docs_channels
- *production_channels
dependencies: &docs_dependencies
- *production_dependencies
- sphinx
- sphinx_rtd_theme
- sphinxcontrib-bibtex
Expand All @@ -53,20 +42,20 @@ docs:
- pint
- openmm
- unyt
setup:

development:
channels:
- default
- *production_channels
dependencies:
- setuptools
- numpy
- versioneer
- *production_dependencies
- *test_dependencies
- *docs_dependencies

conda-build:
channels:
- conda-forge
- default
- *setup_channels
dependencies:
- *setup_dependencies
- anaconda-client
- conda-build

8 changes: 8 additions & 0 deletions docs/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends '!layout.html' %}
{% block document %}
{{super()}}
<a href="https://github.com/uibcdf/pyunitwizard">
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub">
</a>
{% endblock %}

Loading

0 comments on commit 20135b0

Please sign in to comment.