-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow getting version despite deps missing #382
base: main
Are you sure you want to change the base?
Conversation
@takluyver opinions? |
@takluyver what do you think? |
Hi @flying-sheep, sorry it's taken me ages to look at these PRs (this and #374). I know I'm rather neglecting my role as a maintainer of Flit - when I get a bit of time to do non-work programming, there's generally something more either more fun or where I feel I can make more concrete progress in a small chunk of time. I like this idea better than #374. I don't love it - putting the I hope you won't mind if I take this chance to run an idea past you for making getting the version number more flexible. This is for discussion, at the moment, rather than implementation, but it's been bouncing around in my head for a while. I'll start with an illustration: [tool.flit.version]
method = "import"
module = "foobar.version" I.e. you would specify whether to use static analysis or execution, and which module defines the version. Questions I'm not sure about:
I imagine that you'll want maximum flexibility & power on all of these questions, whereas my instinct is to keep things simpler. I'm thinking through how many options I want to enable here. 🙂 I'm also thinking that if I do go for this, then the current behaviour of trying static analysis and then falling back to running code will eventually go away (after a suitable deprecation), and you will have to specify explicitly that you want it to import/exec code to get the version number. |
Sounds great that you are thinking about tackling this! I’m personally not maintaining things too far back: The slowest Linux distros are on something like 3.7 these days, right? … idk what reasons exist to support 3.4 for things that aren’t build tools. In flit’s case, “this is a build tool and other people still use 3.4” is an entirely valid reason if that’s how it is though!
I love simplicity! Power and simplicity aren’t mutually exclusive: Allowing people to call into whatever and clearly telling them that it’s not a flit bug if things go wrong is maximally powerful and very simple. I personally want whatever solution allows my packages to robustly tell the truth about their version. And hardcoding a version isn’t the truth, unless you manually bump that version in every commit (which isn’t realistic). Of course other people have other philosophies here!
So what use cases do exist?
The problem with use case 2 is that flit executes the root module before it installs all dependencies, which means that people with use case 2 can’t both use flit and import anything in their root module (unless they use my hack). To truly support use case 2, we need to either
There’s three ways to run code without (fully) executing the root module:
So all in all I see 4 solutions: ensure all runtime dependencies are installed before executing the module or the three above. |
Also gets rid of the use of deprecated methods