Skip to content

Commit

Permalink
Add checking typos to pre-commit (#3278)
Browse files Browse the repository at this point in the history
* Add checking typos to pre-commit

* Add missed corrections

* Add more corrections to doc
  • Loading branch information
Hind-M authored May 27, 2024
1 parent 9006fb9 commit 3e1e97b
Show file tree
Hide file tree
Showing 123 changed files with 391 additions and 373 deletions.
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ repos:
rev: v0.6.13
hooks:
- id: cmake-format
- repo: https://github.com/Quantco/pre-commit-mirrors-typos
rev: 1.20.8
hooks:
- id: typos-conda
exclude: (CHANGELOG.md)
# In case of ambiguity (multiple possible corrections), `typos` will just report it to the user and move on without applying/writing any changes.
# cf. https://github.com/crate-ci/typos
args: [ --write-changes ]
4 changes: 2 additions & 2 deletions Taskfile.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ tasks:
desc: Regenerate libmambapy typing stubs.
summary: |
Regenerate the stub `*.pyi` stubs files providing Python typing information.
If this command creates any changes, the modifications needs to be commited.
If this command creates any changes, the modifications needs to be committed.
deps: [install-py]
cmds:
- '{{.TEST_RUN}} python -m pybind11_stubgen -o "{{.BUILD_DIR}}/stubs" libmambapy.core.bindings'
Expand Down Expand Up @@ -315,7 +315,7 @@ tasks:
clean:
desc: Remove files generated by Task commands.
summary: |
Remove files generated by Task commnds. Some files and folder generated by tools may still
Remove files generated by Task commands. Some files and folder generated by tools may still
remain. To entirely clean the repository, run:
git clean -xdn
Expand Down
7 changes: 7 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[default.extend-words]
# False positives to ignore
eit = "eit"
pn = "pn"
Ome = "Ome"
haa = "haa"
"fo" = "fo"
4 changes: 2 additions & 2 deletions cmake/CompilerWarnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function(mamba_target_add_compile_warnings target)
/external:W1
# Baseline reasonable warnings
/W4
# "identfier": conversion from "type1" to "type1", possible loss of data
# "identifier": conversion from "type1" to "type1", possible loss of data
/w14242
# "operator": conversion from "type1:field_bits" to "type2:field_bits", possible loss of
# data
Expand Down Expand Up @@ -117,7 +117,7 @@ function(mamba_target_add_compile_warnings target)
set(
gcc_warnings
${clang_warnings}
# Warn if identation implies blocks where blocks do not exist
# Warn if indentation implies blocks where blocks do not exist
-Wmisleading-indentation
# Warn if if / else chain has duplicated conditions
-Wduplicated-cond
Expand Down
2 changes: 1 addition & 1 deletion cmake/LinkTimeOptimization.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include(CheckIPOSupported)

# Detect is setting Link Time Optimization is recommended.
#
# Currenlty checks if LTO is supported and if the build is a release.
# Currently checks if LTO is supported and if the build is a release.
function(mamba_should_lto)
# Names of option parameters (without arguments)
set(options)
Expand Down
2 changes: 1 addition & 1 deletion dev/CMakePresetsMamba.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
},
"description": "Extra convenience flags used when developping",
"description": "Extra convenience flags used when developing",
"displayName": "Mamba Dev",
"hidden": true,
"name": "mamba-dev",
Expand Down
12 changes: 6 additions & 6 deletions docs/source/advanced_usage/more_concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ In the Mamba's context, it may points to a packages server, a :ref:`channel<chan
Channel
-------

| A ``channel`` is an independant and isolated :ref:`repo<repo>` structure that is used to classify and administrate more easily a packages server.
| A ``channel`` is an independent and isolated :ref:`repo<repo>` structure that is used to classify and administrate more easily a packages server.
.. note::
A packages server may host one or multiple ``channels``.
Expand All @@ -39,7 +39,7 @@ Subdir

| A ``subdir`` is a :ref:`channel<channel>` subdirectory specific to a given operating system/platform pair.
Mamba is a general purpose, langage agnostic package manager. The ``subdir`` structure is a convenient way to provide and access packages depending on the targeted os and platform.
Mamba is a general purpose, language agnostic package manager. The ``subdir`` structure is a convenient way to provide and access packages depending on the targeted os and platform.

Typically ``linux-64``, ``osx-arm64`` or ``win-64`` but not limited to those ones.

Expand Down Expand Up @@ -96,7 +96,7 @@ The 3 kinds of *links* are:
The advanced user may want to change that behavior using configuration (see the relevant CLI or API reference for more details):

- allow ``soft-links`` to be used as a prefered fallback to ``copy`` (try to ``copy`` if ``soft-link`` fails)
- allow ``soft-links`` to be used as a preferred fallback to ``copy`` (try to ``copy`` if ``soft-link`` fails)
- use ``soft-links`` instead of ``hard-links`` as default behavior (``copy`` is still a fallback)
- always ``copy`` instead of ``hard-links`` as default behavior (no fallback then)

Expand All @@ -110,7 +110,7 @@ Hard-link
*********

| A ``hard-link`` is the relation between a name/path and the actual file located on the file system.
| It is often used to describe additional ``hard-links`` pointed the same file, but the ownership of the file is shared accross all those links (equivalent to a C++ shared pointer):
| It is often used to describe additional ``hard-links`` pointed the same file, but the ownership of the file is shared across all those links (equivalent to a C++ shared pointer):
- a reference counter is incremented when creating a new ``hard-link``, decremented when deleting one
- the file system location is freed only when that counter decreases to 0
Expand All @@ -133,7 +133,7 @@ This is the most efficient way to link:
There are some limitations to use ``hard-links``:

- all the file systems are not supporting such links
- those links are not working accross file systems/partitions
- those links are not working across file systems/partitions


.. _soft_link:
Expand All @@ -145,7 +145,7 @@ Soft-link
It is as efficient as a ``hard-link`` but has different properties:

- works accross a filesystem/partition boundaries
- works across a filesystem/partition boundaries
- becomes invalid then the pointed name is deleted or moved (no shared ownership)


Expand Down
2 changes: 1 addition & 1 deletion docs/source/advanced_usage/package_resolution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ For this example the default is the cpython build of numpy. However, currently c

For the case where we want to simply install ``numpy``, we need to find which numpy variant installs the highest python package. In this case libsolv would decide for ``numpy-1.20-cpython38``.

If we install ``numpy python=3.7`` we have two potential variants: ``numpy-1.20-cpython37`` and ``numpy-1.20-pypy37``. In this case we need to inspect wether one of those two builds will require exclusively packages with a track_feature applied. And indeed, the ``pypy37`` package will have a requirement on ``python_abi 3.7 *pypy`` and **all** packages matching this requirement have a track_feature, so that it will be down-weighted.
If we install ``numpy python=3.7`` we have two potential variants: ``numpy-1.20-cpython37`` and ``numpy-1.20-pypy37``. In this case we need to inspect whether one of those two builds will require exclusively packages with a track_feature applied. And indeed, the ``pypy37`` package will have a requirement on ``python_abi 3.7 *pypy`` and **all** packages matching this requirement have a track_feature, so that it will be down-weighted.
24 changes: 12 additions & 12 deletions docs/source/developer_zone/changes-2.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ It now presents the same user interface and experience as ``micromamba``.

Micromamba
**********
Micromamba recieves all new features and its CLI remains mostly unchanged.
Micromamba receives all new features and its CLI remains mostly unchanged.

Breaking changes include:

Expand All @@ -51,15 +51,15 @@ All code previously available in Python through ``import mamba`` has been remove

Libmambapy (Python bindings)
****************************
The Python bindings to the C++ ``libamamba`` library remain available through ``import libmambapy``.
The Python bindings to the C++ ``libmamba`` library remain available through ``import libmambapy``.
They are now considered the first class citizen to using Mamba in Python.
Changes inlcude:
Changes include:

- The global ``Context``, previously available through ``Context()``, must now be accessed through
``Context.instance()``.
What's more, it is required to be passed explicitly in a few more functions.
Future version of ``libmambapy`` will continue in this direction until there are no global context.
In version 2, ``Context()`` will throw an exception to avoid hard to catch errors.
In version 2, ``Context()`` will throw an exception to allow catching errors more smoothly.
- ``ChannelContext`` is no longer an implicit global variable.
It must be constructed with one of ``ChannelContext.make_simple`` or
``ChannelContext.make_conda_compatible`` (with ``Context.instance`` as argument in most cases)
Expand All @@ -81,11 +81,11 @@ Changes inlcude:
A usage documentation page is available at :ref:`mamba_usage_solver`.

- The redesign of the ``Pool``, which is now available as ``libmambapy.solver.libsolv.Database``.
The new interfaces makes it easier to create repositories without using other ``libmambapy``
The new interfaces make it easier to create repositories without using other ``libmambapy``
objects.
- ``Repo`` has been redesigned into a lightweight ``RepoInfo`` and moved to
``libmambapy.solver.libsolv``.
The creation and modification of repos happens through the ``Database``, with methods such as
The creation and modification of repos happen through the ``Database``, with methods such as
``Database.add_repo_from_repodata_json`` and ``Database.add_repo_from_packages``, but also
high-level free functions such as ``load_subdir_in_database`` and
``load_installed_packages_in_database``.
Expand All @@ -96,7 +96,7 @@ Changes inlcude:
``libmambapy.solver.libsolv.Unsolvable`` state from which rich error messages can be
extracted.

For many changes, an exception throwing placeholder has ben kept to advise developpers on the new
For many changes, an exception throwing placeholders has been kept to advise developers on the new
direction to take.

Libmamba (C++)
Expand All @@ -105,16 +105,16 @@ The C++ library ``libmamba`` has received significant changes.
Due to the low usage of the C++ interface, all changes are not listed here.
The main changes are:

- Refactoring and testing of a large number of utilities into a ``util::`` namespace,
- Creation of the ``specs::`` the items below.
- Refactoring and testing of a large number of utilities into a ``util::`` namespace.
- Creation of ``specs::`` including the items below.
A usage documentation (in Python) is available at :ref:`mamba_usage_specs`.

- Implementations of ``Version`` and ``VersionSpec`` for matching versions,
- A refactoring of a purely funcitonal ``Channel`` class,
- Implementaiton of a ``UnresolvedChannel`` to describe unresolved ``Channels``,
- A refactoring of a purely functional ``Channel`` class,
- Implementation of a ``UnresolvedChannel`` to describe unresolved ``Channels``,
- A refactored and complete implementation of ``MatchSpec`` using the components above.

- A cleanup of ``ChannelContext`` for be a light proxy and parameter holder wrapping the
- A cleanup of ``ChannelContext`` to be a light proxy and parameter holder wrapping the
``specs::Channel``.
- A new ``repodata.json`` parser using `simdjson <https://simdjson.org/>`_.
- The ``MPool``, ``MRepo`` and ``MSolver`` API has been completely redesigned into a ``solver``
Expand Down
2 changes: 1 addition & 1 deletion docs/source/developer_zone/internals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ Watches
The possible decisions on solvables are ``installation`` or ``removal``/``conflict``, this is stored as resp. positive and negative Ids.

Related rules are then evaluated during another level of decision: those are the one with an opposite first litteral.
Related rules are then evaluated during another level of decision: those are the one with an opposite first literal.

Example:

Expand Down
2 changes: 1 addition & 1 deletion docs/source/installation/micromamba-installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Build from source

.. note::

These instuction do not work currently on Windows, which requires a more complex hybrid build.
These instructions do not work currently on Windows, which requires a more complex hybrid build.
For up-to-date instructions on Windows and Unix, consult the scripts in the
`micromamba-feedstock <https://github.com/conda-forge/micromamba-feedstock>`_.

Expand Down
2 changes: 1 addition & 1 deletion docs/source/tools/mermaid.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Modified for the purpose of CoSApp by the CoSApp team
https://gitlab.com/cosapp/cosapp
Allow mermaid diagramas to be included in Sphinx-generated
Allow mermaid diagrams to be included in Sphinx-generated
documents inline.
:copyright: Copyright 2016 by Martín Gaitán and others, see AUTHORS.
Expand Down
28 changes: 14 additions & 14 deletions docs/source/usage/solver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Packages are organised in repositories, described by a
This serves to resolve explicit channel requirements or channel priority.
As such, the database constructor takes a set of
:cpp:type:`ChannelResolveParams <mamba::specs::ChannelResolveParams>`
to work with :cpp:type:`Channel <mamba::specs::Channel>` work with Channel data
internaly (see :ref:`the usage section on Channels <libmamba_usage_channel>` for more
to work with :cpp:type:`Channel <mamba::specs::Channel>` data
internally (see :ref:`the usage section on Channels <libmamba_usage_channel>` for more
information).

The first way to add a repository is from a list of |PackageInfo| using
Expand All @@ -55,10 +55,10 @@ The first way to add a repository is from a list of |PackageInfo| using
name="myrepo",
)
The second way of loading packages is throuch Conda's reposoitory index format ``repodata.json``
The second way of loading packages is through Conda's repository index format ``repodata.json``
using
:cpp:func:`DataBase.add_repo_from_repodata <mamba::solver::libsolv::Database::add_repo_from_repodata>`.
This is meant as a convenience and performant alternative to the former method, since these files
This is meant for convenience, and is not a performant alternative to the former method, since these files
grow large.

.. code:: python
Expand All @@ -68,9 +68,9 @@ grow large.
url="htts://conda.anaconda.org/conda-forge/linux-64",
)
One of the reppository can be set to have a special meaning of "installed repository".
One of the repositories can be set to have a special meaning of "installed repository".
It is used as a reference point in the solver to compute changes.
For instance if a package is required but is already available in the installed repo, the solving
For instance, if a package is required but is already available in the installed repo, the solving
result will not mention it.
The function
:cpp:func:`DataBase.set_installed_repo <mamba::solver::libsolv::Database::set_installed_repo>` is
Expand All @@ -88,9 +88,9 @@ such as source url and
:cpp:type:`RepodataOrigin <mamba::solver::libsolv::RepodataOrigin>`, are stored inside the
file when calling
:cpp:func:`DataBase.native_serialize_repo <mamba::solver::libsolv::Database::native_serialize_repo>` .
Upon reading, similar parameters are expected as input to
Upon reading, similar parameters are expected as inputs to
:cpp:func:`DataBase.add_repo_from_native_serialization <mamba::solver::libsolv::Database::add_repo_from_native_serialization>`.
If they mistmatch, the loading results in an error.
If they mismatch, the loading results in an error.

A typical wokflow first tries to load a repository from such binary cache, and then quietly
fallbacks to ``repodata.json`` on failure.
Expand Down Expand Up @@ -120,7 +120,7 @@ This includes installing, updating, removing packages, as well as solving cutomi
Solving the request
-------------------
The |Request| and the |Database| are the two input parameters needed to solve an environment.
This task is achieve with the :cpp:func:`Solver.solve <mamba::solver::libsolv::Solver::solve>`
This task is achieved with the :cpp:func:`Solver.solve <mamba::solver::libsolv::Solver::solve>`
method.

.. code:: python
Expand All @@ -129,8 +129,8 @@ method.
outcome = solver.solve(db, request)
The outcome can be of two types, either a |Solution| listing packages (|Packageinfo|) and the
action to take on them (install, remove...), or an |UnSolvable| type when no solution exist
(because of conflict, missing pacakges...).
action to take on them (install, remove...), or an |UnSolvable| type when no solution exists
(because of conflict, missing packages...).

Examine the solution
~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -168,10 +168,10 @@ Alternatively, an easy way to compute the update to the environment is to check
Understand unsolvable problems
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When a problem as no |Solution|, it is inherenty hard to come up with an explanation.
In the easiest case, a requiered package is missing from the |Database|.
When a problem has no |Solution|, it is inherenty hard to come up with an explanation.
In the easiest case, a required package is missing from the |Database|.
In the most complex, many package dependencies are incompatible without a single culprit.
In this case, packages should be rebuild with weaker requirements, or with more build variants.
In this case, packages should be rebuilt with weaker requirements, or with more build variants.
The |UnSolvable| class attempts to build an explanation.

The :cpp:func:`UnSolvable.problems <mamba::solver::libsolv::UnSolvable::problems>` is a list
Expand Down
Loading

0 comments on commit 3e1e97b

Please sign in to comment.