Skip to content
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

Support PyPy (easy) #727

Closed
deeplook opened this issue Feb 28, 2019 · 11 comments · Fixed by #2559
Closed

Support PyPy (easy) #727

deeplook opened this issue Feb 28, 2019 · 11 comments · Fixed by #2559
Labels
C: packaging Installation and packaging of Black help wanted Extra attention is needed

Comments

@deeplook
Copy link

Please consider adding PyPy Trove classifiers, because apparently black works fine! At least on the recent PyPy (I tested PyPy3.6 v7.0 on macOS). I used version 18.9b0 of black. See https://pypy.org/download.html

@zsol zsol added help wanted Extra attention is needed good first issue Good for newcomers labels Feb 28, 2019
@zsol
Copy link
Collaborator

zsol commented Feb 28, 2019

We should also add validation that this works as part of our CI pipeline.
Happy to review a pull request :)

@pauloalem
Copy link

I was going to give this a shot but it seems travis does not yet have pypy 3.6 available.

@hugovk
Copy link
Contributor

hugovk commented Mar 9, 2019

Azure Pipelines are planning on adding PyPy: microsoft/azure-pipelines-tasks#8514.

(See #731 for adding Azure Pipelines with CPython to this repo.)

@ambv
Copy link
Collaborator

ambv commented Mar 14, 2019

I was actually targeting my PyPy sprint contributions in Dusseldorf with this in mind so I'm happy it works for you :)

To be fully frank, not everything works on PyPy yet, the asyncio parts are failing in particular.

@alexchamberlain
Copy link

Just as an FYI: I tried configuring this on Travis (see https://github.com/alexchamberlain/black/blob/pypy3/.travis.yml#L36). typed-ast and aiohttp appear to be incompatible with pypy3 if I've configured it correctly.

@zsol
Copy link
Collaborator

zsol commented Oct 6, 2019

if you drop pip install -e '.[d]' it will no longer pull in aiohttp (but blackd will not be tested). typed-ast is going away with python 3.8, so we could in theory strip away that dependency from that version on

@paugier
Copy link

paugier commented Oct 29, 2019

An update with pypy3.6 v7.2.0:

Wouldn't it be possible to install black without typed-ast on PyPy ?

With typed-ast has a hard dependency, it seems it won't be possible to install black until PyPy reaches 3.8 !

@paugier
Copy link

paugier commented Oct 29, 2019

For the record, the PR which introduced the typed-ast dependency: #840 "Make --safe work for Python2.7 syntax, by using typed_ast".

@ambv
Copy link
Collaborator

ambv commented Oct 29, 2019

I want to support PyPy but this is going to be a tough sell.

PyPy3 is 3.6

Well, PyPy3 is now targeting 3.6, working on 3.7. The functionality to parse Python 2 code into an AST on Python 3 was only added in Python 3.8.0. So @zsol is right that we could drop this dependency on Python 3.8 but that doesn't solve the problem for PyPy.

We need a Python 2 AST

Sadly, we need to be able to convert Python 2 code into AST form to do the sanity checks that Black is doing by default. This found many many bugs and is one of the reasons Black is being trusted by its users even though it's so young of a project.

We need a fast Python 2 AST

The reason we chose typed-ast over pure Python parsers on PyPI is that it's written in C and thus pretty fast. This is important because the sanity check is not really core functionality of Black. Sometimes I ponder if --fast might become the default in the future. So, we want --safe not to slow people down beyond what's strictly necessary.

@vemel
Copy link
Contributor

vemel commented Nov 21, 2019

What about installing typed-ast as an optional dependency, e.g. pip install black[typed-ast] or pip install black[fast]? Then PyPy users could use black with native AST.

@vemel
Copy link
Contributor

vemel commented Nov 21, 2019

Please take a look. Works in my case: #1172

tony added a commit to tony/django-docutils that referenced this issue Dec 26, 2019
tony added a commit to tony/django-docutils that referenced this issue Dec 26, 2019
jpgrayson added a commit to westerndigitalcorporation/pyvcd that referenced this issue Mar 12, 2020
All code is updated to use black formatting.

https://github.com/psf/black

A pyproject.toml file is added with configuration for the black tool. Note
that skip-string-normalization is enabled; this allows pyvcd code to
continue using single-quoted strings instead of black's default of
double-quoted strings.

The Makefile's 'lint' and 'format' targets are updated to use black.

N.B. there is an issue with installing/running black with pypy3, so instead
of including it in requirements.txt, it is installed conditionally in
.travis.yml.

    psf/black#727
    python/typed_ast#111
jpgrayson added a commit to westerndigitalcorporation/pyvcd that referenced this issue Apr 2, 2020
They are conditional on cpython because currently neither tool can be
installed in a pypy environment.

psf/black#727
python/typed_ast#111
tony added a commit to cihai/unihan-etl that referenced this issue Jul 3, 2020
@JelleZijlstra JelleZijlstra added the C: packaging Installation and packaging of Black label May 30, 2021
@JelleZijlstra JelleZijlstra removed the good first issue Good for newcomers label Sep 11, 2021
jlaasonen added a commit to ElectronicBabylonianLiterature/ebl-api that referenced this issue Dec 6, 2021
It works with pypy again: psf/black#727
jlaasonen added a commit to ElectronicBabylonianLiterature/ebl-api that referenced this issue Dec 7, 2021
It works with pypy again: psf/black#727
jlaasonen added a commit to ElectronicBabylonianLiterature/ebl-api that referenced this issue Dec 7, 2021
It works with pypy again: psf/black#727
jlaasonen added a commit to ElectronicBabylonianLiterature/ebl-api that referenced this issue Dec 15, 2021
* Update dependencies

* Extract method to get chapter title

* Remove spurious commas

* Upgrade black and format

It works with pypy again: psf/black#727

* Add model for cahpter display

* Move ChapterIdSchema to id_schemas

* Add schema for ChapterDisplay

* Add methods for finding chapters for display

* 'Refactored by Sourcery' (#176)

Co-authored-by: Sourcery AI <>

* Add route for chapter display

* Remove Theia settings

* Add title to ChapterDisplay

* Add title to ChapterDisplay schema

* Add intertext to line display

* Get intertext from database

* Add is_single_stage to ChapterDisplay

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
tony added a commit to cihai/unihan-etl that referenced this issue Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: packaging Installation and packaging of Black help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants