Paul Madden
2018-07-14 16:05:38 UTC
I had until recently been extracting metadata from meta.yaml (for various
purposes, e.g. to get the package version to create a git tag) just using
standard YAML processing in Python. However, when jinja2 syntax is used in
meta.yaml, it's no longer valid YAML, so I took Mike Sarahan's advice and
switched to using conda_build.api.render() to fully render meta.yaml and
then query the returned object for the information I need. This is quite
nice, but I ran into two problems:
1. Rendering meta.yaml this way produces some informational messages on
stdout that I don't want to see in my use case, and also results in a build
directory being created under conda-bld, that conda build later informs you
that you can/should clean up with "conda build purge". If I do a lot of
renders of meta.yaml in my workflow, these can really pile up. I solved
these problems by setting the kwargs verbose=False (to eliminate the
informational message) croot=tmpdir (to have the render performed in a
Python-created temporary directory, that I then cleaned up). I'm just
sharing this in case it's useful to anyone.
2. Then this happened (simplified version here for demo purposes):
~ % conda create -c defaults --override-channels -y -n foo conda-build
[...]
~ % source activate foo
(foo) ~ % conda info -e
# conda environments:
#
base /lscratch/pmadden/miniconda
foo * /lscratch/pmadden/miniconda/envs/foo
(foo) ~ % source deactivate foo
~ % conda info -e
# conda environments:
#
/lscratch/pmadden/miniconda
base * /lscratch/pmadden/miniconda/envs/foo
~ % conda env remove -y -n foo
EnvironmentLocationNotFound: Not a conda environment: /lscratch/pmadden/
miniconda/envs/foo/envs/foo
Is that expected? Should I not be able to install conda-build in an
environment? Since it's apparently the only reliable way to interpret
meta.yaml, it would be useful to be able to do so. Otherwise, I can't
immediately think of anything better than deriving meta.yaml from some
other data structure that can be reliably parsed by external tooling, but
that would be an unfortunate complication.
paul
purposes, e.g. to get the package version to create a git tag) just using
standard YAML processing in Python. However, when jinja2 syntax is used in
meta.yaml, it's no longer valid YAML, so I took Mike Sarahan's advice and
switched to using conda_build.api.render() to fully render meta.yaml and
then query the returned object for the information I need. This is quite
nice, but I ran into two problems:
1. Rendering meta.yaml this way produces some informational messages on
stdout that I don't want to see in my use case, and also results in a build
directory being created under conda-bld, that conda build later informs you
that you can/should clean up with "conda build purge". If I do a lot of
renders of meta.yaml in my workflow, these can really pile up. I solved
these problems by setting the kwargs verbose=False (to eliminate the
informational message) croot=tmpdir (to have the render performed in a
Python-created temporary directory, that I then cleaned up). I'm just
sharing this in case it's useful to anyone.
2. Then this happened (simplified version here for demo purposes):
~ % conda create -c defaults --override-channels -y -n foo conda-build
[...]
~ % source activate foo
(foo) ~ % conda info -e
# conda environments:
#
base /lscratch/pmadden/miniconda
foo * /lscratch/pmadden/miniconda/envs/foo
(foo) ~ % source deactivate foo
~ % conda info -e
# conda environments:
#
/lscratch/pmadden/miniconda
base * /lscratch/pmadden/miniconda/envs/foo
~ % conda env remove -y -n foo
EnvironmentLocationNotFound: Not a conda environment: /lscratch/pmadden/
miniconda/envs/foo/envs/foo
Is that expected? Should I not be able to install conda-build in an
environment? Since it's apparently the only reliable way to interpret
meta.yaml, it would be useful to be able to do so. Otherwise, I can't
immediately think of anything better than deriving meta.yaml from some
other data structure that can be reliably parsed by external tooling, but
that would be an unfortunate complication.
paul
--
You received this message because you are subscribed to the Google Groups "conda - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to conda+***@continuum.io.
To post to this group, send email to ***@continuum.io.
Visit this group at https://groups.google.com/a/continuum.io/group/conda/.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/conda/a637af1b-2f75-415e-a332-8992965a1def%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
You received this message because you are subscribed to the Google Groups "conda - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to conda+***@continuum.io.
To post to this group, send email to ***@continuum.io.
Visit this group at https://groups.google.com/a/continuum.io/group/conda/.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/conda/a637af1b-2f75-415e-a332-8992965a1def%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.