-
Notifications
You must be signed in to change notification settings - Fork 6
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
Update CI tools and dependencies #24
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Error handling in pandera seems to have changed from version 0.13.4 to 0.17.2. Unfortunately, I couldn't find any concise changelog on things that might affect us. Safetycli has something that most resembles it and I was able to infer this as the complete 'changelog', though going through a list of all commits doesn't seem very practical either. My main issue is the error handling, however. Even after several hours of searching for it, there does not seem to be a way to raise a custom exception inside a dataframe-wide validation function. Instead, pandera seems to always raise a |
* Make creation information optional in iamc/variable * Make id and name required for unit * Revert bulk_* changes to use json_encoder of api.DataFrame again * NOTE: this option will be deprecated in the future, * pydantic serialization decorators should be used instead
* Revert use of Annotated in iamc/datapoint/filter * Make sqla_model a proper ClassVar (rather than private attr)
* Runs mypy, black, ruff * NOTE: needs to be run in the repo s.t. poetry detects the correct venv * Remove separate lint.yaml action
0561221
to
d89c162
Compare
For the pre-commit hook, I have now opted for option 1 in this list of ways to run mypy on pre-commit. I would have liked to go with option 2, but couldn't figure out a way to run poetry's mypy from within the venv that pre-commit creates when using the In addition, this setup could allow us to employ https://github.com/floatingpurr/sync_with_poetry. This tool (after configuring its db.py file for our purposes) would automatically keep the |
As for the docs failing to build, this seems to be a long-running issue on sphinxcontrib-openapi: I'll see if I can't help them fix it. |
Using their suggested fix leads to successful builds, but the process emits a To summarize, {"name": "table", "in": "query", "required": false, "schema": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "default": false, "title": "Table"}} In fact, the |
Slight misunderstanding before, this issue persists in the openapi31 renderer. I thus created sphinx-contrib/openapi#143 to try and remedy this. |
Overview of updated dependencies[tool.poetry.dependencies]
SQLAlchemy : { extras = ["mypy"], version = "^2.0.7" } -> {extras = ["mypy"], version = "^2.0.22"}
SQLAlchemy-Utils : "^0.40.0" -> "^0.41.1"
dask : "^2023.4.0" -> "^2023.10.0"
fastapi : "^0.94.0" -> "^0.103.1"
httpx : { extras = ["http2"], version = "^0.23.3" } -> {extras = ["http2"], version = "^0.25.0"}
pandera : "^0.13.4" -> "^0.17.0"
pydantic : "^1.10.5" -> "^2.4.0"
python-dotenv : "^0.19.0" -> "^1.0.0"
typer : "^0.4.0" -> "^0.9.0"
pydantic-settings = "^2.0.3"
[tool.poetry.group.docs.dependencies]
sphinx : "5.3" -> "^7.2.6"
sphinxcontrib-openapi : "^0.8.1" -> {git = "https://github.com/glatterf42/openapi.git", branch = "enh/openapi31-anyOf"}
[tool.poetry.group.server.dependencies]
gunicorn : "^20.1.0" -> "^21.2.0"
uvicorn : { version = "^0.17.0", extras = ["standard"]} -> {extras = ["standard"], version = "^0.23.2"}
[tool.poetry.group.dev.dependencies]
black : "^23.1.0" -> "^23.9.1"
build : "^0.10.0" -> "^1.0.3"
mypy : "~1.0.1" -> "^1.6.0"
pytest : "^6.2.5" -> "^7.4.2"
pytest-benchmark : "^3.4.1" -> "^4.0.0"
pytest-cov : "^2.12.1" -> "^4.1.0"
pandas-stubs = "^2.0.3.230814"
pre-commit = "^3.5.0"
ruff = "^0.0.292" |
Notes about enabling the docs to buildPlease note that if you update your venv to the package versions in Please note that the current 'fix' for building the docs uses my fork of sphinxcontrib-openapi, so this is not approved in any way. Please check that the docs render in an acceptable form, especially lists like GET /iamc/datapoints on local server or GET /iamc/datapoints on RTD which have seen parameters change from single types to unions of types for type hints. In my browser, this change looks similar to this:
If this style is not acceptable, we can further adapt the fork/PR to support our desired style. Please also check the same endpoint in the Swagger UI that fastapi creates automatically: http://127.0.0.1:9000/v1/sqlite/docs#/iamc/enumerate_iamc_datapoints__get is the link for my locally hosted version (our docs use port 8000 as a default instead). FastAPI upgraded to support Openapi 3.1.0 and Swagger UI 5.x.x with version 0.99, but on my local version, type hints are only shown for parameters that have a single type. So parameters with types in
with
|
* Bump fastapi,black,ruff,mypy versions * Update pre-commit-config accordingly * Update doc/source/openapi-v1.json
LGTM, thanks! that was a lot of work ^^' |
Since the MESSAGE stack is moving from flake8 and isort to ruff, we will want to do the same here for consistency. Ruff can even be run via a pre-commit hook, allowing less maintenance on GHA workflow files.
While preparing this transition, I found that some of our dependencies were several (major) versions behind their current versions, most notably fastapi and pydantic. The transition is still in progress, pytest is currently still failing (but at least running again).