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 exercise generator #304

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

Adrien-LUDWIG
Copy link
Contributor

Seeing the number of exercises to implement for protein-translation, I saw big and started to port the Common Lisp exercise generator.

There are still things to change and clean, but I was able to generate the files for the protein-translation exercise.
I added TODOs inside the main file (racket_exercise_generator.py).
Especially, I think the generator should use the configlet instead of mimicking it when possible.

I think it would be interesting to try it against a few already-implemented exercises, especially to evaluate the tests' generation.

What do you think? 😄

@github-actions
Copy link

Hello. Thanks for opening a PR on Exercism. We are currently in a phase of our journey where we have paused community contributions to allow us to take a breather and redesign our community model. You can learn more in this blog post. As such, all issues and PRs in this repository are being automatically closed.

That doesn't mean we're not interested in your ideas, or that if you're stuck on something we don't want to help. The best place to discuss things is with our community on the Exercism Community Forum. You can use this link to copy this into a new topic there.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

@github-actions github-actions bot closed this Oct 30, 2023
@Adrien-LUDWIG
Copy link
Contributor Author

@BNAndras

Sorry for the faux manipulation of adding the binary-search exercise files again. 😅

@BNAndras BNAndras reopened this Oct 30, 2023
os.makedirs(docs)


def create_meta_config(exercise_name, prob_spec_exercise, author):
Copy link
Member

Choose a reason for hiding this comment

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

Skimming this but configlet sync —filepaths —metadata -uye <exercise-slug> would generate the config json so the only thing needed is update the author or contributor key

file.write("\n")


def create_instructions(exercise_name, prob_spec_exercise):
Copy link
Member

Choose a reason for hiding this comment

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

I’d rather have configlet sync the documents here to simplify the complexity.

)

# If so, add the definition of the helper function to test returned errors
if expect_errors:
Copy link
Member

Choose a reason for hiding this comment

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

I think we want to avoid checking exception messages because some students may use contracts instead so that won’t work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I based myself on collatz-conjecture-test.rkt.

I guess using exn:fail? is preferred then?

@BNAndras
Copy link
Member

BNAndras commented Oct 30, 2023

I was thinking about using Jinja templates like the Python track uses so the porter provides the templates needed to (re)create the stub, example, and tests. Would that work with what you had in mind?

@BNAndras
Copy link
Member

The reason I favor that approach is we can backport templates for already ported exercises and not break existing solutions.

@Adrien-LUDWIG
Copy link
Contributor Author

I never used Jinja, but I would be happy to look into it!

If it's not easily adaptable from what I did here, it's not a problem. Feel free to close this PR if you think it's not a good starting point.

It was more of a late day idea to "work less" to create the protein-translation exercise. 😄 But it gave me a good idea of how to transform the data from canonical-data.json into tests (and slug).

I'll try to take a look at the Python exercise generator after completing a few exercises for Hacktoberfest. 😉

@BNAndras
Copy link
Member

Draft PRs are works in progress so no need to close unless you want me to. It's useful to keep this open to document what's been done so far.

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