Skip to content

Adding PyMySQL and SQLAlchemy stubs for Python 3 #647

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

Closed
wants to merge 4 commits into from

Conversation

jhagerer
Copy link

@jhagerer jhagerer commented Nov 1, 2016

Stubs were auto-generated and manually modified using mypy/stubgen.py and Python 3.5. Closes the following ticket:

Stubs for PyMySQL #631

Stubs were auto-generated and manually modified using mypy/stubgen.py and Python 3.5. Closes the following ticket:

python#631
@jhagerer jhagerer changed the title Adding PyMySQL for Python 3 Adding PyMySQL stubs for Python 3 Nov 1, 2016
tests make problems for mypy
@jhagerer
Copy link
Author

jhagerer commented Nov 1, 2016

Deleted a broken stub file

just changed sqlalchemy/util/compat:37 unicode -> str, everything else is unchanged
@jhagerer
Copy link
Author

jhagerer commented Nov 2, 2016

added sqlalchemy to third_party/2and3
just changed sqlalchemy/util/compat:37 unicode -> str, everything else is unchanged

@jhagerer jhagerer changed the title Adding PyMySQL stubs for Python 3 Adding PyMySQL and SQLAlchemy stubs for Python 3 Nov 2, 2016
@gvanrossum
Copy link
Member

gvanrossum commented Nov 2, 2016

@ghagerer Did you realize there are already stubs for sqlalchemy in third_party/2/sqlalchemy/? We shouldn't have stubs for the same package in both /2 and /2and3. How do your stubs compare to those?

@jhagerer
Copy link
Author

jhagerer commented Nov 8, 2016

Both are 100% the same except one line:

sqlalchemy/util/compat.pyi:37:
old: text_type = unicode
new: text_type = str

In that way both mypy and mypy --py2 run without errors.

Should I delete the third_party/2/sqlalchemy folder from my fork and then merge?

@gvanrossum
Copy link
Member

That sounds like a good plan. Maybe you can change that type alias to using typing.Text, which does the right thing regardless of Python version.

@aleksanb
Copy link

Activity seems to have died down, could one of us take over this PR and finish the remaining changes?
(deleting third_party/2/sqlalchemy and using the type alias in the one file).

Looking forward to getting this merged.

@gvanrossum
Copy link
Member

gvanrossum commented Nov 28, 2016 via email

@aleksanb aleksanb mentioned this pull request Nov 29, 2016
This is just to trigger the test to run again -- I have reasons to believe this PR is out of date.
@gvanrossum
Copy link
Member

Huh, okay, my local tests failed because I forgot to rebase, and everything's fine. But I am still going to close this in favor of #719 (even though the latter is also on hold) since too many competing PRs is just confusing. If I made a mistake please comment here (or on #719) and I'll correct it!

@gvanrossum gvanrossum closed this Dec 13, 2016
@gvanrossum
Copy link
Member

Whoops, there are two parts here. One part is the sqlalchemy stubs which IIUC is superseded by #719. But the other part is pymysql which is not there AFAICT. So reopening in the hope of disentangling the two PRs...

@gvanrossum gvanrossum reopened this Dec 13, 2016
@ambv ambv force-pushed the master branch 10 times, most recently from 63ba0ab to 7853c26 Compare December 23, 2016 00:12
@gvanrossum
Copy link
Member

@ghagerer Can I entice you to submit your stubs for pymysql separately? Then hopefully your work on those can be merged. If we don't hear from you in a few weeks we'll close this PR without action.

gvanrossum pushed a commit that referenced this pull request Jan 23, 2017
I believe this covers both #647 and #719.

Moved sqlalchemy stubs from 2 to 2and3;
changed sqlalchemy/util/compat.pyi:37 to be of type typing.Text;
added incomplete stubs for sqlalchemy.orm.utils and slqalchemy.sql.elements.ColumnElement.
@gvanrossum
Copy link
Member

I'd closed this in favor of #857 except I'm still hopeful to also get the pymysql stubs in.

gvanrossum pushed a commit that referenced this pull request Jan 30, 2017
(Original by @ghagerer, extracted from #647 by @WouldYouKindly.)
@gvanrossum
Copy link
Member

Superseded by #861.

@gvanrossum gvanrossum closed this Jan 30, 2017
hswong3i pushed a commit to alvistack/python-typeshed that referenced this pull request May 25, 2025
Fixes python/typing#643

(Use ignore whitespace option to review this, since it mostly just indents a bunch of stuff.)

PR summary:
* Update Travis config to run on a bunch of newer Python versions (including 3.8-dev).
* Only run `typing` tests on Python 3.6 or older, starting from Python 3.7 development of `typing` moved to CPython repo, where it was significantly reworked. We still run `typing_extension` tests on all versions.
* Update `repr()` tests in `typing_extensions` to conditionally expect correct module name.
* Add `TypedDict` to `__all__`.
* Use `Final`, `Literal`, etc. from `typing` if those are available (as we do for other things).
* Rename `@runtime` to `@runtime_checkable` in `typing_extensions` (I think we can keep `@runtime` in `typing_extensions` as an alias for backwards compatibility).

Note this only updates Python 3 version of `typing_extensions`. There will be a corresponding update for the Python 2 version of `typing_extensions` as part of python/typing#648
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.

3 participants