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

Update black formatting #818

Merged
merged 4 commits into from
Aug 27, 2019
Merged

Conversation

vfazio
Copy link
Contributor

@vfazio vfazio commented Aug 26, 2019

Use the prerelease version of black

Enforce py36 standards since python2 support was dropped

vfazio added 2 commits August 23, 2019 12:04
Also add reasonable excludes in pyproject.toml

Signed-off-by: Vincent Fazio <[email protected]>
Setup.py specifies Python 3.6+ so apply black formatting rules
consistent with that version.

The main changes are dropping 'u' string prefixes for Python 2.x

Python 2 support was dropped in c5c7ed1

Signed-off-by: Vincent Fazio <[email protected]>
@codecov-io
Copy link

codecov-io commented Aug 26, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@1eb5b9c). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #818   +/-   ##
=========================================
  Coverage          ?   97.24%           
=========================================
  Files             ?       61           
  Lines             ?     3631           
  Branches          ?      485           
=========================================
  Hits              ?     3531           
  Misses            ?       60           
  Partials          ?       40
Impacted Files Coverage Δ
anitya/db/models.py 100% <100%> (ø)
anitya/api_v2.py 100% <100%> (ø)
anitya/lib/exceptions.py 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1eb5b9c...394038b. Read the comment docs.

@Zlopez
Copy link
Contributor

Zlopez commented Aug 27, 2019

I'm not sure if it's good to use prerelease version of black for formatting our code.

However enforcing python 3.6 sounds like a good idea.

@vfazio
Copy link
Contributor Author

vfazio commented Aug 27, 2019

I'm not sure if it's good to use prerelease version of black for formatting our code.

It's important to note that the versions on pypi.org are technically all pre-release (https://pypi.org/project/black/#history). the only non-prerelease version is version 0.0 and it's unusable.

I guess I really only ran into it because our default pypi index is pointing to a Nexus instance which proxies the upstream packages and doesn't seem to pull pre-release packages unless explicitly asked. Using pip install -i https://pypi.org/simple black seems to return the latest prerelease package despite --pre not being specified (which seems wrong).

vfazio@vfazio1 ~ $ cd `mktemp -d`
vfazio@vfazio1 /tmp/tmp.K9027kudiX $ python3 -m venv venv
vfazio@vfazio1 /tmp/tmp.K9027kudiX $ . venv/bin/activate
(venv) vfazio@vfazio1 /tmp/tmp.K9027kudiX $ pip install --upgrade pip
Collecting pip
  Downloading https://pypi.xes-mad.com/upstream/pip/pip-19.2.3-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 1.3MB/s 
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-19.2.3
(venv) vfazio@vfazio1 /tmp/tmp.K9027kudiX $ pip install black
Looking in indexes: https://pypi.xes-mad.com/upstream
Collecting black
  Using cached https://pypi.xes-mad.com/upstream/black/black-0.0-py3-none-any.whl
Collecting attrs (from black)
  Using cached https://pypi.xes-mad.com/upstream/attrs/attrs-19.1.0-py2.py3-none-any.whl
Collecting click (from black)
  Using cached https://pypi.xes-mad.com/upstream/click/Click-7.0-py2.py3-none-any.whl
Installing collected packages: attrs, click, black
Successfully installed attrs-19.1.0 black-0.0 click-7.0
(venv) vfazio@vfazio1 /tmp/tmp.K9027kudiX $ black -h
Traceback (most recent call last):
  File "/tmp/tmp.K9027kudiX/venv/bin/black", line 10, in 
    sys.exit(main())
  File "/tmp/tmp.K9027kudiX/venv/lib/python3.6/site-packages/black.py", line 5, in main
    raise NotImplementedError("This is still being implemented.")
NotImplementedError: This is still being implemented.
(venv) vfazio@vfazio1 /tmp/tmp.K9027kudiX :( $ pip list
Package       Version
------------- -------
attrs         19.1.0 
black         0.0    
Click         7.0    
pip           19.2.3 
pkg-resources 0.0.0  
setuptools    39.0.1 
(venv) vfazio@vfazio1 /tmp/tmp.K9027kudiX $ pip install --upgrade black --pre
Looking in indexes: https://pypi.xes-mad.com/upstream
Collecting black
  Using cached https://pypi.xes-mad.com/upstream/black/black-19.3b0-py36-none-any.whl
Requirement already satisfied, skipping upgrade: click>=6.5 in ./venv/lib/python3.6/site-packages (from black) (7.0)
Collecting toml>=0.9.4 (from black)
  Using cached https://pypi.xes-mad.com/upstream/toml/toml-0.10.0-py2.py3-none-any.whl
Collecting appdirs (from black)
  Using cached https://pypi.xes-mad.com/upstream/appdirs/appdirs-1.4.3-py2.py3-none-any.whl
Requirement already satisfied, skipping upgrade: attrs>=18.1.0 in ./venv/lib/python3.6/site-packages (from black) (19.1.0)
Installing collected packages: toml, appdirs, black
  Found existing installation: black 0.0
    Uninstalling black-0.0:
      Successfully uninstalled black-0.0
Successfully installed appdirs-1.4.3 black-19.3b0 toml-0.10.0
(venv) vfazio@vfazio1 /tmp/tmp.K9027kudiX $ black --version
black, version 19.3b0



vfazio@vfazio1 /tmp/tmp.K9027kudiX $ rm -rf venv/
vfazio@vfazio1 /tmp/tmp.K9027kudiX $ python3 -m venv venv
vfazio@vfazio1 /tmp/tmp.K9027kudiX $ . venv/bin/activate
(venv) vfazio@vfazio1 /tmp/tmp.K9027kudiX $ pip install -i https://pypi.org/simple black --no-cache
Collecting black
  Downloading https://files.pythonhosted.org/packages/30/62/cf549544a5fe990bbaeca21e9c419501b2de7a701ab0afb377bc81676600/black-19.3b0-py36-none-any.whl (89kB)
    100% |████████████████████████████████| 92kB 2.6MB/s 
Collecting attrs>=18.1.0 (from black)
  Downloading https://files.pythonhosted.org/packages/23/96/d828354fa2dbdf216eaa7b7de0db692f12c234f7ef888cc14980ef40d1d2/attrs-19.1.0-py2.py3-none-any.whl
Collecting toml>=0.9.4 (from black)
  Downloading https://files.pythonhosted.org/packages/a2/12/ced7105d2de62fa7c8fb5fce92cc4ce66b57c95fb875e9318dba7f8c5db0/toml-0.10.0-py2.py3-none-any.whl
Collecting appdirs (from black)
  Downloading https://files.pythonhosted.org/packages/56/eb/810e700ed1349edde4cbdc1b2a21e28cdf115f9faf263f6bbf8447c1abf3/appdirs-1.4.3-py2.py3-none-any.whl
Collecting click>=6.5 (from black)
  Downloading https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl (81kB)
    100% |████████████████████████████████| 81kB 3.1MB/s 
Installing collected packages: attrs, toml, appdirs, click, black
Successfully installed appdirs-1.4.3 attrs-19.1.0 black-19.3b0 click-7.0 toml-0.10.0
(venv) vfazio@vfazio1 /tmp/tmp.K9027kudiX $ pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
appdirs (1.4.3)
attrs (19.1.0)
black (19.3b0)
Click (7.0)
pip (9.0.1)
pkg-resources (0.0.0)
setuptools (39.0.1)
toml (0.10.0)

@Zlopez
Copy link
Contributor

Zlopez commented Aug 27, 2019

Ok, in this case I only recommend to add news file and I will approve it.

Copy link
Contributor

@Zlopez Zlopez left a comment

Choose a reason for hiding this comment

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

👍

@mergify mergify bot merged commit c8351ec into fedora-infra:master Aug 27, 2019
@vfazio vfazio deleted the vfazio-blackout branch August 27, 2019 17:04
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