-
Notifications
You must be signed in to change notification settings - Fork 80
Simplify example to not use translate
requirement
#85
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that because I deleted config.py
and config_test.py
, we no longer have an example of >1 test per directory...I'm not sure how much we care about that.
Preserving config.py
was too complex imo. We already have an example of loading a resource
file, I really don't think we want to demonstrate that >1 time.
python_tests( | ||
name="tests", | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I very much prefer the style of keeping it on one-line. But tailor
generates it this way, so probably good to be consistent with that.
helloworld/greet/BUILD
Outdated
name="tests", | ||
) | ||
|
||
# This target teaches Pants about our JSON file, which allows for other targets to depend on it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# This target teaches Pants about our JSON file, which allows for other targets to depend on it. | |
# This target teaches Pants about our JSON file, which allows other targets to depend on it. |
# This target teaches Pants about our JSON file, which allows for other targets to depend on it. | ||
resources( | ||
name="translations", | ||
sources=["translations.json"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe glob *.json
? A bit shorter, and less fragile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 2.8, I will update this to use resource
instead of resources
Per pantsbuild/example-python#85, our example repos should be as simple as feasible so that users aren't distracted. Regex validation is a nifty feature, but it's not important to showing off Django.
As explained in #84, we think it's valuable for this example repository to be simple. In particular, we are demoing Pants itself, not the underlying code.
This simplifies the project to use our own hardcoded
translate.json
, rather than the much more robusttranslate
requirement. We still demonstrate the same thingstranslate
was showing for us:There's an added benefit that the repository is now much faster to build, especially on Apple Silicon where
lxml
must be compiled from source. Likewise, I no longer have to force Pants to use Py39+ for this to build on my M1! The default of 3.7+ now works.