Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ docs/_build/

# PyBuilder
target/

# Vim swapfiles
.*.sw?
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ include run-tests.sh
recursive-include tests *
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
recursive-exclude * .*.sw?

recursive-include docs *.rst conf.py Makefile
3 changes: 3 additions & 0 deletions tests/data/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
requirements = [
'click>=5.0.0',
'mock>=1.3.0',
'invenio-db[versioning]>=1',
'invenio-db[versioning,mysql]>=1',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO it's more complicated in real life. This case should never happen since it's obvious to fix. There might be however following case:

requirements = [
    'invenio-db[versioning]>=1',
]

extras_require = {
     'mysql': [
          'invenio-db[mysql]>=1',
     ],
}
$ requirements-builder -e mysql ...
invenio-db[versioning,mysql]>=1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but now you see and are able to reproduce the issue, and most probably, the root of it is the same as the real-life example (still investigating).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@david-caro When you re-push, please also add yourself to the AUTHORS.rst file, thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@david-caro IMHO we don't have to solve this limitation here since pip-compile already solves it for us.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pip compile needs a requirements.txt file as input, the step from setup.py->requirements.txt is done by requirements-builder and that step is the one that's failing:

08:36 AM ~/Work/inveniosoftware/invenio-workflows<venv:invenio-workflows>  (starting-point-invenio-3|…7) 
dcaro@pcrcssis001$ grep invenio-db setup.py 
        'invenio-db[postgresql,versioning]>=1.0.0a9',
        'invenio-db[mysql,versioning]>=1.0.0a9',
        'invenio-db[versioning]>=1.0.0a9',
    'invenio-db[versioning]>=1.0.0a9',
08:36 AM ~/Work/inveniosoftware/invenio-workflows<venv:invenio-workflows>  (starting-point-invenio-3|…7) 
dcaro@pcrcssis001$ requirements-builder -e mysql --level=min setup.py
blinker==1.4
flask-celeryext==0.1.0
Flask-CLI==0.2.1
invenio-db==1.0.0a9
invenio-files-rest==1.0.0a3
invenio-records-files==1.0.0a5

'invenio-db[versioning,postgresql]>=1',
]

setup(
Expand Down
18 changes: 14 additions & 4 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,28 @@ def test_cli():
shutil.copytree(DATA, abspath(join(getcwd(), "data/")))
result = runner.invoke(cli, ['-l', 'min', 'data/setup.py'])
assert result.exit_code == 0
assert result.output == "click==5.0.0\nmock==1.3.0\n"
assert result.output == (
"click==5.0.0\n"
"invenio-db[versioning,mysql]==1\n"
"mock==1.3.0\n"
)

result = runner.invoke(cli, ['-l', 'pypi', 'data/setup.py'])
assert result.exit_code == 0
assert result.output == "click>=5.0.0\nmock>=1.3.0\n"
assert result.output == (
"click>=5.0.0\n"
"invenio-db[versioning,mysql]>=1\n"
"mock>=1.3.0\n"
)

result = runner.invoke(cli, ['-l', 'dev', 'data/setup.py'])
assert result.exit_code == 2

result = runner.invoke(
cli, ['-l', 'dev', '-r', 'data/req.txt', 'data/setup.py'])
assert result.exit_code == 0
assert result.output == \
"-e git+https://github.com/mitsuhiko/click.git#egg=click\n" \
assert result.output == (
"-e git+https://github.com/mitsuhiko/click.git#egg=click\n"
"invenio-db[versioning,mysql]>=1\n"
"mock>=1.3.0\n"
)
22 changes: 15 additions & 7 deletions tests/test_requirements_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,24 @@ def test_iter_requirements():
"""Test requirements-builder."""
# Min
with open(SETUP) as f:
assert list(iter_requirements("min", [], '', f)) == \
['click==5.0.0', 'mock==1.3.0']
assert list(iter_requirements("min", [], '', f)) == [
'click==5.0.0',
'mock==1.3.0',
'invenio-db[versioning,mysql,postgresql]==1',
]

# PyPI
with open(SETUP) as f:
assert list(iter_requirements("pypi", [], '', f)) == \
['click>=5.0.0', 'mock>=1.3.0']
assert list(iter_requirements("pypi", [], '', f)) == [
'click>=5.0.0',
'mock>=1.3.0',
'invenio-db[versioning,mysql,postgresql]>=1',
]

# Dev
with open(SETUP) as f:
assert list(iter_requirements("dev", [], REQ, f)) == \
['-e git+https://github.com/mitsuhiko/click.git#egg=click',
'mock>=1.3.0']
assert list(iter_requirements("dev", [], REQ, f)) == [
'-e git+https://github.com/mitsuhiko/click.git#egg=click',
'mock>=1.3.0',
'invenio-db[versioning,mysql,postgresql]>=1',
]