I’ve tried some of the alternatives and I didn’t really see any improvement over pip+venv
. Without venv
, you’re into having a system-wide environment, which I assume we all agree is not a good idea? (eg: You are likely to get conflicts between different projects.)
I have used miniconda
/conda
/anaconda
quite a lot too. I use it on Windows because it’s a convenient way to get a Python install. However, I don’t like it as much as it tends to fail to resolve dependencies more often. Also it works a bit different from pip. I don’t recall exactly why it is different, so I won’t risk providing incorrect information here but essentially when I was looking into it I concluded it was less general purpose. I think I’m correct to say pip has a wider range of packages than conda, and that the two don’t work well together. (If at all?)
There are other things, poetry
comes to mind, but iirc that’s basically a wrapper around pip with some support for uploading your packages to the main pip repo/server. Maybe I misremember this too, and it’s something else rather than poetry
.
When I looked into the different options my conclusion was that pip was the most simple and straightforward option to use and it was sufficient in what it does to be useful. It’s also widely used, which helps, because then everyone uses a standard tooling.
To answer your question here, yes it may be that I just don’t like the UX.
eg: What could be more simple than
cargo test
cargo build --release
cargo run
- or
cargo run --bin NAME
It works anywhere within your project repository.
By contrast, to run tests in Julia
user@linux$ julia runtest.jl
is the closest alternative. Not bad, but you have to be in the test
directory. (Where runtest.jl
lives.)
I’m still trying to figure out the most convenient way to run a “binary application”. You have to be somewhere in src
, probably. Again, maybe I’m wrong here, I’m still new to it.
Maybe I can say something more intelligent by saying with cargo, if you want to install a package, you just run cargo install PACKAGE
.
On the other hand, what should I do with Julia?
- One option is to run the REPL,
using Pkg
and thenPkg.add("PACKAGE")
. Personally, I don’t like it. Even withpip
, one can do
user@linux$ ./.venv/bin/activate
user@linux$ (.venv) pip3 install PACKAGE
I agree, there are problems with this. How do you deploy with Docker? Actually, there are good solutions. You set your entrypoint to
/project_name/.venv/bin/python3 -m /project_name/path/to/module
or, because you are in Docker, you install packages “systemwide” and don’t bother with venv. I prefer to use venv
still, because it is consistent.
To go back to Julia, another option is:
user@linux$ julia
julia> ]
(@1.11) pkg> add PACKAGE
Here’s the thing. I don’t know how you productionize this.
To go back to the first option, is it a good idea to write
using Pkg
Pkg.add("PACKAGE")
at the top of a Julia script which is the main entrypoint for an “application”? I’m not sure about this. You are mixing code with environment. No other language works this way. Is it better? Worse? Why? I don’t know. (Yet)
Well - why? It seems a lot of people here don’t like pip much. I’m not sure I understand why. In the Python world, I would suggest it is almost universally liked.
Can you tell me a problem it has that you have difficulty with? It’s possible I can suggest a slightly different way of using it which is better for the developer experience. (Something I’m very keen on being good btw.)