Closed guidorice closed 2 months ago
Similar to pip, the extras should be wrapped in quotes so magic add --pypi "httpx[http2]"
works and diff shows things like hyperframe
which are transitive dependencies were added.
@ehsanmok thanks for your prompt followup on this. However, I believe this should be reopened.
pip
cli options, but that's kind of beside the point.
def check_httpx_http2():
import httpx
_ = httpx.Client(http2=True)
def check_httpx_brotli():
import brotli
def main():
try:
check_httpx_brotli()
except Exception as e:
print(e)
try:
check_httpx_http2()
except Exception as e:
print(e)
if __name__=="__main__":
main()
$ magic add --pypi "httpx[brotli,http2]"
✔ Added httpx[brotli,http2]
Added these as pypi-dependencies.
$ which python
/Users/guidorice/mojo/moxarray/.magic/envs/default/bin/python
$ python check_httpx_installation.py
No module named 'brotli'
Using http2=True, but the 'h2' package is not installed. Make sure to install httpx using `pip install httpx[http2]`.
python3.11 -m venv try-httpx
source try-httpx/bin/activate
pip install "httpx[http2,brotli]"
python check_httpx_installation.py
Thanks! I've actually made two separate projects magic init --pyproject test1/2
and without quote magic fails to install for me with
no matches found: httpx[brotli]
and diffing their lockfiles shows difference and one has more. I'll reopen it to get confirmation.
Thanks! Also, seems to be fine as a workaround: magic add --pypi brotli h2
Adjusting the pyproject.toml
works dependencies = ["httpx[brotli,http2]>=0.27.0,<0.28"]
but it's an issue that should be fixed.
In the case of mojoproject.toml
it seems to work with this format (manually edited):
[pypi-dependencies]
httpx = {version = ">=0.27.0, <0.28", extras = ["brotli", "http2"]}
But yeah, it seems like the magic add
tool is not parsing the extras.
Sure! we should see the exact same behaviour as indicated in these docs.
@ehsanmok and @zbowling - is this resolved? can we close this out?
@iamtimdavis I don't think so. Waiting to here from Zach.
Yeah now with the new magic 0.2.1 release it should work like that doc link. That should go out with our doc update.
confirmed with magic 0.2.1- thanks all!
Issue description
magic add --pypi httpx[http2]
versusmagic add --pypi httpx
this seems to result in the exact same magic.lock file, making me think the package options are being ignored. For example these options are often used to install different sets of dependencies, for example the installation instructions here: https://www.python-httpx.org/
Steps to reproduce
Version Info