pfalcon / pycopy-lib

Standard library of the Pycopy project, minimalist and light-weight Python language implementation
https://github.com/pfalcon/pycopy
Other
246 stars 70 forks source link

upip: allow == to specify exact version #70

Open chrisdecker1201 opened 2 years ago

chrisdecker1201 commented 2 years ago

As I wanted this feature in micropython (https://github.com/micropython/micropython/pull/8033) I think It would be nice to have it here too.

I can't test it because I could not find out how to get the ussl library.

Maybe someone can test it for me or explain me how I get the ussl library.

pfalcon commented 2 years ago

Thanks for the patch, but for starters, what is the usecase for it?

Then, it clearly has a mistake in the code.

Also, see https://github.com/pfalcon/pycopy-lib#contributing for contribution guidelines (format of commit messages, etc.)

or explain me how I get the ussl library.

It's builtin. I.e., when you build https://github.com/pfalcon/pycopy/ binary, you have it.

chrisdecker1201 commented 2 years ago

I really like to define the exact version of a package. So this change would be nice. If I write a script which installs all my packages, I'm not sure (at the moment) that I'll get the same or working program.

If I can specify the exact version, I can make sure I've always the same outcome.

I'll check for the error in the merge request.

chrisdecker1201 commented 2 years ago

I've problem getting it all to run. Maybe you can help me.

I've installed ssl, ussl and upip

make install MOD=ssl
make install MOD=cpython-ussl
make install MOD=upip

But I'm getting this error when I execute this script

import sys

sys.path.append("")

from upip import install

packages = [
    "micropython-uuid==0.1",
]

install(packages, "modules")
AttributeError: 'module' object has no attribute 'SSLContext'

And when I look into ussl I don't find any SSLContext class only in ssl. But I'm sure that's all because I do not understand everything at the moment :)

pfalcon commented 2 years ago

Yeah, https://www.chiark.greenend.org.uk/~sgtatham/bugs.html is dedicated to such matters ;-)

$ pycopy
Pycopy v3.6.0-111-gf540e689dd on 2021-09-16; linux version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> import ussl
>>> ussl.SSLContext
<class 'SSLContext'>
>>> 
chrisdecker1201 commented 2 years ago

Okay. I'm getting closer :).

I could not compile pycopy due to this error https://github.com/pfalcon/pycopy/issues/59

chrisdecker1201 commented 2 years ago

It should work now :)