expose random seed
Description
Allows the user to access the random seed once it has been set via vsk.random_seed.
Checklist
- [x] feature/fix implemented
- [ ]
mypyreturns no error - [x] tests added/updated and
pytest --runslowsucceeds - [ ] documentation added/updated and building with no error (
make clean && make htmlindocs/) - [ ] examples added/updated
- [x] code formatting ok (
blackandisort)
mypy is reporting errors with numpy:
> mypy
C:\Users\ben\AppData\Local\pypoetry\Cache\virtualenvs\vsketch-1NFE3Dlf-py3.10\lib\site-packages\numpy\__init__.pyi:642: error: Positional-only parameters are only supported in Python 3.8 and greater
Found 1 error in 1 file (errors prevented further checking)
I don't really understand that error. I'm running 3.10 locally, as is CI.
Ah, looks like maybe python/mypy#13627 is the issue. The suggested fix is to downgrade python to 3.10.6, apparently.
I rebased onto current master and the mypy errors disappeared. I also added some simple docs to make it consistent with other properties. It doesn't seem to change the rendered docs, though.
@abey79 do you want me to add an example for this?
@bleything yeah an example would be great! I'm thinking some very simple placeholder random "art" and a footer with, e.g., the date and seed. This looks like something many would want to do.
As for the doc, yeah the properties are not showing up for some reason, I need to look into it (#322).
It would also be useful to add "Random numbers and seed" doc section just before "Perlin noise", with:
- short explanation of what the seed is and how it can be changed (UI, API)
- an example or two of the random functions, including reading back the seed
Cool, I'll take a look at that this weekend.
sorry for the delay! I rebased and added an example, will update the docs shortly.
okay, one last rebase and added docs. They seem to render fine. I'm not sure if the :attr:`Vsketch.random_seed` thing is correct or not... hopefully it'll automatically link to the right place once #322 is resolved, but let me know if you'd like me to take it out.
LGTM, great contrib, thanks 👍🏻
sorry for the delay! I rebased and added an example, will update the docs shortly.
No worries. We're all doing this for free :)