-
Notifications
You must be signed in to change notification settings - Fork 6
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
Install yamllint
and the Python libraries used for code linting and formatting for developers
#202
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.
👍
mypy
for developersmypy
and yamllint
for developers
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.
👍 👍
mypy
and yamllint
for developersmypy
, yamllint
, and black
for developers
This is useful because our Molecule test suites are all written in Python, and we use these tools for Python code formatting. Including these tools in the virtual environment for developers will allow their editors automatically format Python code. It also allows developers to run the tools manually if they wish to do so. This would be even more useful if pytest-testinfra were types, but that is not yet the case. See pytest-dev/pytest-testinfra#619 for more details about that.
This is useful because there are a lot of YML files in an Ansible role. Including yamllint in the virtual environment for developers will allow their editors to syntax-check these files.
e115ece
to
659f26a
Compare
Now that I've created this PR, I think that cisagov/skeleton-generic might be a better home for these changes. What do you think @cisagov/vm-dev? |
mypy
, yamllint
, and black
for developersyamllint
and the Python libraries used for code linting and formatting for developers
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 don't really understand the heavy overlap with our pre-commit
configuration here. All of these tools (exceptingmypy
) can just as effectively be run using pre-commit run --all-files
, more specifically pre-commit run <hook name> --all-files
, or with pre-commit
installed as a git hook it will be run on commit. mypy
is a separate case because of how it interacts when living in a Python venv, but everything else would potentially conflict with our pre-commit
configuration since there is no version pinning happening here.
You raise a good point. In the interest of documenting the intent behind this PR, these are the types of problems I was trying to solve:
I will handle these dependencies locally. I thought this addition might be useful for others, but I can see that it would cause headaches. |
🗣 Description
This pull request installs
yamllint
and the Python libraries we use for code linting and formatting.💭 Motivation and context
We can expect developers to install non-Python tools locally via their system's package manager, but the Python-based tools are a different case. We provide
requirements*.txt
files to encourage developers to set up a local Python virtual environment (venv), and many editors will make use of that venv when performing syntax checking and the like. It therefore makes sense to go ahead and include inrequirements-dev.txt
any Python tools that we use for formatting and linting of code.yamllint
is useful because there are a lot of YML files in an Ansible role. Includingyamllint
in the virtual environment for developers will allow their editors to syntax-check these files.(Note that installing
mypy
would be even more useful ifpytest-testinfra
were typed, but that is not yet the case. See pytest-dev/pytest-testinfra#619 for more details about that.)I noticed that my editor was complaining about trying to use
mypy
to provide more information but not finding it available, and I verified that installing it in my venv made that complaint go away. That's what started this whole PR effort.🧪 Testing
All automated tests pass. I noticed that my editor was complaining about trying to use
mypy
andyamllint
to provide more information but not finding them available, and I verified that installing them in my venv made the complaints go away.✅ Pre-approval checklist