Closed rnestler closed 1 year ago
Would it be possible to also configure mypy so we can easily run it locally the same way as on CI?
Yes I think so.
Would it be possible to also configure mypy so we can easily run it locally the same way as on CI?
@ubruhin Done. You can now just call mypy .
and all configuration is done in the pyproject.toml
file. Also we now typecheck all files and just have less strict options.
Nice! Just one problem: When generating some parts, the output directory out/
is created. While this directory exists, pip install .[test]
fails with this error:
Processing librepcb-parts-generator
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [14 lines of output]
error: Multiple top-level packages discovered in a flat-layout: ['out', 'entities'].
To avoid accidental inclusion of unwanted files or directories,
setuptools will not proceed with this build.
If you are trying to create a single distribution with multiple packages
on purpose, you should not rely on automatic discovery.
Instead, consider the following options:
1. set up custom discovery (`find` directive with `include` or `exclude`)
2. use a `src-layout`
3. explicitly set `py_modules` or `packages` with a list of names
To find more information, look for "package discovery" on setuptools docs.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Hmm. The proper solution would be to restructure completely to fit a python package style with on folder for the source code. The workaround would be to just exclude some folders manually.
I excluded the out
directory for now.
OK the out
directory does not cause any issues anymore. But now I realized that pip install .[test]
causes a build/
directory to be created, with all our scripts duplicated into that directory and thus reported by Git as untracked files.
Looks like somehow a package will be created during this command although this repository does not represent a Python package. @rnestler Are you really sure the pyproject.toml
is the right thing for us? Is there actually something wrong with requirements.txt
? :see_no_evil:
OK the out directory does not cause any issues anymore. But now I realized that pip install .[test] causes a build/ directory to be created, with all our scripts duplicated into that directory and thus reported by Git as untracked files.
Hmm I tested it on my machine and it didn't create a build
directory. But on the other hand: I think I used :pip install -e .[test]
(-e
being the important part). But we can also just add build
to .gitignore
.
Looks like somehow a package will be created during this command although this repository does not represent a Python package.
I'd argue that it should, since it would make stuff easier.
Are you really sure the pyproject.toml is the right thing for us? Is there actually something wrong with requirements.txt? 🙈
I guess the upsides are:
Downsides are:
Hmm I tested it on my machine and it didn't create a build directory. But on the other hand: I think I used :pip install -e .[test] (-e being the important part).
Ah true, -e
helps :+1:
Would it be possible to also configure mypy so we can easily run it locally the same way as on CI?
https://github.com/LibrePCB/librepcb-parts-generator/blob/dc0e4bde936b6c9c84c8ce4092e8a1af4def152d/.github/workflows/main.yml#L23C11-L30