-
Notifications
You must be signed in to change notification settings - Fork 317
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
Show warning when an old ex_doc version is used. #1843
base: main
Are you sure you want to change the base?
Conversation
|
||
defp start_httpc() do | ||
:inets.start(:httpc, profile: :ex_doc) | ||
|
||
opts = [ | ||
max_sessions: 8, | ||
max_keep_alive_length: 4, | ||
keep_alive_timeout: 120_000 | ||
] | ||
|
||
:httpc.set_options(opts, :ex_doc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just borrowed this from the hex repo. Probably no the correct options for this use case
Can we use the Hex API directly instead? 🤔 |
While testing this I figured this is a classical chicken-egg-problem :-D |
WDYM about the chicken and egg problem exactly? it doesn’t matter if people have >=0.0.0 or ~>0.30 as both would resolve to the same latest version. Hex API is private but yeah we can use it and if it breaks we can solve it in ExDoc. We should only check version when running |
That you will only get the warning, when you already have installed the lastest ExDoc version.
Feels a bit complicated to maintain this. Isn't it better to check the deps if it uses the latest version and just warn based on that information? |
I'm not sure I like the idea of a documentation tool making a connection to the internet by default. I assume that some (many?) will run their build behind a firewall and at least the one I'm behind logs attempts to get out. So not matter what, I think it would be good idea to put this behind a configuration option. |
@jannikbecher got it re checkin & egg problem. Not a big deal, can be said about many things.
Is it? I might be misunderstanding the problem statement but I don't see how that solves anything. As I mentioned in the example, @garazdawi good call. Something that wasn't mention was Hex already has a task to check for deps: Maybe we nudge people to use |
The problem is some maintainers pin the ExDoc version to a specific minor version like this "~> 0.29.3" |
One idea is: aliases: [
"hex.publish": ["hex.outdated ex_doc", "hex.publish"]
] and then:
this currently does not work because Mix continues executing hex.publish. We can solve it by using Mix.raise in hex.outdated, perhaps via opt-in flag. |
speaking of CI, the easiest way to solve this problem is exactly there. Here's an excerpt from my usual checks. Just a one line change: - run: mix deps.get --check-locked
- run: mix format --check-formatted
if: ${{ matrix.lint }}
- run: mix deps.unlock --check-unused
if: ${{ matrix.lint }}
- run: mix deps.compile
- run: mix compile --warnings-as-errors
if: ${{ matrix.lint }}
- run: mix test
if: ${{ ! matrix.lint }}
- run: mix test --warnings-as-errors
if: ${{ matrix.lint }}
+ - run: mix hex.outdated ex_doc |
What if we call
|
Similar to @garazdawi comment, if we are on a train or flight we won't be able to generate docs on bad connectivity. But I suppose there's an incentive for community as a whole to be on the latest version because there's consistent experience all around. Should we at least add an option to opt-out? Your Hex changes sound like good ideas regardless. :) |
@wojtekmach the registry is frequently updated locally anyway, right? We could call |
@josevalim yes, good call. Another way to solve this problem is to use external tools like Dependabot. I don't personally use it but I could be convinced to use it just for ExDoc. Here's an untested dependabot.yml that should work (adapted from https://github.com/philss/floki/blob/main/.github/dependabot.yml) version: 2
updates:
- package-ecosystem: mix
directory: "/"
schedule:
interval: daily
time: "08:00"
allow:
- dependency-name: ex_doc I believe the benefit would be it's even easier for maintainers, they just merge a PR that is automatically created soon after there's a new ExDoc version. |
Woytek asked me to open the PR here :)
He already mentioned that it's probably not a good idea to add hex_core as additional dependency