PYTHON-1834 (cont) Add pre-commit config (#853)
This commit is contained in:
parent
5578999a90
commit
b7057ecf9f
2
.git-blame-ignore-revs
Normal file
2
.git-blame-ignore-revs
Normal file
@ -0,0 +1,2 @@
|
||||
# Initial pre-commit reformat
|
||||
5578999a90e439fbca06fc0ffc98f4d04e96f7b4
|
||||
12
.github/workflows/test-python.yml
vendored
12
.github/workflows/test-python.yml
vendored
@ -5,6 +5,18 @@ on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
|
||||
pre-commit:
|
||||
name: pre-commit
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: pre-commit/action@v2.0.0
|
||||
with:
|
||||
extra_args: --all-files --hook-stage=manual
|
||||
|
||||
build:
|
||||
# supercharge/mongodb-github-action requires containers so we don't test other platforms
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
31
.pre-commit-config.yaml
Normal file
31
.pre-commit-config.yaml
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v3.4.0
|
||||
hooks:
|
||||
- id: check-added-large-files
|
||||
- id: check-case-conflict
|
||||
- id: check-toml
|
||||
- id: check-yaml
|
||||
- id: debug-statements
|
||||
- id: end-of-file-fixer
|
||||
exclude: WHEEL
|
||||
exclude_types: [json]
|
||||
- id: forbid-new-submodules
|
||||
- id: trailing-whitespace
|
||||
exclude: .patch
|
||||
exclude_types: [json]
|
||||
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.1.0
|
||||
hooks:
|
||||
- id: black
|
||||
files: \.py$
|
||||
args: [--line-length=100]
|
||||
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.7.0
|
||||
hooks:
|
||||
- id: isort
|
||||
files: \.py$
|
||||
args: [--profile=black]
|
||||
@ -38,6 +38,23 @@ General Guidelines
|
||||
from the cmd line to run the test suite).
|
||||
- Add yourself to doc/contributors.rst :)
|
||||
|
||||
Running Linters
|
||||
---------------
|
||||
|
||||
PyMongo uses `pre-commit <https://pypi.org/project/pre-commit/>`_
|
||||
for managing linting of the codebase.
|
||||
``pre-commit`` performs various checks on all files in PyMongo and uses tools
|
||||
that help follow a consistent code style within the codebase.
|
||||
|
||||
To set up ``pre-commit`` locally, run::
|
||||
|
||||
pip install pre-commit
|
||||
pre-commit install
|
||||
|
||||
To run ``pre-commit`` manually, run::
|
||||
|
||||
pre-commit run --all-files
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
@ -67,4 +84,4 @@ The ``-b`` flag adds as a regex pattern to block files you do not wish to
|
||||
update in PyMongo.
|
||||
This is primarily helpful if you are implementing a new feature in PyMongo
|
||||
that has spec tests already implemented, or if you are attempting to
|
||||
validate new spec tests in PyMongo.
|
||||
validate new spec tests in PyMongo.
|
||||
|
||||
@ -94,4 +94,3 @@ supplied in this file in the creation of products supporting the
|
||||
Unicode Standard, and to make copies of this file in any form
|
||||
for internal or external distribution as long as this notice
|
||||
remains attached.
|
||||
|
||||
|
||||
@ -4,4 +4,4 @@
|
||||
|
||||
.. automodule:: pymongo.event_loggers
|
||||
:synopsis: A collection of simple listeners for monitoring driver events.
|
||||
:members:
|
||||
:members:
|
||||
|
||||
@ -7,4 +7,3 @@
|
||||
|
||||
.. autoclass:: pymongo.topology_description.TopologyDescription()
|
||||
:members:
|
||||
|
||||
|
||||
@ -41,4 +41,3 @@ Connections to Atlas require TLS/SSL.
|
||||
.. _homebrew: https://brew.sh/
|
||||
.. _macports: https://www.macports.org/
|
||||
.. _requests: https://pypi.python.org/pypi/requests
|
||||
|
||||
|
||||
@ -105,4 +105,4 @@ list of known hosts. As an example, for a 3-member replica set with a
|
||||
all available secondaries.
|
||||
|
||||
|
||||
.. _server selection algorithm: https://docs.mongodb.com/manual/core/read-preference-mechanics/
|
||||
.. _server selection algorithm: https://docs.mongodb.com/manual/core/read-preference-mechanics/
|
||||
|
||||
@ -950,4 +950,4 @@ Additional BSON classes implement ``__slots__``
|
||||
:class:`~bson.max_key.MaxKey`, :class:`~bson.timestamp.Timestamp`,
|
||||
:class:`~bson.regex.Regex`, and :class:`~bson.dbref.DBRef` now implement
|
||||
``__slots__`` to reduce memory usage. This means that their attributes are fixed, and new
|
||||
attributes cannot be added to the object at runtime.
|
||||
attributes cannot be added to the object at runtime.
|
||||
|
||||
@ -47,14 +47,14 @@ Humongolus
|
||||
possible. The code is available for download
|
||||
`at GitHub <https://github.com/entone/Humongolus>`_. Tutorials and usage
|
||||
examples are also available at GitHub.
|
||||
|
||||
|
||||
MincePy
|
||||
`MincePy <https://mincepy.readthedocs.io/en/latest/>`_ is an
|
||||
object-document mapper (ODM) designed to make any Python object storable
|
||||
and queryable in a MongoDB database. It is designed with machine learning
|
||||
and big-data computational and experimental science applications in mind
|
||||
but is entirely general and can be useful to anyone looking to organise,
|
||||
share, or process large amounts data with as little change to their current
|
||||
`MincePy <https://mincepy.readthedocs.io/en/latest/>`_ is an
|
||||
object-document mapper (ODM) designed to make any Python object storable
|
||||
and queryable in a MongoDB database. It is designed with machine learning
|
||||
and big-data computational and experimental science applications in mind
|
||||
but is entirely general and can be useful to anyone looking to organise,
|
||||
share, or process large amounts data with as little change to their current
|
||||
workflow as possible.
|
||||
|
||||
Ming
|
||||
@ -80,7 +80,7 @@ MotorEngine
|
||||
It implements the same modeling APIs to be data-portable, meaning that a
|
||||
model defined in MongoEngine can be read in MotorEngine. The source is
|
||||
`available on GitHub <http://github.com/heynemann/motorengine>`_.
|
||||
|
||||
|
||||
uMongo
|
||||
`uMongo <https://umongo.readthedocs.io/>`_ is a Python MongoDB ODM.
|
||||
Its inception comes from two needs: the lack of async ODM and the
|
||||
|
||||
@ -18,4 +18,4 @@ gT564CmvkUat8uXPz6olOCdwkMpJ9Sj62i0mpgXJdBfxKQ6TZ9yGz6m3jannjZpN
|
||||
LchB7xSAEWtqUgvNusq0dApJsf4n7jZ+oBZVaQw2+tzaMfaLqHgMwcu1FzA8UKCD
|
||||
sxCgIsZUs8DdxaD418Ot6nPfheOTqe24n+TTa+Z6O0W0QtnofJBx7tmAo1aEc57i
|
||||
77s89pfwIJetpIlhzNSMKurCAocFCJMJLAASJFuu6dyDvPo=
|
||||
-----END CERTIFICATE-----
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
Loading…
Reference in New Issue
Block a user