Commit Graph

230 Commits

Author SHA1 Message Date
Denis Merigoux
efd175a390 Remove from scripts 2023-09-13 16:16:48 +02:00
Louis Gesbert
b5baa91a2e Add (half-baked) test on module usage
Half-baked because clerk doesn't know to order the tests properly at the moment,
and we spit compiled files into the source test directory.
2023-08-31 18:31:48 +02:00
Louis Gesbert
9bac045d03 Implement module lookups for scopes, structs, and enums 2023-08-31 17:54:39 +02:00
Louis Gesbert
0f9ee2c72e Refacter the main Driver module
- Use separate functions for successive passes in module `Driver.Passes`
- Use other functions for end results printing in module `Driver.Commands`

As a consequence, it is much more flexible to use by plugins or libs and we no
longer need the complex polymorphic variant parameter.

This patch leverages previous changes to use Cmdliner subcommands and
effectively specialises the flags of each Catala subcommand.

Other changes include:

- an attempt to normalise the generic options and reduce the number of global
  references. Some are ok, like `debug` ; some would better be further cleaned up,
  e.g. the ones used by Proof backend were moved to a `Proof.globals` module and
  need discussion. The printer no longer relies on the global languages and prints
  money amounts in an agnostic way.
- the plugin directory is automatically guessed and loaded even in dev setups.
  Plugins are shown by the main `catala` command and listed in `catala --help`
- exception catching at the toplevel has been refactored a bit as well; return
  codes are normalised to follow the manpage and avoid codes >= 128 that are
  generally reserved for shells.

Update tests
2023-07-03 16:42:54 +02:00
Denis Merigoux
71ead0c6fa
Remove all mentions 2023-06-19 12:01:06 +02:00
Emile Rolley
1d9388a339 feat(french_law/js): add a ReScript wrapper for french_law.js 2023-05-07 15:13:22 +02:00
Louis Gesbert
ebf957008d Makefile: loading venv is no longer required for most rules 2023-03-14 17:35:22 +01:00
Louis Gesbert
7914d9aaef Build: enforce "release" profile for website-assets
but make sure to keep a consistent dune profile otherwise for `make all`,
avoiding multiple rebuilds.

This saves 30s CPU time on a `make all` that doesn't specify
`DUNE_PROFILE=release`
2023-03-14 13:49:50 +01:00
Denis Merigoux
283d82bfce
French law JS must be created with a dune release profile 2023-03-14 11:53:27 +01:00
Louis Gesbert
2d0019101a Makefile: add shortcut to build the cheat-sheet
useful to avoid having to manually activate the python venv
2023-03-02 16:24:53 +01:00
Louis Gesbert
cf2e80ba51 Refactor Python dependency handling
* Use the newer "pyproject.toml" for syntax highlighters
* Use venv for everything (previously, the pygment lexers were installed
  globally, but more recent Python releases frown upon that. This will probably
  be more stable in the long run...)
* Use one venv at the root of the project (`_python_venv/`) for both
  pygments and the runtime
* Initialise this venv automatically from the Makefile (it should no longer be
  necessary to run scattered `set_up.sh` scripts with mysterious interactions)

On the downsides, though:
* Only tested with Python 3.11 at the moment
* Need to remember to activate the venv (`. _python_venv/bin/activate`) from the
  root for e.g. HTML literate output to work. A more manageable solution could
  be for Catala to provide the lexers on-the-fly when calling `pygmentize`.
2023-03-02 16:24:53 +01:00
Louis Gesbert
c393dfb75e CI improvements attempt
- fix dune compilation options: ensure both no dev failure on warnings and CI
  failure on warnings (the defaults do neither of those things !)

- attempt to publish the build artifacts to github-pages, so that they could be
  made more easily available and we could maybe remove the ones that are still
  there from the main repo
2023-02-28 17:55:34 +01:00
Denis Merigoux
76d5e44685
More man pages 2023-01-04 17:34:09 +01:00
Louis Gesbert
5a553149ff Makefile: ensure compiler is up-to-date when running tests 2022-10-04 14:50:37 +02:00
Denis Merigoux
6e64f769a0
Update assets and rename executable 2022-09-08 15:16:39 +02:00
Denis Merigoux
1990b0b970
Code compiles 2022-09-06 17:25:57 +02:00
Denis Merigoux
5bddde1c68
Fix documentation and test invocation 2022-08-30 13:48:20 +02:00
Denis Merigoux
c71b8e28c6
Moving parameters into property-section of data 2022-08-12 11:16:52 +02:00
Denis Merigoux
da06bedaca
Fix HTML line numbers 2022-08-11 16:15:52 +02:00
Louis Gesbert
3ee6fdb254 Automate artifact generation 2022-08-03 22:42:56 +02:00
Louis Gesbert
289975ebe8 Generate french law python artifacts through dune
(they're no longer reformatted, at the moment, though)
2022-08-03 19:04:14 +02:00
Louis Gesbert
c964495c59 Generate website assets through dune 2022-08-03 19:04:13 +02:00
Louis Gesbert
21ac1afa6e Makefile: friendly message about python virtual env 2022-08-03 18:55:42 +02:00
Louis Gesbert
55fcf416a3 Enforce dune profile to 'release' in Makefile
Dune has 2 default build profiles: `dev` and `release`, which change things like warnings-as-errors, and debug in jsoo build mode.

We need to be in release mode when we generate the javascript artifacts (e.g. `make website-assets`), so the master `Makefile` had `--profile=release` for the `dune` commands building them. However, that rebuilds _the whole tree of dependencies_ in release mode, which means `make all` might rebuild everything several times, as the `release` flag is turned off and on. I had conflicting plugins that weren't rebuilt with the correct flag. And let's not imagine the `make -j` case…

This is the best solution I can think of for the time being:
- set the Makefile to use dune's `release` profile by default
- this ensure consistency and avoids surprises with e.g. bad (slower) artifacts
  generated for the website
- devs can use `dune` directly when working, or set `DUNE_PROFILE` manually if
  they need it

I am not sure yet about CI, though, since we want warnings-as-errors but also
useful artifacts. Might best to build twice…
2022-08-03 18:55:42 +02:00
Louis Gesbert
9db038812c Include generation of json_schema artifacts
(plus other small Makefile improvements)
2022-08-03 18:55:42 +02:00
Louis Gesbert
0600501ec6 Generate french_law artifacts through dune
The files where manually generated through Makefile rules, and
versionned (with an outdated version).

The issue was that we had:
- `dune` building Catala
- Makefiles calling `catala` to build and copy the `french_law/ocaml/law_source`
  files
- then `dune` again to build `french_law`

The result was that `dune build` (without running `make` first) would
return a weird error.

The proposed solution adds ad-hoc dune rules to call the catala
binary, so that it can handle the whole pipeline correctly. If OCaml
is purely a backend, though, a simpler solution that makes us less
dependent on dune would be to handle the compilation of `french_law`
manually.

The dune rules are set to 'promote' the files so that it preserves the
fact that they are versionned (but with no confusion of the build system
about where they should come from anymore)
2022-08-03 18:55:42 +02:00
Denis Merigoux
fa9d47254e
Don't use filenames in Makefile when you don't generate the files 2022-07-29 18:56:49 +02:00
Emile Rolley
1a6934b538 feat(build): add the generation of json schemas to the build workflow 2022-07-29 18:47:42 +02:00
Emile Rolley
26663f227d fix(plugins/web): fix enum payload + retrieve all required types 2022-07-29 18:42:47 +02:00
Denis Merigoux
4845196b5b Add source positions in all backends exceptions 2022-07-29 18:42:14 +02:00
Denis Merigoux
fa36fb0df1 Housing benefits extract to Python and compute 2022-07-28 15:02:43 +02:00
Denis Merigoux
8d3e283669 Fix some bugs of JSOO plugin 2022-07-28 15:02:43 +02:00
Denis Merigoux
aa3820c2a7
Nitpicks 2022-07-22 17:42:24 +02:00
Emile Rolley
d9045499c0 refactor(french_law/ocaml): refactor the api_web.ml 2022-07-22 17:01:33 +02:00
Denis Merigoux
0304602433 Trying to fix Bindlib unboxing bug [skip ci] 2022-07-22 12:31:05 +02:00
Denis Merigoux
5bcee7ceba
Correctly generate HTML output 2022-07-20 15:35:26 +02:00
Louis Gesbert
39139816ff Use groff directly instead of man2html 2022-07-20 12:05:19 +02:00
Louis Gesbert
dfccf8e139 Run all CI tests through a Docker container
Also reworks some dependency handling
2022-07-20 12:05:17 +02:00
Louis Gesbert
b8e73ab3ae Tweak build/ci 2022-07-11 17:42:34 +02:00
Louis Gesbert
504f54c31e Rework type error reporting 2022-07-11 17:42:34 +02:00
Louis Gesbert
d2a182043b Update doc for handling tests 2022-07-11 16:03:47 +02:00
Denis Merigoux
bdbf202a8d
Minimal implementation of https://github.com/CatalaLang/catala/issues/192#issuecomment-1178750411 2022-07-08 14:10:25 +02:00
Denis Merigoux
5e45940e1b
Merge branch 'master' into allocations_logement 2022-07-06 16:43:14 +02:00
Denis Merigoux
ea6083d5a2
Disable optimisations for french_law.js because of #274 2022-07-04 12:14:21 +02:00
Emile Rolley
fb93be04dc fix: remove -s flag in the Makefile rule used to generate the french law library in OCaml 2022-06-16 17:30:33 +02:00
Louis Gesbert
30297b27b8 Add dune rule to build tests
This allows a new magic command: `dune test -w`
2022-05-25 18:33:20 +02:00
Louis Gesbert
56026e8e8d Pygments: install as user
Makefiles shouldn't sudo
2022-05-19 10:40:04 +02:00
Louis Gesbert
08c997142d CI: run builds from a clean repo 2022-05-19 10:40:04 +02:00
Louis Gesbert
5ae4393004 Add two demo backend plugins
- one that is just the same as the python backend
- one that is a quick'n'dirty call to js_of_ocaml on top of the ocaml backend to
  generate js files

Use `make plugins` to test them. They are only expected to be useful as
demonstrations of how to write plugins.
2022-05-19 10:40:04 +02:00
Emile Rolley
06717ecb19 build: add the js_build rule for the website-assets one in the Makefile 2022-05-19 10:03:05 +02:00