Skip to content

Dependencies: Isolate pyodbc package #296

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

amotl
Copy link
Contributor

@amotl amotl commented Jul 7, 2025

About

The most recent release v0.13.64 made the pyodbc package a strict requirement. This patch relaxes that again by isolating the dependency into a dedicated module which is only imported at runtime when MSSQL is selected.

Synopsis

The application will not fail when the pyodbc package is not installed.

(.venv) sink:ingestr amo$ uv pip uninstall pyodbc
Uninstalled 1 package in 44ms
 - pyodbc==5.2.0
(.venv) sink:ingestr amo$ python
Python 3.13.5 (main, Jun 11 2025, 15:36:57) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ingestr.src.destinations

Details

The isolation is accompanied by a minor testing/CI reorg to cover both situations well. Introducing a dedicated full extra which bundles all the extra dependency groups into a single entrypoint has been approved in other polyglot code bases in the past.

It is well suited to cover two scenarios to verify if the package works with all extras, and without any extras. Of course, this paradigm can be made more granular when there is demand. As a common best practice, discriminating between minimal vs. full is good enough.

References

Comment on lines 157 to 159
odbc = [
"pyodbc==5.1.0",
"pyodbc==5.2.0",
]
Copy link
Contributor Author

@amotl amotl Jul 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requirements-dev.txt said 5.2.0 would be fine, so we used it without much ado.

@amotl amotl force-pushed the isolate-pyodbc branch from 4a97b61 to 1d35671 Compare July 7, 2025 15:59
@amotl amotl changed the title Dependencies: Isolate pyodbc Dependencies: Isolate pyodbc package Jul 7, 2025
@amotl amotl force-pushed the isolate-pyodbc branch 2 times, most recently from 3797de9 to 9a20b45 Compare July 7, 2025 16:48
Per package metadata definition, it is an optional "extra" dependency.
Let's make it a reality, and also let CI cover the scenarios well.
@amotl amotl force-pushed the isolate-pyodbc branch from 9a20b45 to a19d8c2 Compare July 7, 2025 16:50
@amotl amotl marked this pull request as ready for review July 7, 2025 17:53
@amotl amotl mentioned this pull request Jul 7, 2025
@turtleDev
Copy link
Contributor

turtleDev commented Jul 8, 2025

fixed in #298

@amotl
Copy link
Contributor Author

amotl commented Jul 8, 2025

Hi @turtleDev. Feel free to close this PR if you don't have a need.

Our advise however is to revert GH-298 and use this patch instead, because it also takes care about relevant software testing matters, and also takes a clean approach instead of mixing concerns.

Comment on lines 6 to 11
ruff==0.11.4
hatchling==1.27.0
build==1.2.1
pyodbc==5.2.0
twine==6.0.1
testcontainers[postgres,mysql]==4.8.2
pytest-xdist[psutil]==3.6.1
Copy link
Contributor Author

@amotl amotl Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing pyodbc here is absolutely crucial so that its presence will not negatively mask any operations on the code base to make it work without.

@turtleDev
Copy link
Contributor

hey @amotl it's not a (high) priority right now for us. There are some rough edges around ingestr that we plan to refactor down the road. Thanks for the contribution though!

I would like to invite you to join our slack community. You can get a better picture of what we're working on and as an alternate platform for discussions around ingestr.

@amotl
Copy link
Contributor Author

amotl commented Jul 8, 2025

Hi @turtleDev. Then let's keep the PR open for the future refactorings you are referring to, that could lead to corresponding quality improvements?

Thanks for the invite, I may join your Slack, but in general I try to keep distraction low and productivity high, and there is already another Slack I need to deal with ;]. On the other hand, let me know if you would like to receive support on ingestr in any way to polyfill the capacities if it's currently a low priority for you. 1

Let's put the PR back into draft mode?

Footnotes

  1. Remark: It rarely gets better. ;]

@amotl amotl marked this pull request as draft July 8, 2025 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants