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

Remove dependencies if not needed #138

Merged
merged 6 commits into from
Sep 3, 2024

Conversation

NelsonVides
Copy link
Contributor

@NelsonVides NelsonVides commented Aug 27, 2024

Just trying to minimise the amount of code and dependencies a project gets, OTP covers RFC3339 since 21.0, and json since 27.0. I'd like to slim of dependencies my deployments and OTP's libraries have better support (and performance).

Edit: just wrapped the logic around a OTP_RELEASE macro, that way we can keep backwards compatibility.

@NelsonVides NelsonVides changed the title Remove rfc3339 Remove dependencies if not needed Aug 28, 2024
@andreineculau
Copy link
Member

Fantastic Nelson!
I'll have a look

PS: backwards compatibility for OSS is more of a black box but thanks to the setup we have is fairly smooth

@NelsonVides
Copy link
Contributor Author

Hey there :) Any updates on this one? Just asking for a timeline, no pressure intended 🥲

Copy link

@zmstone zmstone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not maintainer, but great job! Thank you!

@zmstone
Copy link

zmstone commented Aug 29, 2024

Unsure why github actions are not triggered.

@@ -11,8 +11,6 @@
, public_key
, ssl
, inets
, jsx
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: one can actually add .app.src.script, see https://rebar3.org/docs/configuration/config_script

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but we don't actually need jsx here anyways, this list is for apps to be started, jsx is not an app but only code to be loaded, that rebar will put in the right path for the BEAM to load the code automatically

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's also for rebar3 release to find the apps to be copied.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely very good point I don't know how could I forget! Fixed! :)

@andreineculau
Copy link
Member

Unsure why github actions are not triggered.

First time contributors. Need to click Checks > CI > Approve and Run.

https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/approving-workflow-runs-from-public-forks

@@ -90,7 +90,7 @@ jesse_run(JsonInstance, Schema, Schemata) ->
{ok, _} = application:ensure_all_started(jesse),
ok = add_schemata(Schemata),
{ok, JsonInstanceBinary} = file:read_file(JsonInstance),
JsonInstanceJsx = jsx:decode(JsonInstanceBinary, [{return_maps, false}]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be an ok change, and I don't have all the details in my head at this very moment, but why did you decide to remove return_maps=false ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there's the "no macros in dynamic calls" to fix (see the CI run), and I guess the solution will be to create a function for encapsulation, maybe we just keep the return_maps=false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it because json does not support it, and I followed the logic and manually verified it is not needed (anymore) 🤔

That CI error, huh, elvis. Will fix 👌🏽

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a fix :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, made a typo on the fix, pushed again 😅

@NelsonVides
Copy link
Contributor Author

@andreineculau any updates on this one? 😇

Copy link
Member

@andreineculau andreineculau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your patience and for the reminder.
CI is green 💪
I left some suggestions which are just the beard talking. I wait briefly for your reply, and then merge and schedule a version

Thank YOU!

rebar.config Outdated
@@ -1,5 +1,5 @@
%%-*- mode: erlang -*-
{profiles, [{test, [{deps, [{ proper, "1.4.0"}]}]}]}.
{profiles, [{test, [{deps, [{jsx, "3.1.0"}, {proper, "1.4.0"}]}]}]}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{profiles, [{test, [{deps, [{jsx, "3.1.0"}, {proper, "1.4.0"}]}]}]}.
{profiles, [{test, [{deps, [{jsx, "3.1.0"}, {rfc3339, "0.9.0"}, {proper, "1.4.0"}]}]}]}.

-else.
%% OTP 26 to 21.
json_decode(Bin) ->
jsx:decode(Bin).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
jsx:decode(Bin).
jsx:decode(Bin, [{return_maps, false}).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm only afraid this will have suboptimal performance, but well, I guess that if performance is critical it can run an upgrade to OTP27, jsx was lagging behind long ago anyway :)

-else.
%% OTP 20 or lower.
json_decode(Bin) ->
jsx:decode(Bin).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
jsx:decode(Bin).
jsx:decode(Bin, [{return_maps, false}).

@NelsonVides
Copy link
Contributor Author

Thank you for your patience and for the reminder. CI is green 💪 I left some suggestions which are just the beard talking. I wait briefly for your reply, and then merge and schedule a version

Thank YOU!

Comments applied 💪🏽

Looking forward for a new version! 🙃

@andreineculau andreineculau merged commit 37fee73 into for-GET:master Sep 3, 2024
21 checks passed
@andreineculau
Copy link
Member

Published. Hope everything still works >_<

@NelsonVides NelsonVides deleted the slim_dependencies branch September 3, 2024 19:09
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

Successfully merging this pull request may close these issues.

3 participants