-
-
Notifications
You must be signed in to change notification settings - Fork 6
Attempt to replace pkg_resources uses, generally bump to Python 3.10+ maintenance etc. #67
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: master
Are you sure you want to change the base?
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
Thank you! I've been delayed on reviewing but maybe by the end of this week. |
|
I've been trying to think about the reason for the problem on Python 3.14. My best guess is that it's some problem to do with the filenames being the same, i.e. stata.py in nbstata trying to import something from stata.py in pystata. But so far I don't know how to fix. Also I wasn't sure if I needed to add corresponding notebooks for the new _resources.py and _version_helper.py files. |
It works to leave them as just .py files, unless you want to add separate tests and docs for them, which is probably not needed. |
e2ac0d1 to
82010bf
Compare
|
I tried to follow the error when rendering/running in a Jupyer notebook on Python 3.14. I think as well as the stata.py filename issue there might be some problems caused by some of the But even when I've tried renaming the nbstata/stata.py file and moving the import statements out of the function/methods definitions I still end up with errors. [Obvs this testing on a different branch]. So as a short term fix I have removed the Python 3.14 line from the pyproject.yaml file in this PR. But I hope one of us/someone/AI can work this out eventually. |
82010bf to
14c2333
Compare
|
Hi @hugetim - amazing news - as of today's update to StataNow 19.5 (12 Nov 2025) this now works under Python 3.14. StataCorp have fixed something about pystata or one of their other Python packages bundled within Stata and now the mysterious error I was obtaining above under Python 3.14 is no more. In
So I have,
|
|
I wonder whether older versions of Stata will still trigger the issue. And whether they bumped the version number of pystata. (Mostly just writing to acknowledge that I'm still delayed on reviewing, but I haven't forgotten this.) |
|
Good point - looking at the update pages for the different versions it seems that Stata 18 also received an update yesterday (which in truth I didn't expect). So I am hopeful that we can run under Python 3.14 under both the newly updated Stata 18 and 19 (unfortunately I think I have probably lost my Stata 18 license, so can't check conveniently).
And for users of older versions of Stata, or 18 and 19 before yesterday's update, they can run under Python 3.10, 3.11, 3.12, or 3.13 - which luckily virtual environment managers like uv make it pretty easy to do these days. Also I should say I don't know if all the elements of the pyproject.toml file are totally correct:
|

Hi Tim
I have had a go at this.
I used your ChatGPT suggestions.
I have tested on the most recent versions of Python 3.10, 3.11, 3.12, and 3.13 and they all pass
nbdev_test(as you can see from the GitHub Actions workflow I've amended) and aquarto renderof a test Quarto document.However, I have a mysterious problem. When I run this under the recently released Python 3.14.0 I obtain some sort of problem originating from within Stata's pystata. Weirdly
nbdev_testpasses. But when I run a testquarto renderthe kernel hangs at the first Stata chunk. To see more I converted my test qmd file to a Jupyter notebook.First create a UV virtual environment with Python 3.14.0 and activate it
Then add the packages in the pyproject.toml and nbstata
Install the kernel
Then this will hang, where my test.qmd is simply
Kill that with Ctrl+C and convert qmd file to ipynb
Then open the ipynb in JupyerLab
Then executing a stata chunk, the error I obtain is:
Would you have any ideas? I might ask StataCorp. Tech Support about it.
Anyway even if you don't take this, maybe a useful starting place for your own commits.
Closes #58
Closes #65 (because it includes those commits)