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 cabal-docspec to flake dependencies and include examples for most symbols #170

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

Conversation

MMesch
Copy link

@MMesch MMesch commented Jul 14, 2023

This adds cabal-docspec to the flake dependencies to start addressing https://github.com/VinylRecords/Vinyl/blob/master/vinyl.cabal#L96.

It's currently taken from the Nix user repo because it is not yet on hackage or nixpkgs.

Run with

nix develop
cabal-docspec

This is the current output summary:

[   0.60765] doctest.summary: 
Total:        77; Tried:   36; Skipped:   41; Success:   30; Errors:    6; Failures    0
Examples:     75; Tried:   34; Skipped:   41; Success:   28; Errors:    6; Failures    0
Setup:         2; Tried:    2; Skipped:    0; Success:    2; Errors:    0; Failures    0

I plan fixing the errors in subsequent PRs, but I thought it'd be nice to have cabal-docspec in already before because there seems to be no possibility to run doctests at the moment whatsoever. And also to keep PR size small.

MMesch added 2 commits July 14, 2023 12:20
Currently from the Nix user repo because it is not yet on hackage or
nixpkgs
@MMesch MMesch force-pushed the mmesch/cabal-docspec branch from bf5e14c to bd88680 Compare July 15, 2023 08:35
@MMesch
Copy link
Author

MMesch commented Jul 15, 2023

I am working now on this branch but maybe it'd be better to split the PR up. @acowley let me know what you would prefer. Also, I really don't know what the best solution is to make the Tutorial pass doctests without adding a global dependency on singletons which is a bit annoying.

@acowley
Copy link
Contributor

acowley commented Jul 15, 2023

How would you split it up?

MMesch added 2 commits July 16, 2023 11:12
Unfortunately this requires introducing singletons as dependencies.
I don't know how to best solve this.
@MMesch MMesch force-pushed the mmesch/cabal-docspec branch from b0d45cc to 7bb7a30 Compare July 16, 2023 09:13
@MMesch
Copy link
Author

MMesch commented Jul 16, 2023

There are some simple changes such as fixing or adding doctests. And there are some like the singletons version bounds that may be more complex.

I pushed a new version with open version bounds but I'm unsure how to sustainably resolve this issue because it's a pity to add a dependency on the main library just for the tutorial. Maybe best would be to keep the tutorial just in tests and then link to it from the haddock page?

@MMesch MMesch force-pushed the mmesch/cabal-docspec branch from 811a702 to 84bbffa Compare July 16, 2023 09:51
@acowley
Copy link
Contributor

acowley commented Jul 16, 2023

That sounds reasonable regarding singletons. I agree that we should avoid making it a dependency of the library if possible.

@MMesch MMesch force-pushed the mmesch/cabal-docspec branch from 763b2b5 to b5a26df Compare July 17, 2023 17:52
@MMesch MMesch force-pushed the mmesch/cabal-docspec branch from 178761f to 7d294ae Compare July 17, 2023 18:04
@MMesch MMesch changed the title add cabal-docspec to flake dependencies add cabal-docspec to flake dependencies and include examples for most symbols Jul 31, 2023
@MMesch
Copy link
Author

MMesch commented Oct 28, 2023

@acowley I think I managed to run all examples, including the existing Tutorial through cabal-docspec without adding singletons as a library dependency (it is added through a dummy doctests target and then exposed through an extra field).

I think we could try activating it in CI but that's a bit difficult for me to do without access to it. In theory you should be able to run it with cabal-docspec in the base folder after building the code with cabal build all --enable-tests.


nurpkgs = import nur {
nurpkgs = nixpkgs.legacyPackages.x86_64-linux;
pkgs = nixpkgs.legacyPackages.x86_64-linux;
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't evaluate on aarch64 systems, and the cabal-docspec in nur seems be downloading a binary.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we build cabal-docspec as a normal Haskell package in our flake?

Copy link
Author

Choose a reason for hiding this comment

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

That may be possible. Not sure when I'll have the time to play around with that but it seems the easiest path forward. Too bad it isn't on hackage.

Copy link
Author

Choose a reason for hiding this comment

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

There is also this phadej/cabal-extras#134

@MMesch
Copy link
Author

MMesch commented Oct 29, 2023

@acowley , I investigated this a bit and unfortunately it seems more complex to get a cabal-docspec binary for Mac and Windows than what I have time for right now.

Wouldn't it be sufficient to just run the doctests on the Linux CI? As opposed to the build, I don't think testing the docs cross platform adds much extra value. And for development on mac, maybe the cabal-docspec Docker container works until there is a proper binary available?

@acowley
Copy link
Contributor

acowley commented Oct 29, 2023

Yes, running only in CI is definitely an option. I was going to take a look at a from source build of cabal-docspec, did anything in particular not work out when you looked at it or was it just a big pain?

@MMesch
Copy link
Author

MMesch commented Oct 29, 2023

Nothing in particular except for various general comments in the cabal-extras repo on the build process that may indicate complexity. But it's probably more because I'm not super experienced with the Nix Haskell infra, I fear I can't really debug any Macos or Windows builds, and I don't have enough headspace at the moment to dive into that 🙄. I want to mostly add documentation to vinyl and frames and maybe make some smaller improvements since I tried using those more actively recently.

I also wonder what the proper way forward is so that we don't duplicate effort that should find it's place upstream. But considering all options (eg hackage doesn't seem to be in sight), I think writing a cross platform flake for cabal-extras seems like the most reasonable thing to do.

@acowley
Copy link
Contributor

acowley commented Oct 30, 2023

Wow, cabal-extras is pretty deeply idiosyncratic. I'm not sure if it's worth trying to make its individual parts look more like normal packages. Definitely open to the CI-only solution.

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.

2 participants