Comments (7)
Just executing or importing the module should install the necessary dependencies.
Module names are not unique; multiple packages can provide modules with the same name.
Furthermore, pipfile
shall provide a deterministic way to describe an environment; installing on demand defies the point because you introduce state. (How will one know what version of django
will be installed when importing?)
from pipfile.
Just executing or importing the module should install the necessary dependencies.
Module names are not unique; multiple packages can deliver modules with the same name.
Right, but resolving that ambiguity would be done by checking the pipfile. That's no different than what pip/pipfile will do, right ? A MetaPathFinder implementation would load a pipfile . What I am suggesting is moving the call to pip install ..
into a hook that gets called at import time.
Furthermore, pipfile shall provide a deterministic way to describe an environment; installing on demand defies the point because you introduce state. (How will one know what version of django will be installed when importing?
By loading the pipfile/Pipfile.lock in the MetaPathFinder implementation ?
from pipfile.
By loading the pipfile/Pipfile.lock in the MetaPathFinder implementation ?
And why would one ever want that? If you need an environment with packages, then you build that environment and then start using it. Why would you build a smaller version first and then install during runtime? Just so you don't have to do a pip install Pipfile.lock
in advance?
Anyway, Pipfile.lock
is supposed to be easily readable so I don't see any issue preventing you from parsing it and installing from it during runtime.
from pipfile.
Why would you build a smaller version first and then install during runtime? Just so you don't have to do a pip install Pipfile.lock in advance?
I'm sorry but I'm not sure what you mean by "build a smaller version first and then install during runtime".
The example above doesn't do that, neither was I suggesting that we do that. The reason one would want to do what I suggested is you can tell users, "download and run foo" rather than telling them to "download, run pip install -r/-p whatever and run foo" -- yeah it doesn't seem like a big deal, I just was thinking from a distribution point of view where the only necessary command line to (for instance) run a UI based python package can be avoided.
Anyway, Pipfile.lock is supposed to be easily readable so I don't see any issue preventing you from parsing it and installing from it during runtime.
Yep, thanks. On IRC there were a number of valid reason why doing something like this might be fraught with difficulties so I'll close this. Although, I think packaging and distributing modules this way in predictable environments would not be a bad thing.
Thanks for your attention.
from pipfile.
The example above doesn't do that, neither was I suggesting that we do that. The reason one would want to do what I suggested is you can tell users, "download and run foo" rather than telling them to "download, run pip install -r/-p whatever and run foo" -- yeah it doesn't seem like a big deal, I just was thinking from a distribution point of view where the only necessary command line to (for instance) run a UI based python package can be avoided.
That is an interesting use case. You do not want to pollute your global site packages I would imagine (or whatever env you're in at that moment), so a better approach would be to create a new Python env first.
With Nix we have something like that actually:
#! /usr/bin/env nix-shell
#! nix-shell -i python -p 'python.withPackages(packages: [ packages.prettytable])'
import prettytable
# Print a simple table.
t = prettytable.PrettyTable(["N", "N^2"])
for n in range(1, 10): t.add_row([n, n * n])
print t
When executed, the script builds an environment where there's a Python interpreter along with that package.
I guess you could do something similar to this in Python by running the file twice (a bit similar to what is done with setup.py
and setup_requires
, but it won't ever be exactly reproducible, because you don't know the state of the first interpreter.
from pipfile.
you can tell users, "download and run foo" rather than telling them to "download, run pip install -r/-p whatever and run foo"
@lonetwin You might want to take a look at https://pypi.org/project/rwt/
from pipfile.
@xavfernandez thanks! Yes, rwt appears to be pretty much what @FRidh describes as a possible approach.
from pipfile.
Related Issues (20)
- Link additional Pipfiles from root one
- Skip lock on a single dependency HOT 4
- Pipfile.lock() is not idempotent
- Security Vulnerability Alerts (in examples/Pipfile.lock) HOT 5
- Pipenv take wrong Pipfile
- AttributeError while using inject_environment_variables function
- typo in line 136
- Rename 'master' branch to 'main' HOT 3
- pip2 install python
- - [ ] @monkeyhammercopiseded #165 HOT 5
- pipfile-spec in Pipfile
- Docs url is unreachable
- Publish a wheel for `pipfile`
- how to specific version in extras of pipfile?
- Support git+ssh source package repositroy
- ااا
- http://example.edu/tt
- Ggg
- how to add dependencies from other sources instead of pypi? HOT 1
- OSS-Fuzz Integration Inquiry
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pipfile.