Skip to content

Commit f87dd9c

Browse files
committed
Finishing off
1 parent bae61fb commit f87dd9c

15 files changed

Lines changed: 543 additions & 249 deletions

.pre-commit-config.yaml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.travis.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# This file is managed by `git_helper`. Don't edit it directly
2+
3+
language: python
4+
dist: xenial
5+
cache: pip
6+
python:
7+
- '3.6'
8+
- '3.7'
9+
- '3.8'
10+
- '3.9-dev'
11+
- 'pypy3'
12+
13+
install:
14+
15+
- pip install pip --upgrade
16+
- pip install tox tox-travis
17+
- pip install coveralls
18+
19+
script:
20+
- tox
21+
after_success:
22+
- coveralls
23+
24+
25+
stages:
26+
- test
27+
- deploy_pypi
28+
- deploy_conda
29+
- deploy_releases
30+
31+
jobs:
32+
include:
33+
- stage: deploy_pypi
34+
python: "3.6"
35+
script: skip
36+
deploy:
37+
on:
38+
tags: true
39+
repo: domdfcoding/flake8_strftime
40+
provider: pypi
41+
user: "DomDF"
42+
password:
43+
secure:
44+
distributions: "sdist bdist_wheel"
45+
skip_existing: true
46+
- stage: deploy_conda
47+
python: "3.6"
48+
addons:
49+
apt:
50+
update: true
51+
install:
52+
- pip install rst2txt yolk3k
53+
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
54+
- bash miniconda.sh -b -p $HOME/miniconda
55+
- chmod +x .ci/travis_deploy_conda.sh
56+
script: skip
57+
deploy:
58+
on:
59+
repo: domdfcoding/flake8_strftime
60+
provider: script
61+
script: .ci/travis_deploy_conda.sh || return 1;
62+
63+
- stage: deploy_releases
64+
python: "3.6"
65+
install:
66+
- pip install PyGithub requests
67+
script: skip
68+
deploy:
69+
on:
70+
repo: domdfcoding/flake8_strftime
71+
provider: script
72+
script: python .ci/copy_pypi_2_github.py || return 1;

README.md

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
[![Build Status](https://dev.azure.com/asottile/asottile/_apis/build/status/asottile.flake8-2020?branchName=master)](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=27&branchName=master)
2-
[![Azure DevOps coverage](https://img.shields.io/azure-devops/coverage/asottile/asottile/27/master.svg)](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=27&branchName=master)
3-
4-
flake8-2020
5-
===========
6-
7-
flake8 plugin which checks for misuse of `sys.version` or `sys.version_info`
8-
9-
this will become a problem when `python3.10` or `python4.0` exists (presumably
10-
during the year 2020).
11-
12-
you might also find an early build of [python3.10] useful
13-
14-
[python3.10]: https://github.com/asottile/python3.10
15-
16-
## installation
17-
18-
`pip install flake8-2020`
191

202
## flake8 codes
213

@@ -31,87 +13,3 @@ you might also find an early build of [python3.10] useful
3113
| YTT301 | `sys.version[0]` referenced (python10) |
3214
| YTT302 | `sys.version` compared to string (python10) |
3315
| YTT303 | `sys.version[:1]` referenced (python10) |
34-
35-
## rationale
36-
37-
lots of code incorrectly references the `sys.version` and `sys.version_info`
38-
members. in particular, this will cause some issues when the version of python
39-
after python3.9 is released. my current recommendation is 3.10 since I believe
40-
it breaks less code, here's a few patterns that will cause issues:
41-
42-
```python
43-
# in python3.10 this will report as '3.1' (should be '3.10')
44-
python_version = sys.version[:3] # YTT101
45-
# in python3.10 this will report as '1' (should be '10')
46-
py_minor = sys.version[2]
47-
# in python3.10 this will be False (which goes against developer intention)
48-
sys.version >= '3.5' # YTT103
49-
50-
51-
# correct way to do this
52-
python_version = '{}.{}'.format(*sys.version_info)
53-
py_minor = str(sys.version_info[1])
54-
sys.version_info >= (3, 5)
55-
```
56-
57-
```python
58-
# in python4 this will report as `False` (and suddenly run python2 code!)
59-
is_py3 = sys.version_info[0] == 3 # YTT201
60-
61-
# in python4 this will report as `False` (six violates YTT201!)
62-
if six.PY3: # YTT202
63-
print('python3!')
64-
65-
if sys.version_info[0] >= 3 and sys.version_info[1] >= 5: # YTT203
66-
print('py35+')
67-
68-
if sys.version_info.major >= 3 and sys.version_info.minor >= 6: # YTT204
69-
print('py36+')
70-
71-
# correct way to do this
72-
is_py3 = sys.version_info >= (3,)
73-
74-
if not six.PY2:
75-
print('python3!')
76-
77-
if sys.version_info >= (3, 5):
78-
print('py35+')
79-
80-
if sys.version_info >= (3, 6):
81-
print('py36+')
82-
```
83-
84-
```python
85-
# in python10 this will report as '1'
86-
python_major_version = sys.version[0] # YTT301
87-
# in python10 this will be False
88-
if sys.version >= '3': # YTT302
89-
print('python3!')
90-
# in python10 this will be False
91-
if sys.version[:1] >= '3': # YTT303
92-
print('python3!')
93-
94-
95-
# correct way to do this
96-
python_major_version = str(sys.version_info[0])
97-
98-
if sys.version_info >= (3,):
99-
print('python3!')
100-
101-
if sys.version_info >= (3,):
102-
print('python3!')
103-
```
104-
105-
## as a pre-commit hook
106-
107-
See [pre-commit](https://github.com/pre-commit/pre-commit) for instructions
108-
109-
Sample `.pre-commit-config.yaml`:
110-
111-
```yaml
112-
- repo: https://gitlab.com/pycqa/flake8
113-
rev: 3.7.8
114-
hooks:
115-
- id: flake8
116-
additional_dependencies: [flake8-2020==1.6.0]
117-
```

README.rst

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
################
2+
flake8_strftime
3+
################
4+
5+
.. start short_desc
6+
7+
**A flake8 plugin which checks for use of platform specific strftime codes.**
8+
9+
.. end short_desc
10+
11+
12+
.. start shields
13+
14+
.. list-table::
15+
:stub-columns: 1
16+
:widths: 10 90
17+
18+
* - Docs
19+
- |docs| |docs_check|
20+
* - Tests
21+
- |travis| |actions_windows| |actions_macos| |coveralls| |codefactor|
22+
* - PyPI
23+
- |pypi-version| |supported-versions| |supported-implementations| |wheel|
24+
* - Anaconda
25+
- |conda-version| |conda-platform|
26+
* - Activity
27+
- |commits-latest| |commits-since| |maintained|
28+
* - Other
29+
- |license| |language| |requires|
30+
31+
.. |docs| image:: https://img.shields.io/readthedocs/flake8_strftime/latest?logo=read-the-docs
32+
:target: https://flake8_strftime.readthedocs.io/en/latest/?badge=latest
33+
:alt: Documentation Status
34+
35+
.. |docs_check| image:: https://github.com/domdfcoding/flake8_strftime/workflows/Docs%20Check/badge.svg
36+
:target: https://github.com/domdfcoding/flake8_strftime/actions?query=workflow%3A%22Docs+Check%22
37+
:alt: Docs Check Status
38+
39+
.. |travis| image:: https://img.shields.io/travis/com/domdfcoding/flake8_strftime/master?logo=travis
40+
:target: https://travis-ci.com/domdfcoding/flake8_strftime
41+
:alt: Travis Build Status
42+
43+
.. |actions_windows| image:: https://github.com/domdfcoding/flake8_strftime/workflows/Windows%20Tests/badge.svg
44+
:target: https://github.com/domdfcoding/flake8_strftime/actions?query=workflow%3A%22Windows+Tests%22
45+
:alt: Windows Tests Status
46+
47+
.. |actions_macos| image:: https://github.com/domdfcoding/flake8_strftime/workflows/macOS%20Tests/badge.svg
48+
:target: https://github.com/domdfcoding/flake8_strftime/actions?query=workflow%3A%22macOS+Tests%22
49+
:alt: macOS Tests Status
50+
51+
.. |requires| image:: https://requires.io/github/domdfcoding/flake8_strftime/requirements.svg?branch=master
52+
:target: https://requires.io/github/domdfcoding/flake8_strftime/requirements/?branch=master
53+
:alt: Requirements Status
54+
55+
.. |coveralls| image:: https://img.shields.io/coveralls/github/domdfcoding/flake8_strftime/master?logo=coveralls
56+
:target: https://coveralls.io/github/domdfcoding/flake8_strftime?branch=master
57+
:alt: Coverage
58+
59+
.. |codefactor| image:: https://img.shields.io/codefactor/grade/github/domdfcoding/flake8_strftime?logo=codefactor
60+
:target: https://www.codefactor.io/repository/github/domdfcoding/flake8_strftime
61+
:alt: CodeFactor Grade
62+
63+
.. |pypi-version| image:: https://img.shields.io/pypi/v/flake8_strftime
64+
:target: https://pypi.org/project/flake8_strftime/
65+
:alt: PyPI - Package Version
66+
67+
.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/flake8_strftime
68+
:target: https://pypi.org/project/flake8_strftime/
69+
:alt: PyPI - Supported Python Versions
70+
71+
.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/flake8_strftime
72+
:target: https://pypi.org/project/flake8_strftime/
73+
:alt: PyPI - Supported Implementations
74+
75+
.. |wheel| image:: https://img.shields.io/pypi/wheel/flake8_strftime
76+
:target: https://pypi.org/project/flake8_strftime/
77+
:alt: PyPI - Wheel
78+
79+
.. |conda-version| image:: https://img.shields.io/conda/v/domdfcoding/flake8_strftime?logo=anaconda
80+
:alt: Conda - Package Version
81+
:target: https://anaconda.org/domdfcoding/flake8_strftime
82+
83+
.. |conda-platform| image:: https://img.shields.io/conda/pn/domdfcoding/flake8_strftime?label=conda%7Cplatform
84+
:alt: Conda - Platform
85+
:target: https://anaconda.org/domdfcoding/flake8_strftime
86+
87+
.. |license| image:: https://img.shields.io/github/license/domdfcoding/flake8_strftime
88+
:alt: License
89+
:target: https://github.com/domdfcoding/flake8_strftime/blob/master/LICENSE
90+
91+
.. |language| image:: https://img.shields.io/github/languages/top/domdfcoding/flake8_strftime
92+
:alt: GitHub top language
93+
94+
.. |commits-since| image:: https://img.shields.io/github/commits-since/domdfcoding/flake8_strftime/v0.0.0
95+
:target: https://github.com/domdfcoding/flake8_strftime/pulse
96+
:alt: GitHub commits since tagged version
97+
98+
.. |commits-latest| image:: https://img.shields.io/github/last-commit/domdfcoding/flake8_strftime
99+
:target: https://github.com/domdfcoding/flake8_strftime/commit/master
100+
:alt: GitHub last commit
101+
102+
.. |maintained| image:: https://img.shields.io/maintenance/yes/2020
103+
:alt: Maintenance
104+
105+
.. end shields
106+
107+
|
108+
109+
Installation
110+
--------------
111+
112+
.. start installation
113+
114+
``flake8_strftime`` can be installed from PyPI or Anaconda.
115+
116+
To install with ``pip``:
117+
118+
.. code-block:: bash
119+
120+
$ python -m pip install flake8_strftime
121+
122+
To install with ``conda``:
123+
124+
* First add the required channels
125+
126+
.. code-block:: bash
127+
128+
$ conda config --add channels http://conda.anaconda.org/domdfcoding
129+
$ conda config --add channels http://conda.anaconda.org/conda-forge
130+
131+
* Then install
132+
133+
.. code-block:: bash
134+
135+
$ conda install flake8_strftime
136+
137+
.. end installation

0 commit comments

Comments
 (0)