Skip to content

Commit

Permalink
Merge branch 'add_compatibility_for_requirements_run_constrained'
Browse files Browse the repository at this point in the history
  • Loading branch information
skallfass committed Oct 24, 2019
2 parents b0607ad + 87a8e15 commit 3554df4
Show file tree
Hide file tree
Showing 10 changed files with 353 additions and 204 deletions.
12 changes: 11 additions & 1 deletion cenv_tool/schemata.py
Expand Up @@ -55,12 +55,22 @@ class SNRequirements(Schema):
fields.String(
strict=True,
required=True,
validate=lambda x: '=' in x if 'python ' not in x else True,
validate=lambda x: '=' in x if 'python' not in x else True,
error_messages=dict(validator_failed='Version must be specified'),
),
strict=True,
required=True,
)
run_constrained = fields.List(
fields.String(
strict=True,
required=False,
validate=lambda x: '=' in x,
error_messages=dict(validator_failed='Version must be specified'),
),
strict=True,
required=False,
)


class SNTest(Schema):
Expand Down
5 changes: 5 additions & 0 deletions cenv_tool/utils.py
Expand Up @@ -133,6 +133,11 @@ def extract_dependencies_from_meta_yaml(meta_yaml_content: dict) -> List[str]:
)
)

if meta_yaml_content['requirements'].get('run_constrained'):
dependencies.extend(
meta_yaml_content['requirements']['run_constrained']
)

if meta_yaml_content['extra'].get('dev_requirements'):
dependencies.extend(meta_yaml_content['extra']['dev_requirements'])

Expand Down
6 changes: 3 additions & 3 deletions docs/_static/coverage.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions docs/requirements.txt
@@ -1,16 +1,16 @@
attrs==19.*,>=19.0.0
coverage-badge==1.*,>=1.0.0
attrs>=19
coverage>=4
coverage-badge>=1
ipython>=7
jinja2>=2
marshmallow<3,>=2.19
monkeytype>=19
pylint>=2
pytest==5.*,>=5.0.0
pytest-cov==2.*,>=2.0.0
pytest-datafiles==2.*,>=2.0.0
pylint>=2.4
pytest>=5
pytest-cov>=2
pytest-datafiles>=2
pyyaml==5.*,>=5.0.0
six>=1.12
sphinx==2.*,>=2.0.0
sphinx-autodoc-typehints==1.*,>=1.0.0
sphinx-rtd-theme==0.*,>=0.0.0
sphinx>=2
sphinx-autodoc-typehints>=1.8.0
sphinx-rtd-theme>=0
yapf>=0
22 changes: 13 additions & 9 deletions docs/usage.rst
Expand Up @@ -77,23 +77,25 @@ A meta.yaml valid for cenv should look like the following:

requirements:
build:
- python 3.6.8
- pip
- setuptools
- python
- pip
- setuptools
run:
- python 3.6.8
- attrs >=18.2,<19
- jinja2 >=2.10
- six >=1.12.0
- yaml >=0.1.7
- python
- attrs >=18.2,<19
- jinja2 >=2.10
- six >=1.12.0
- yaml >=0.1.7
run_constrained:
- pandas >=0.23

test:
imports:
- example_package

extra:
env_name: example
python: 3.6
python: 3.6.8
dev_requirements:
- ipython >=7

Expand All @@ -107,6 +109,8 @@ A meta.yaml valid for cenv should look like the following:
- package >=0.1
The same is required for the ``extra:dev_requirements``-section.
If the section ``requirements:run_constrained`` is defined, too, these
dependency information is extracted for dependency collection, too.
Not defining a version will not create or update a conda-environment,
because this is not the purpose of the conda-usage.
The validity of the ``meta.yaml`` is checked in ``cenv`` using the
Expand Down

0 comments on commit 3554df4

Please sign in to comment.