-
Notifications
You must be signed in to change notification settings - Fork 24
refactor: Python Inspector Overhaul Part 1 - Buildsystem migration #210
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
base: main
Are you sure you want to change the base?
Conversation
heliocastro
commented
Mar 27, 2025
•
edited by mjherzog
Loading
edited by mjherzog
- Migration to Astral Uv to modernize projcet buildsystem
- Use Ruff and Mypy as sole unique linters. This allows to replace old code style checkers and centralize configuration only on pyproject.toml
- Add pre-commit capability
- Update README to Github markdown and reflect buildsystem changes
- Add new CI testing and publishing
fadbe3b
to
42e0bb7
Compare
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.
@heliocastro Thanks for the push, but there are way too many changes at once mixed in one PR here. This is too hard to review and impossible to merge as it is. We would need to have smaller PRs focused on one major change at a time, like introducing one tool at a time not many at once.
.github/workflows/testing.yml
Outdated
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10", "3.11", "3.12", "3.13"] |
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.
Why drop the supported Python 3.9 version?
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.
For this one, i expected that we will not be able to fully release in a month or so, and Python 3.9 is EOL soon.
But i reverted to use 3.9 as well.
@@ -0,0 +1,30 @@ | |||
default_language_version: |
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.
Introducing pre-commit should be its own PR
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.
This is not mandatory and is not turned on by default, so no harm.
I really appreciate if we keep it to follow the README.
@@ -0,0 +1,27 @@ | |||
name: Run Pytest with Astral Uv |
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.
We run tests using a common azure pipelines and we are not using GH workflows for running tests. The base script would need to be updated in the https://github.com/aboutcode-org/skeleton first and ensure that this works fine.
At this stage all tests are failing also. See https://dev.azure.com/nexB/python-inspector/_build/results?buildId=15693&view=results
And there we run on linux, windows and mac in all cases.
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 know, i know.
But now i'm on chicken and egg problem. I can't change skeleton without be approved and not break other projects, and at same time i need to see tests working.
Having the tests on Github cause no harm, so we can keep it.
If i have an easy way to update the skeleton without break the rest of the projects and i can effective use on the PR, would be fine.
@@ -30,7 +30,7 @@ | |||
|
|||
import pytest | |||
|
|||
import utils_pip_compatibility_tags |
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.
Please do not modify the code in etc/script, this is not code that is part of python-inspector but utility code from the skeleton. Furthermore, this is not a python module so do not add an __init__.py
Note that these tests are not running in this repo with our pytest config, by design.
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.
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.
Removed init files and used pythonpath direct on pytest
@@ -6,7 +6,7 @@ | |||
"options": [ | |||
"--json <file>", | |||
"--operating-system linux", | |||
"--python-version 38", | |||
"--python-version 39", |
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.
Please do not change the Python default version in this PR, this should happen elsewhere, in another PR.
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.
Reverted
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.
Actually, as i dropped support for 3.8, this is actually correct
uv.lock
Outdated
[[package]] | ||
name = "aboutcode-toolkit" | ||
version = "11.0.0" | ||
source = { registry = "https://jfrog.hub.vwgroup.com/artifactory/api/pypi/optima-pypi-virtual/simple" } |
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.
This is unlikely something anyone can use publicly?
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.
No no, was wrong registry on lock generation. Fixed already
pyproject.toml
Outdated
@@ -1,52 +1,227 @@ | |||
[build-system] | |||
requires = ["setuptools >= 50", "wheel", "setuptools_scm[toml] >= 6"] | |||
build-backend = "setuptools.build_meta" | |||
requires = ["hatchling"] |
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 would rather not change the build backend mixed with other things. Make it its own PR.
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.
Moved back to setuptools.
pyproject.toml
Outdated
"Topic :: Software Development :: Libraries :: Python Modules", | ||
] | ||
dependencies = [ | ||
"aiofiles>=24.1.0", |
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.
Why introduce new dependencies in this PR? I cannot see where they would be used. I'd like to see something simple like a basic conversion from setup to pyproject with no other unrelated changes, otherwise this is hard to review
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.
This came from the different branch, i removed all unnecessary extra deps
|
||
[tool.pytest.ini_options] | ||
norecursedirs = [ |
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.
These are needed. Why remove these?
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.
Instead of doing huge multiple exclusions, used only testpath for the two required directories
python_classes = "Test" | ||
python_functions = "test" | ||
|
||
addopts = [ |
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.
These options are needed.
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.
Added back some opts, the python_classed and python_functions are not needed as default from pytest
1101214
to
a4ed493
Compare
This one is already minimal. We will need to do some compromise here, we're talking in substantial changes. This is the minimal required to get the base changed and then we can do simple changes. But please, bear with me on this one. |
3cb7e5c
to
c8c83ea
Compare
Replace setup tools and configure to unified Uv with pyproject based setup. Set minimum default python to 3.9 as python 3.8 is EOL. Project file pyproject.toml now replaced all linters for a unified solution using ruff and mypy and integrated pytest configurations. Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
c8c83ea
to
b871c68
Compare
- Regenerated tests with REGEN_TEST_FIXTURES - Updated tests to proper import internal code - Added testing Ci check for Github Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
b871c68
to
4796257
Compare