Skip to content
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

Use antq as a library #209

Closed
tengstrand opened this issue Mar 25, 2023 · 10 comments
Closed

Use antq as a library #209

tengstrand opened this issue Mar 25, 2023 · 10 comments

Comments

@tengstrand
Copy link

Hi!

I'm considering using antq within the poly tool.

If we let the poly tool execute the libs command, it returns all the used libraries in the workspace, e.g.:
image

My idea is to allow the user to also show the column outdated that will be populated if the library is out of date, by using antq internally.

I haven't digged into the code so much yet, but is it possible to use antq as a library, and let it return a data structure with all the outdated libraries, when called?

@liquidz
Copy link
Owner

liquidz commented Mar 27, 2023

@tengstrand Sorry for late reaction.

is it possible to use antq as a library

Unfortunately no for now.
But it should be, so I'd like to add some APIs :)

@pmonks
Copy link
Contributor

pmonks commented Mar 29, 2023

@tengstrand I'm (ab)using antq as a library here. It seems to work ok, despite being a little kludgy due to the entry points and args not being as well-defined as one might expect in a "real" library.

@liquidz
Copy link
Owner

liquidz commented Mar 29, 2023

antq.core/antq is available, but it has not been organized as an API as you know.
So, I'm considering a new interface based on this function.

@pmonks
Copy link
Contributor

pmonks commented Mar 29, 2023

@liquidz I suspect it won't take much, given how close the functionality already is! 🤞

@liquidz
Copy link
Owner

liquidz commented Mar 30, 2023

@tengstrand @pmonks
Now I'm considering the API as follows.

antq/src/antq/api.clj

Lines 31 to 32 in 9c7cc46

(outdated-deps '{org.clojure/clojure {:mvn/version "1.8.0"}}
{:no-changes? true}))

The first argument deps-map is a map of the same form as :deps in deps.edn, so it seems easy to specify when used as a library in my opinion.
How about this interface?

@pmonks
Copy link
Contributor

pmonks commented Mar 31, 2023

@liquidz from my perspective that looks like a good start, though I think some of the other CLI options may also be handy to have available via the opts map second argument? For example all of the following seem useful:

I think there also needs to be a separate API that's equivalent to the upgrade CLI option (imvho it makes more sense to implement this as a separate fn in the API, rather than as an opt to outdated-deps - obvs that's not possible via a CLI, but an API can be more expressive).

@liquidz
Copy link
Owner

liquidz commented Mar 31, 2023

@pmonks Thanks for your advice :)

I think some of the other CLI options may also be handy to have available via the opts map second argument

Supported.

A CLI options map including additional API options.

I think there also needs to be a separate API that's equivalent to the upgrade CLI option

Added.

(defn upgrade-deps!

Could you try dev branch?

@tengstrand
Copy link
Author

tengstrand commented Apr 1, 2023

The new api works really well! Thanks @liquidz

image

@liquidz
Copy link
Owner

liquidz commented Apr 1, 2023

@tengstrand Thanks for your confirmation!
I just released v2.3.1043 :)

@liquidz liquidz closed this as completed Apr 1, 2023
@tengstrand
Copy link
Author

Switched to that version. Thanks @liquidz!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants