Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vanishing requirements #12

Closed
nazavode opened this issue Feb 26, 2017 · 2 comments
Closed

Vanishing requirements #12

nazavode opened this issue Feb 26, 2017 · 2 comments

Comments

@nazavode
Copy link

I've stumbled upon an issue that causes reqwire to drop previously added dependencies to a requirement .in. Steps to reproduce:

bash-3.2$ mkdir test
bash-3.2$ cd test
bash-3.2$ reqwire init
created /Users/fmontag/test/requirements/src
created /Users/fmontag/test/requirements/lck
created /Users/fmontag/test/requirements/src/docs.in
created /Users/fmontag/test/requirements/src/main.in
created /Users/fmontag/test/requirements/src/qa.in
created /Users/fmontag/test/requirements/src/test.in
bash-3.2$ reqwire add sqlalchemy
Collecting sqlalchemy
Installing collected packages: sqlalchemy
Successfully installed sqlalchemy-1.1.5
saving requirement(s) to main
bash-3.2$ cat requirements/src/main.in
# -*- mode: requirementstxt -*-
# vim: set ft=requirements
# Generated by reqwire on Sun Feb 26 20:12:35 2017
--index-url https://pypi.python.org/simple
SQLAlchemy==1.1.5

Ok, at this point let's add another dependency to main.in:

bash-3.2$ reqwire add sqlalchemy-utils
Collecting sqlalchemy-utils
Requirement already satisfied: six in /Users/fmontag/venv/lib/python3.6/site-packages (from sqlalchemy-utils)
Requirement already satisfied: SQLAlchemy>=1.0 in /Users/fmontag/venv/lib/python3.6/site-packages (from sqlalchemy-utils)
Installing collected packages: sqlalchemy-utils
Successfully installed sqlalchemy-utils-0.32.12
saving requirement(s) to main
bash-3.2$ cat requirements/src/main.in
# -*- mode: requirementstxt -*-
# vim: set ft=requirements
# Generated by reqwire on Sun Feb 26 20:13:03 2017
--index-url https://pypi.python.org/simple
SQLAlchemy-Utils==0.32.12

The first one just vanishes, adding a second dependency drops the first. Maybe it is just because sqlalchemy-utils pulls in sqlalchemy as a dependency but both of them are top level dependencies for my project so I was expecting to have both of them pinned in main.in.

@darvid
Copy link
Owner

darvid commented Feb 28, 2017

This is expected behavior for now, as SQLAlchemy is a dependency of SQLAlchemy-Utils. I'm not totally convinced that top-level dependencies should be preserved by default, so for now I've made it configurable with the preserve_toplevel environment configuration.

$ reqwire add sqlalchemy
$ REQWIRE_PRESERVE_TOPLEVEL=true reqwire add sqlalchemy-utils

It's a bit of a hack, as it intersects the initial requirements to the resolved requirements, which were resolved (with pip-tools) through the initial + specified requirements anyway. This results in the version of the common requirements being changed to the resolved version. In your example, SQLAlchemy's version changes to SQLAlchemy==1.1.5,>=1.0.

I think this option should be sufficient for now, let me know if it works for you or if you have any other concerns. (Released as 0.8 btw)

@nazavode
Copy link
Author

I got your point, preserving all top level dependencies even if they are not actually top level anymore (just like in this case), could lead to some conflicting behaviour, but I have no clear idea about this at the moment.
So for now thank you so much for the great support!

@darvid darvid closed this as completed Feb 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants