|  | 
| 2 | 2 | 
 | 
| 3 | 3 | ## Summary | 
| 4 | 4 | 
 | 
| 5 |  | -<!-- Here goes a general summary of what this release is about --> | 
|  | 5 | +This release replaces [`darglint`](https://github.com/terrencepreilly/darglint) (not maintained anymore) with [`pydoclint`](https://github.com/jsh9/pydoclint) which brings performance and checks improvements. It also adds basic `flake8` checks and `mypy` fixes. | 
| 6 | 6 | 
 | 
| 7 | 7 | ## Upgrading | 
| 8 | 8 | 
 | 
| 9 | 9 | - `flake8` basic checks are enabled now. Most are already covered by `pylint`, but there are a few differences, so you might need to fix your code if `flake8` find some issues. | 
| 10 | 10 | 
 | 
| 11 |  | -- `darglint` was replaced by `pydoclint`, `pydoclint` can find a few more issues than `darglint`, so your code might need adjusting. | 
|  | 11 | +- `darglint`: | 
| 12 | 12 | 
 | 
| 13 |  | -- `darglint` is not used anymore, but if it is installed, it will make `flake8` run extremely slowly anyways, so it is extremely recommended to uninstall it (`pip uninstall darglint`) and rebuild you `nox` *venvs* if you use `-R`. | 
|  | 13 | +  * Replaced by `pydoclint`, `pydoclint` can find a few more issues than `darglint`, so your code might need adjusting. | 
|  | 14 | + | 
|  | 15 | +  * It is recommended to remove the `darglint` configuration file `.darglint` and the `darglint` `pip` package, if it is kept installed, it will make `flake8` run extremely slowly even if not used: `pip uninstall darglint`) and rebuild you `nox` *venvs* if you use `-R`. | 
| 14 | 16 | 
 | 
| 15 | 17 | - If you are upgrading without regenerating the cookiecutter templates, you'll need to adjust the dependencies accordingly. | 
| 16 | 18 | 
 | 
|  | 19 | +- `nox`: The `Config.package_args()` method was removed. | 
|  | 20 | + | 
|  | 21 | +- `mypy` | 
|  | 22 | + | 
|  | 23 | +    * Options must be specified in the `pyproject.toml` file, including the option `packages` specifying the package containing the source code of the project. The documentation was updated to suggest the recommended options. | 
|  | 24 | + | 
|  | 25 | +    * Dependencies on *stubs* for running the type check need to be specified manually in the `pyproject.toml` file, so they can be pinned (before they were installed automatically by `mypy`. | 
|  | 26 | + | 
|  | 27 | +    * The `mypy` `nox` session runs `mypy` 2 times, one without options to check the package including the sources, and one with the paths of development paths (`tests`, `benchmarks`, etc.). | 
|  | 28 | + | 
|  | 29 | +    To migrate existing projects: | 
|  | 30 | + | 
|  | 31 | +    1. Add the recommended options (previously specified in the default options object): | 
|  | 32 | + | 
|  | 33 | +        ```toml | 
|  | 34 | +        [tool.mypy] | 
|  | 35 | +        explicit_package_bases = true | 
|  | 36 | +        namespace_packages = true | 
|  | 37 | +        packages = ["<package.name>"]  # For example: "frequenz.repo.config" for this package | 
|  | 38 | +        strict = true | 
|  | 39 | +        ``` | 
|  | 40 | + | 
|  | 41 | +    2. Find out which *stubs* were previously installed automatically by `mypy`: | 
|  | 42 | + | 
|  | 43 | +        ```sh | 
|  | 44 | +        python -m venv tmp_venv | 
|  | 45 | +        . tmp_venv/bin/activate | 
|  | 46 | +        pip install -e .[dev-mypy] | 
|  | 47 | +        mypy --install-types | 
|  | 48 | +        deactivate | 
|  | 49 | +        ``` | 
|  | 50 | + | 
|  | 51 | +    3. Look at the list of packages it offers to install and answer "no". | 
|  | 52 | + | 
|  | 53 | +    4. Search for the latest package version for those packages in https://pypi.org/project/<package-name>/ | 
|  | 54 | + | 
|  | 55 | +    5. Edit the `pyproject.toml` file to add those dependencies in `dev-mypy`, for example: | 
|  | 56 | + | 
|  | 57 | +        ```toml | 
|  | 58 | +        [project.optional-dependencies] | 
|  | 59 | +        dev-mypy = [ | 
|  | 60 | +        "mypy == 1.5.1", | 
|  | 61 | +        "types-setuptools == 68.1.0.0", | 
|  | 62 | +        # ... | 
|  | 63 | +        ``` | 
|  | 64 | + | 
| 17 | 65 | ### Cookiecutter template | 
| 18 | 66 | 
 | 
| 19 | 67 | - CI: The `nox` job now uses a matrix to run the different `nox` sessions in parallel. If you use branch projection with the `nox` job you need to update the rules to include each matrix job. | 
|  | 
| 26 | 74 | 
 | 
| 27 | 75 | - `darlint` was replaced by `pydoclint`, which is way faster and detect more issues. | 
| 28 | 76 | 
 | 
|  | 77 | +- `nox`: The `Config.path_args()` method now accepts two optional arguments to control with paths to include. | 
|  | 78 | + | 
| 29 | 79 | ### Cookiecutter template | 
| 30 | 80 | 
 | 
| 31 | 81 | - Now dependabot updates will be done weekly and grouped by *required* and *optional* for minor and patch updates (major updates are still done individually for each dependency). | 
|  | 
| 34 | 84 | 
 | 
| 35 | 85 |   The output of `pip freeze` is printed to be able to more easily debug different behaviours between GitHub workflow runs and local runs. | 
| 36 | 86 | 
 | 
| 37 |  | -- See the general new features section. | 
|  | 87 | +- `mypy`: Add a commented out `no-incremental` option, which makes the run slower but prevents some issues with `mypy` giving different results on different runs. | 
| 38 | 88 | 
 | 
| 39 |  | -## Bug Fixes | 
| 40 |  | - | 
| 41 |  | -<!-- Here goes notable bug fixes that are worth a special mention or explanation --> | 
| 42 |  | - | 
| 43 |  | -### Cookiecutter template | 
| 44 |  | - | 
| 45 |  | -<!-- Here bug fixes for cookiecutter specifically --> | 
|  | 89 | +- See the general new features section. | 
0 commit comments