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

Add lib.rs so difftastic can be used as a library (& serde) #231

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

anchpop
Copy link

@anchpop anchpop commented Apr 3, 2022

Sorry for mixing two changes together like this.

  1. I'm trying to use difftastic for one of my own project, but I needed it as a library, so I added a lib.rs and moved some relevant functionality to it. main.rs works as before.
  2. I also needed Serialize and Deserialize on DiffResult so I added that too.

@anchpop anchpop force-pushed the librs branch 2 times, most recently from 5cee347 to 3787240 Compare April 3, 2022 05:21
@petr-tik
Copy link

petr-tik commented Apr 5, 2022

looks related to the issue I opened a week ago
#216

@cherryblossom000
Copy link
Contributor

Maybe add an optional feature that can be enabled for serde support so that most users don't have to build serde and its dependencies when compiling the binary

@anchpop
Copy link
Author

anchpop commented Apr 19, 2022

@petr-tik hope it helps. I'm curious what you're using difftastic for. (Until this gets merged, you can always depend on my repo).
@cherryblossom000 that's a good idea. I'm not too sure how to use cargo features though, so it may be a small wait until I implement that

@luanraithz
Copy link

I also have a use case for using this as a library, is this PR dead?

@jzeimen
Copy link

jzeimen commented Nov 29, 2022

Same here, I also need the library use case. Anything we can do to help get this done @Wilfred ? Happy to help, but want to know what we need to do to get this over the line besides re-basing.

The use-case is to be able to pass 2 strings representing LHS and RHS files, get the results back to know what lines have changed and what parts of the lines are novel w/ start and end position. Then act on certain scenarios programatically. This avoids writing to disk and parsing the existing CLI output.

There's also the use-case for json output in PR #158. These seem related. The library method and json should have the same output shape. That one is close but didn't tell me which tokens were novel, locally I added it and it works but this library scenario would be much better.

Wilfred pushed a commit that referenced this pull request Jun 13, 2023
Add complexity check to smoke_test.sh
@brurucy
Copy link

brurucy commented Jul 21, 2023

Any updates on this?

@wongjiahau
Copy link

I'm also looking to integrate difftastic into my editor

@brurucy
Copy link

brurucy commented Aug 5, 2023

@Wilfred sorry to tag you here :) but it would be immensely useful to more than one person if this could be done.

@the-moog the-moog mentioned this pull request Oct 21, 2023
@CHE1RON
Copy link

CHE1RON commented Nov 12, 2023

Since it's been a while now, maybe @anchpop and @Wilfred can come together and have a look at this? 🤔 It would be much appreciated if this makes it into the library!

@leontrolski
Copy link

I'd also like to wrap difftastic with pyo3 (similar Python libs in this space are pretty slow)

@Wilfred Wilfred closed this in bf4331c Feb 13, 2024
@wongjiahau
Copy link

It seems like the issue was mistakenly closed by bf4331c, perhaps due to a typo of #231 in the commit message?

@Wilfred Wilfred reopened this Feb 14, 2024
@greg-kinasa
Copy link

Would like to see this too.

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.