⚡️ Generate Plaintext Ballots in CLI
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Suggestion
Generate plaintext ballots with a given manifest to CLI. PlaintextBallot should be generated with a random set of data from the Manifest according to valid ballot_styles from the Manifest.
Possible Implementation
The CLI should take a particular number of ballots to create and a dedicated ballot_style as a string to allow creating a specific style.
Marking a ballot is the term for creating a plaintext ballot so a command like so makes sense.
Example:
eg mark-ballots 100 "ballot-style-1"
Anything else?
This should take advantage of the already existing BallotFactory.
It would be wise to boyscout this file where required.
https://github.com/microsoft/electionguard-python/blob/main/src/electionguard_tools/factories/ballot_factory.py
As a heads up, information about @composite can be seen here:
https://hypothesis.readthedocs.io/en/latest/data.html
Issue Analytics
- State:
- Created a year ago
- Comments:7 (5 by maintainers)

Top Related StackOverflow Question
@lprichar Thank you for the answers. The things that you have helped me with are really good for my learning and you’re not getting anything back, so I really appreciate your time. I’ve made a lot of progress in my understanding but not much tangible progress. I’m trying to learn more about how to generate ballots in the CLI using
poetry run. I have some free time today and I’m going to work on it quite a bit, but feel free to do what you need to do if it needs to get done.So sorry, I missed this @phershbe . That’s awesome that you’re learning so much. It is indeed a lot to learn, and it can’t be easy just looking through code. Let me start with your earlier questions.
Yes! The poetry run command executes the alias you mentioned that’s defined in the pyproject.toml file. That’s generally an implementation detail you don’t need to worry about though. If you’re planning on adding another command to the CLI you should start by creating a new command (like
@click.command("mark-ballots") def mark_ballots()) and registering it into Click insrc\electionguard_cli\start.py.It probably should, but that’s really just an optional convenience. More important is adding a new command to the CLI so you can invoke it at the command line like
poetry run eg mark-ballots.However, all that said I wanted to give you a heads up that the team may need this task implemented soon. How much progress have you made? So far that’s just a possibility, but depending on your progress that might mean you and I work together, or I pick up where you left off.