ModuleNotFoundError: No module named 'pkg_resources'

Describe the bug
After installing mdformat with pre-commit install, the first commit raises an error.
Relates to https://github.com/pre-commit/pre-commit/issues/2122
Reproduce the bug
Here's an error message I ran into with this configuration:
- repo: https://github.com/executablebooks/mdformat
  rev: 0.7.17
  hooks:
  - id: mdformat
    additional_dependencies:
    - mdformat-gfm  # use github flavor markdown
    - mdformat-black  # format python code block with black
    - mdformat-beautysh  # format bash code block with beautysh

$ pre-commit install
...
mdformat.................................................................Failed
- hook id: mdformat
- exit code: 1

Traceback (most recent call last):
  File "/home/vincent/.cache/pre-commit/repole_rylg8/py_env-python3.12/bin/mdformat", line 5, in <module>
    from mdformat.__main__ import run
  File "/home/vincent/.cache/pre-commit/repole_rylg8/py_env-python3.12/lib/python3.12/site-packages/mdformat/__init__.py", line 4, in <module>
    from mdformat._api import file, text
  File "/home/vincent/.cache/pre-commit/repole_rylg8/py_env-python3.12/lib/python3.12/site-packages/mdformat/_api.py", line 10, in <module>
    from mdformat._util import EMPTY_MAP, NULL_CTX, build_mdit, detect_newline_type
  File "/home/vincent/.cache/pre-commit/repole_rylg8/py_env-python3.12/lib/python3.12/site-packages/mdformat/_util.py", line 12, in <module>
    import mdformat.plugins
  File "/home/vincent/.cache/pre-commit/repole_rylg8/py_env-python3.12/lib/python3.12/site-packages/mdformat/plugins.py", line 20, in <module>
    CODEFORMATTERS: Mapping[str, Callable[[str, str], str]] = _load_codeformatters()
                                                              ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vincent/.cache/pre-commit/repole_rylg8/py_env-python3.12/lib/python3.12/site-packages/mdformat/plugins.py", line 17, in _load_codeformatters
    return {ep.name: ep.load() for ep in codeformatter_entrypoints}
                     ^^^^^^^^^
  File "/home/vincent/miniconda/envs/dotpy/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vincent/miniconda/envs/dotpy/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vincent/.cache/pre-commit/repole_rylg8/py_env-python3.12/lib/python3.12/site-packages/mdformat_beautysh/__init__.py", line 1, in <module>
    from beautysh import Beautify
  File "/home/vincent/.cache/pre-commit/repole_rylg8/py_env-python3.12/lib/python3.12/site-packages/beautysh/__init__.py", line 9, in <module>
    import pkg_resources  # part of setuptools
    ^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'pkg_resources'

List your environment
wsl
python 3.12.5

It seems to work if I add each additional dependencies one after the other (amending the commit each time).

Hi @vincentqb, the issue is actually with “beautysh” (https://github.com/lovesegfault/beautysh/issues/248). The current workaround is to add “setuptools” as a pre-commit dependency until beautysh is updated for Python 3.12

I'm closing, as mdformat (or mdformat-beautysh) isn't to blame here.


Feat/coverage badge

@JohnathonBowers,
The coverage badge badge is ready. I just need your review on the README.md, because I have some conflicts. Hope that this file is OK. I just added one line, which was the badge itself.
In terms of creating the badge, you just need to run npm run test. That command will generate the badge. I made some changes in the script, including moving all the config of jest into package.json.

These changes look good to me! As far as the README file, I looked through it. I don't know why the merge conflicts are showing up, since the only difference I see in the text is the addition of the coverage badge.

Perfect! So I didn't mess up with the README.md. That is good! I am proceeding to delete this branch!


Custom Messages file isn't included

Environment

Ember Version: 2.13.0
Ember CLI Version: 2.13.0
Ember CP Validations Version: 3.3.1

Steps to Reproduce
From the guides here: http://offirgolan.github.io/ember-cp-validations/docs/classes/Messages.html#tab_index
It seems that you could extend the default set of messages available to custom validations. Anything that extends validators/base should be able to return them by calling this.createErrorMessage('someCustomName', ...).
Since base looks up whatever is registered as validator:messages in the list of factories (https://github.com/offirgolan/ember-cp-validations/blob/master/addon/validators/base.js#L91), does any custom error messages object need to replace the default messages object?
So far, I could only get the custom messages to be included by doing something like this:
import BaseValidator from 'ember-cp-validations/validators/base';
import SomeCustomMessages from 'myapplication/validators/messages';

export default BaseValidator.extend({
  init() {
    this._super(...arguments);
    this.set('errorMessages', SomeCustomMessages.create());
  },

  validate() {
    return this.createErrorMessage('myCustomErrorMessage', ...);
  }
});

I might be misunderstanding the docs here.

If a file is created in myappdirectory/app/validators/messges, is it supposed to be automatically included/merged with the addon's messages object?
Is validators/base supposed to be re-opened to use the custom error messages object from my application?
Am I supposed to overwrite the entry in the app registry under validator:messages to use my extended object from the addon's validators/messages?

@gsilis here is an ember-twiddle. Hope that helps 😄

Thanks for the example. That cleared it up for me.


Other background color then white

I'm curious as to why this module forces the body  background to be white? And also being an inline styles, this takes precedence over any headCSS passed in. I have an email that has a full page blue  background, and I'm unable to edit this without editing the node_module.

Secondly, further investigation, shows that using the headCSS to overwrite the inline styles on these lines (see below), is fruitless, as gmail will just strip out the entire <style> block.
 <body bgcolor="#FFFFFF" width="100%" style="-webkit-font-smoothing: antialiased; width:100% !important; background:#FFFFFF;-webkit-text-size-adjust:none; margin:0; padding:0; min-width:100%">
          <table bgcolor="#FFFFFF" id="__bodyTable__" width="100%" style="-webkit-font-smoothing: antialiased; width:100% !important; background:#FFFFFF;-webkit-text-size-adjust:none; margin:0; padding:0; min-width:100%">

Just discovered the generateCustomTemplate function, my issues are resolved.

Glad you found a way for this to work! I realize the custom template function isn't documented anywhere, which should change. Created #51