Hacker Newsnew | past | comments | ask | show | jobs | submit | more BiteCode_dev's commentslogin

High resolutions on small screen are very hard to read.


In the extreme, yes, and low resolution on large screens are also difficult to read. Viewing distance is also a factor. You always need to find a balance.


In python:

    from functools import partial 
    new_function = partial(yourfunction, the_injected_dep=the_value)


Modules are already name spaces, and dependency injection can be configured using partial application.


In which language?


In Python.


Poetry is the cleanest python deps handling experience, and I would recommend it as well.

But it is very slow.


For those who are wondering what is the benefit over pip freeze: pip freeze dumps you entire venv, while pip compile gets project dependancies, and infer the requirements file from that.


I'm not sure I get it -- if you had your core dependencies in setup.py / setup.cfg / pyproject.toml (for development) and then pip freeze (for creating a highly reproduced venv for applications), would that be similar?

Why would one want to infer the requirements file? Would that be like `pip list --not-required --format-freeze`?


When in Africa, I worked around that problem and many others using a pypi proxy. Today devpi is the standard: https://devpi.net/docs/devpi/devpi/stable/%2Bd/index.html

You pip install from it instead of pypi. It will in turn download from pypi and give the result to you. It will also keep itself updated, and you can batch download during the nigh packages you assume you will work.

As a result, our entire team always as most packages locally available. Changing machine, location or purging cache didn't mean loosing this benefit.

Besides, pip caching wheels doesn't mean it's not making any requests, so it's still a better experience.

For big companies, I recommend it anyway: it speeds up the entire team work, CI, allow you to publish private packages, etc.

If you can't do that, the next best things is to do "pip download", instead of "pip install", and save the wheels into a hard drive.


Thanks for the tips, I'll definitely look into them.

EDIT: And thanks for the tip from godmode2019. I upvoted you both.

However, they don't change the fact that pip by default assumes a decent Internet connection, with its short timeout and no resume on downloads, and thus is unusable with anything less.

Again, IMHO that's simply unacceptable for the official Python package manager.


Unfortunately this is the the norm of most package managers these days, and I feel sorry pip can’t make the out-of-the-box experience more pleasant for you. If you got ideas how pip can improve the experience without compromising the zero-config default (which a lot of Python newcomers rely on), please definitely feel free to suggest them; we are all ears.

I would say that Python, and especially pip, is actually relatively friendly to scenarios where non-obstructed Internet is not generally available, compared to many other offerings from other programming languages (especially those without corporate backing). Devpi was already mentioned as a solution; in fact, since pip’s --index-url accepts a file:// URL, you can even simply pre-download the wheels, arrange them in the correct hierarchy (see PEP 503) inside a thumb drive, and just pass that around. The --find-links --no-index combination may also be an interesting approach for simple setups. There are a lot of things to try, before you conclude things do not work.


I do have a few suggestions, starting from least effort for most impact:

1. AFAICT pythonhosted.org is hosted at fastly.net, which seems to be heavily throttling downloads from certain disprivileged locations, as well as downloads from cloud providers such as Linode. It would help a lot if they could ease up a little on the aggressive throttling.

2. Make the pip download timeout longer to better accommodate spotty connections.

3. Make pip downloads resumable so that a download makes progress each time pip install is run.

4. Make pip download each file over multiple HTTP connections in parallel. Download throttling applies to a single connection, so downloading over multiple connections will speedup the download.

Thanks a lot for listening!


I've had ~5 mbps download speeds for the last 5 years in a rural US location. I set up devpi on an old Raspberry Pi hoping to have this same experience, but after several months I disabled it and found it was actually slowing things down. If memory serve, the issue was that the local package lookups were excruciatingly slow (even if done in localhost), and I was surprised to see that devpi would routinely soak up multiple GB of memory and start swapping (I recall a few issues on memory leaks in their repo).

Seemed like a great idea, and perhaps I just needed something beefier than an RPi 3, but it didn't work out for me.


It's interesting if you got a lot of wheels to build locally, but this is very specific: most wheels are pre-built for you, that kinda the point.

It still happens from time to time, but if somebody else read this comment, you want to check how many wheels you build before doing so.

Also, you may want to cache those build once and for all.


Depends on your platform. If you're using ARM (like AWS Graviton, and possibly Apple M1) you might find that many wheels are not available. That might be different now, my information is 2 years old, but I remember 'pip install numpy' taking ages. Every time someone pushed a change we'd have a 15 minute job clogging the pipes. Luckily I had already created an artifact repo (AWS CodeArtifact) for our own internalpackages, so I added a step to our build process to push locally built wheels, so a painfully slow build would only happen once.


"PEP compliant" is kinda saying "convention compliant", it's not meaningful unless you provide the PEP number.

However, pdm and the likes are interesting because they are, indeed, PEP 582 compliants, which let you use __pypackages__ like one uses node_modules.


oh hi, sorry for the late reply. indeed you are right; i was typing from my phone and was a bit too hasty. i am not a fan of poetry after reading these; TLDR poetry does not support PEP621 about pyproject.toml either, and i feel this is the direction the python community has been going towards recently.

* https://iscinumpy.dev/post/bound-version-constraints/

* https://iscinumpy.dev/post/poetry-versions/

also pdm is developed by frostming, who's on PyPA (Python Packaging Authority) and more libraries are extending support for pdm (streamlit just today).

but in general i am not against poetry. it's a good tool and it pushed package managers a fair bit further - providing a superior alternative to conda imho


A $1800 energy bill would supposedly be the triple of a $600 energy bill that people pay for their fridge ?

I got a fridge, a freezer, a giant screen a phone, a dyson, an electrical water heater and a computer and various electrical cooking appliances.

I pay $60 a month. Who pays $600? Is that a common price in the US?


I dunno about $600. $200-300 was a typical bill for an older detached 3BR when I was in college. split several ways of course. it wouldn't surprise me if people with significantly larger (and poorly insulated) houses paid a lot more, but that wouldn't be common. AFAIK, the vast majority of an energy bill typically comes from heating and cooling. appliances don't contribute that much.

in my current 1BR, with great insulation and neighbors above, below, and on both sides, I too pay about $60 for utilities.


For an older McMansion in TX or FL, not far out of line.


Do you have an air-conditioner?


No, however heating is $200 if electrical. But I work from home, so it's always on high temps, unlike for most people.

Also, that's still far from $600, that's not anymore "preventing your food to spoil", and that's only a few months a year. A/C as well, you don't usually use it in december in most parts of the US.

So yeah, I find this number surprising for a very rich country that should have great infrastructures.


A tree of code scopes is a graph, and you have one per module, plus a navigation history, which makes it 3d, even 4.

A device like that could be adapted for dev.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: