7 ms·
I am not into Python, but the article lost me before it even started: you are required to install a bunch of compiler tools on your device to be able to proceed
by Kovah 6y ago
I am not into Python, but the article lost me before it even started: you are required to install a bunch of compiler tools on your device to be able to proceed.
Excuse me? Is this really what hypermodern Python looks like?
- tyrion 6y agoThose are needed to compile different versions of Python with pyenv. Usually distributions bundle one or two specific versions of Python. Pyenv makes it super easy to install and use all the versions of Python that you want. Even though for most people it might be enough to just use whatever version of Python comes installed with your system, for a team it might be important that everyone has the exact same version. Moreover, pyenv-virtualenv makes it painless to use virtualenvs and so I recommend you give pyenv a try even if you do not need additional Python versions.
- simiones 6y agoAgain, do these tools really require a C compiler toolchain? If so, they are completely out of the question - they add much more complexity then they could possibly fix. Why not just install the required version of Python, maybe from a 3rd party repo if not available in the main repos? Why would I ever want to get a compiler toolchain to get my Python interpreter?
- Chiron1991 6y ago> Why not just install the required version of Python, maybe from a 3rd party repo That's the thing. pyenv just downloads the source code of the specified Python version, and then compiles it on your machine. They did that to be agnostic of the OS you're running on.
- simiones 6y agoBut they are not agnostic of the OS. In fact, they have a huge dependency on the C toolchain, which I have to fix apparently.
- tyrion 6y agoCould you explain why it is such a deal-breaker in your opinion? It is a single `apt-get install` (which probably downloads less MBs than our typical `npm/yarn` install). Consider that if pyenv came pre-packaged for ubuntu/debian, those packages would be runtime dependencies and then you would just need to `apt-get install pyenv`.
- simiones 6y agoWhat if I already have a different C toolchain installed? Would I now need "cenv" to keep the pyenv C toolchain and my other C toolchain separate?
- neurostimulant 6y agoIf you don't need to use multiple version of python like me, then you don't need it. Just use the built-in venv module in python 3 to create and manage virtuanenv. for example, simply run `python -m venv .venv` to create a new virtualenv in your project dir, and vscode will automatically recognize it when you add the project dir into your workspace. But having c compiler toolchain available is pretty much standard practice when using python (or nodejs, ruby, etc) because you might need to install some library that requires compilation from source (e.g. psycopg2). If you don't want that, you'll stuck with installing those 3rd party libs from your distro's repo, which might be out of date or outright missing (especially for less popular packages).
- starlust2 6y agoPyenv often is the easiest 3rd party source for additional pythons. Real scenario I'm in right now: - Need to build libraries to support 2.7, 3.6, plus future proofing for >=3.7 - CI workers have images which only python 2.7 and 3.6, platform team too busy to update them - Mac Homebrew only supports >=3.7 There's no common environment between anything unless we use pyenv
- simiones 6y agoCan't you simply download Python 2.7, 3.6 and 3.7+ to separate folders, and use those in your different projects? I understand that virtualenv and maybe even pyenv are useful if you need different requirements for different projects using the same version of Python, as apparently pip installs packages globally. But for your setup, I don't get why something like pyenv really helps...
- starlust2 6y agoI gave up trying to install python 3.6 natively on my mac after a few hours. If there is a way it can be "simply" be done, I did not find it.
- frio 6y ago> Can't you simply download Python 2.7, 3.6 and 3.7+ to separate folders, and use those in your different projects? Yep, most people can just do this. Then, they want a little script over the top that downloads the different versions of Python for them -- just to make life easier for them. Wouldn't it be handy to also script the installation? It'd also probably be useful to automatically setup the version of Python I want to use when I switch folders, so I'm not constantly running the wrong version when I change projects. ... et voila, we've reinvented pyenv :).
- metalforever 6y agoMy workplace got burned recently using this tool for some deployment reasons . I have to be honest , my experience with it in other ways wasn’t ideal. I won’t be using it again.
- murgindrag 6y agoNo. Python is nice since it just works. You make a 10 line .py file, and it's super-simple. This article lists a set of bleeding-edge tools, should you choose to add them and learn them all in one place. I wouldn't use half the tools (they're too hypermodern), but it's helpful to know where things are moving.
- nilkn 6y agoIt’s been a long time since Python just worked. You can’t just hand someone a Python script and expect it to work on their machine. Yes, if you keep things simple and avoid all dependencies except the most trivial maybe you can get away with that. But that’s not going to be the case if you’ve got whole teams using Python.
- wegs 6y agoWhen I run teams doing Python development, I'm hyper-disciplined about avoiding unnecessary or bleeding-edge dependencies. My experience is that dependencies save time in the short term, but lead to exponential maintenance costs in the long term. I view each dependency the same way as technical debt. I also generally don't lock versions on dev machines; code should use the core, supported API, and not break on bleeding-edge functionality and API changes. I lock version on deploy machines, obviously. Smart people on my teams don't like this approach, though, so I could be wrong. But you can do Python this way. And beginners definitely should start by doing Python this way.
- nilkn 6y agoI'm sympathetic about bleeding-edge dependencies, but just handling fairly mundane Python dependencies is really easy with venv, pip-tools, and good standards across projects. Of course you always have containers for actual deployments. When you say beginniners, I think it depends on whether you're referring to programming neophytes in general or professional developers who are new to Python specifically. In the latter case, I actually think it's really important for newcomers to Python to get into best practices like this very early on -- indeed, pretty much immediately. Otherwise they're going to end up either being unable to use any interesting dependencies or being unable to distribute their work in a way that is easy and convenient for others to hack on. Do this with a bunch of people simultaneously and it's a big problem.
- BiteCode_dev 6y agoNo, and there is nothing hyper modern about it either. It's a Python stack that solves some problems for a part of the community.
- traverseda 6y agoHypermodern also means "bleeding edge, kind of broken". Modern python does not look like that.
- SV_BubbleTime 6y agoI think your take is like mine. It’s a failure of the author to explain intent. The entire article is WHAT, not WHY. If you are already hyper-familiar with python, you know what you are looking at. Yes, of course I’ll want to use pyenv, “everyone knows that”. For the rest of us, it just seems like a lot of steps to do - for some reason. I think it’s different from just not being the target audience. A good tutorial explains intent.