Skip to content

Conversation

@iShelar
Copy link
Contributor

@iShelar iShelar commented Dec 18, 2025

adds a management command using Factory Boy to generate sample data for development.

Changes:
- add factory-boy to dev dependencies
- create core/factories.py with factories for models
- create generate_sample_data management command
- fix root_page() template tag returning None
- update README with sample data generation steps

image image

adds a management command using Factory Boy to generate sample data for development.

Changes:
    - add factory-boy to dev dependencies
    - create core/factories.py with factories for models
    - create generate_sample_data management command
    - fix root_page() template tag returning None
    - update README with sample data generation steps

Closes PythonIreland#81
@ArcaneIRE
Copy link
Member

Thanks Saurabh, I'll try to take a look at this today

Add the missing package information to `requirements/dev.txt`. They were included in `dev.in`
but had not yet been locked.

Also mentioned environment variable setup in the README, as that is a necessary step.

uv pip compile docs: [docs.astral.sh / Locking Environments](https://docs.astral.sh/uv/pip/compile/)
This package was removed due to the addition of a new similar package,
but there are still test dependencies on it. For now, this commit adds
the package back.

Note: this package seems to be deprecated due to a naming issue, we may
consider switching to model-bakery. [link](https://pypi.org/project/model-mommy/)
@ArcaneIRE
Copy link
Member

ArcaneIRE commented Dec 22, 2025

When pulling this locally to verify, I ran into an error while following the docker instructions. While you correctly added the new package to requirements/dev.in, you also need to lock the package versions into requirements/dev.txt, which is where the dockerfile pulls the dependencies from. Note there is a task for this: dependencies:upgrade:package

RUN --mount=type=cache,target=/root/.cache \
    pip install -U pip uv ruff && \
    python -m uv pip install \
      -r requirements/main.txt \
      -r requirements/dev.txt \
      -r requirements/production.txt aws

After I made that change, I pushed the commit here - which immediately failed tests! I didn't know we had tests! It also turns out the removed model_mommy package is still used by some tests, so I've added that back for now. I guess we'll squash merge :p

Otherwise, seems good! Thanks for making the change!

@ArcaneIRE ArcaneIRE merged commit c0c0428 into PythonIreland:master Dec 22, 2025
1 check passed
@iShelar
Copy link
Contributor Author

iShelar commented Dec 27, 2025

Hi @ArcaneIRE Thanks a lot for the detailed review and for fixing the dependency locking and model_mommy issues, that was really helpful. I’ve learned a bit more about the project’s tooling and tests from this, and I’ll keep it in mind for future contributions.

@ArcaneIRE
Copy link
Member

Thanks a lot for the detailed review and for fixing the dependency locking and model_mommy issues, that was really helpful.

No problem!

I’ve learned a bit more about the project’s tooling and tests from this, and I’ll keep it in mind for future contributions.

Same here!

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