Skip to content

Commit f5e9b3f

Browse files
committed
add python 3.9 and remove pkg_ressource usage
1 parent a21b7df commit f5e9b3f

12 files changed

Lines changed: 118 additions & 109 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: [3.6, 3.7, 3.8]
10+
python-version: [3.6, 3.7, 3.8, 3.9]
1111

1212
steps:
1313
- uses: actions/checkout@v2
1414
- name: Set up Python ${{ matrix.python-version }}
1515
uses: actions/setup-python@v2
1616
with:
1717
python-version: ${{ matrix.python-version }}
18-
18+
1919
- name: Install dependencies
2020
run: |
2121
python -m pip install --upgrade pip
2222
python -m pip install tox codecov pre-commit
23-
23+
2424
# Run tox using the version of Python in `PATH`
2525
- name: Run Tox
2626
run: tox -e py
27-
27+
2828
# Run pre-commit (only for python-3.7)
2929
- name: run pre-commit
3030
if: matrix.python-version == 3.7
3131
run: pre-commit run --all-files
32-
32+
3333
- name: Upload Results
3434
if: success()
3535
uses: codecov/codecov-action@v1
@@ -48,13 +48,13 @@ jobs:
4848
- name: Set up Python
4949
uses: actions/setup-python@v1
5050
with:
51-
python-version: "3.x"
52-
51+
python-version: "3.x"
52+
5353
- name: Install dependencies
5454
run: |
5555
python -m pip install --upgrade pip
5656
python -m pip install tox
57-
57+
5858
- name: Set tag version
5959
id: tag
6060
# https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
@@ -64,7 +64,7 @@ jobs:
6464
id: module
6565
# https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
6666
run: echo ::set-output name=version::$(python setup.py --version)
67-
67+
6868
- name: Build and publish
6969
if: steps.tag.outputs.tag == steps.module.outputs.version
7070
env:

CHANGES.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
1.1.0 (2021-05-07)
2+
------------------
3+
- update pre-commit config
4+
- add python3.9 in CI
5+
- add `setup.cfg` for linters
6+
- remove `pkg_resources` usage
7+
18
1.0.1 (2020-08-27)
2-
------------------------
9+
------------------
310
- add coverage.xml output from tox runs.
411

512
1.0.0.post2 (2020-08-21)

python_seed/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
"""python_seed."""
22

3-
import pkg_resources
4-
5-
version = pkg_resources.get_distribution(__package__).version
3+
__version__ = "1.0.1"

python_seed/scripts/cli.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@
44
import shutil
55

66
import click
7-
import pkg_resources
87

9-
from .. import version
8+
from .. import __version__
9+
10+
try:
11+
from importlib.resources import files as resources_files # type: ignore
12+
except ImportError:
13+
# Try backported to PY<39 `importlib_resources`.
14+
from importlib_resources import files as resources_files # type: ignore
1015

1116

1217
@click.group(short_help="python-seed CLI")
13-
@click.version_option(version=version, message="%(version)s")
18+
@click.version_option(version=__version__, message="%(version)s")
1419
def pyseed():
1520
"""python-seed subcommands."""
1621
pass
@@ -23,18 +28,18 @@ def pyseed():
2328
)
2429
def create(name, ci):
2530
"""Create new python seed skeleton."""
26-
template_dir = pkg_resources.resource_filename("python_seed", "template/module")
27-
31+
template_dir = str(resources_files("python_seed") / "template" / "module")
32+
print(template_dir)
2833
shutil.copytree(template_dir, name)
2934

3035
if ci:
31-
template_dir = pkg_resources.resource_filename(
32-
"python_seed", f"template/ci/.{ci}"
36+
template_dir = str(
37+
resources_files("python_seed") / "template" / "ci" / f".{ci}"
3338
)
3439
shutil.copytree(template_dir, f"{name}/.{ci}")
3540

36-
covconfig = pkg_resources.resource_filename(
37-
"python_seed", "template/cov/codecov.yml"
41+
covconfig = str(
42+
resources_files("python_seed") / "template" / "cov" / "codecov.yml"
3843
)
3944
shutil.copy2(covconfig, f"{name}/codecov.yml")
4045

python_seed/template/ci/.circleci/config.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,35 @@ jobs:
4646
"python-3.6":
4747
<<: *common
4848
docker:
49-
- image: circleci/python:3.6.5
49+
- image: cimg/python:3.6.13
5050
environment:
5151
- TOXENV=py36
5252

5353
"python-3.7":
5454
<<: *common
5555
docker:
56-
- image: circleci/python:3.7.2
56+
- image: cimg/python:3.7.10
5757
environment:
5858
- TOXENV=py37
5959
- UPLOAD_COVERAGE=1
6060

6161
"python-3.8":
6262
<<: *common
6363
docker:
64-
- image: circleci/python:3.8.4
64+
- image: cimg/python:3.8.10
6565
environment:
6666
- TOXENV=py38
6767

68+
"python-3.9":
69+
<<: *common
70+
docker:
71+
- image: cimg/python:3.9.5
72+
environment:
73+
- TOXENV=py39
74+
6875
deploy:
6976
docker:
70-
- image: circleci/python:3.7.2
77+
- image: cimg/python:3.7.10
7178
environment:
7279
- TOXENV=release
7380
working_directory: ~/pyseed
@@ -99,6 +106,7 @@ workflows:
99106
tags:
100107
only: /.*/
101108
- "python-3.8"
109+
- "python-3.9"
102110
- deploy:
103111
requires:
104112
- "python-3.7"

python_seed/template/ci/.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: [3.6, 3.7, 3.8]
10+
python-version: [3.6, 3.7, 3.8, 3.9]
1111

1212
steps:
1313
- uses: actions/checkout@v2
1414
- name: Set up Python ${{ matrix.python-version }}
1515
uses: actions/setup-python@v2
1616
with:
1717
python-version: ${{ matrix.python-version }}
18-
18+
1919
- name: Install dependencies
2020
run: |
2121
python -m pip install --upgrade pip
2222
python -m pip install tox codecov pre-commit
23-
23+
2424
# Run tox using the version of Python in `PATH`
2525
- name: Run Tox
2626
run: tox -e py
27-
27+
2828
# Run pre-commit (only for python-3.7)
2929
- name: run pre-commit
3030
if: matrix.python-version == 3.7
3131
run: pre-commit run --all-files
32-
32+
3333
- name: Upload Results
3434
if: success()
3535
uses: codecov/codecov-action@v1
@@ -49,13 +49,13 @@ jobs:
4949
- name: Set up Python
5050
uses: actions/setup-python@v1
5151
with:
52-
python-version: "3.x"
53-
52+
python-version: "3.x"
53+
5454
- name: Install dependencies
5555
run: |
5656
python -m pip install --upgrade pip
5757
python -m pip install tox
58-
58+
5959
- name: Set tag version
6060
id: tag
6161
# https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
@@ -65,7 +65,7 @@ jobs:
6565
id: module
6666
# https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
6767
run: echo ::set-output name=version::$(python setup.py --version)
68-
68+
6969
- name: Build and publish
7070
if: steps.tag.outputs.tag == steps.module.outputs.version
7171
env:
Lines changed: 28 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,30 @@
11
repos:
2-
-
3-
repo: https://github.com/pre-commit/mirrors-isort
4-
rev: v4.3.21
5-
hooks:
6-
- id: isort
7-
language_version: python3.7
8-
-
9-
repo: 'https://github.com/psf/black'
10-
rev: stable
11-
hooks:
12-
- id: black
13-
args: ['--safe']
14-
language_version: python3.7
15-
-
16-
repo: https://gitlab.com/PyCQA/flake8
17-
rev: 3.8.3
18-
hooks:
19-
- id: flake8
20-
language_version: python3.7
21-
args: [
22-
# E501 let black handle all line length decisions
23-
# W503 black conflicts with "line break before operator" rule
24-
# E203 black conflicts with "whitespace before ':'" rule
25-
'--ignore=E501,W503,E203']
26-
-
27-
repo: 'https://github.com/chewse/pre-commit-mirrors-pydocstyle'
28-
# 2.1.1
29-
rev: 22d3ccf6cf91ffce3b16caa946c155778f0cb20f
30-
hooks:
31-
- id: pydocstyle
32-
language_version: python3.7
33-
args: [
34-
# Check for docstring presence only
35-
'--select=D1',
36-
# Don't require docstrings for tests
37-
'--match=(?!test).*\.py']
2+
- repo: https://github.com/psf/black
3+
rev: 19.10b0
4+
hooks:
5+
- id: black
6+
language_version: python
387

39-
-
40-
repo: https://github.com/pre-commit/mirrors-mypy
41-
rev: 'v0.782'
42-
hooks:
43-
- id: mypy
44-
args: ['--no-strict-optional', '--ignore-missing-imports']
8+
- repo: https://github.com/PyCQA/isort
9+
rev: 5.4.2
10+
hooks:
11+
- id: isort
12+
language_version: python
13+
14+
- repo: https://github.com/PyCQA/flake8
15+
rev: 3.8.3
16+
hooks:
17+
- id: flake8
18+
language_version: python
19+
20+
- repo: https://github.com/PyCQA/pydocstyle
21+
rev: 5.1.1
22+
hooks:
23+
- id: pydocstyle
24+
language_version: python
25+
26+
- repo: https://github.com/pre-commit/mirrors-mypy
27+
rev: v0.812
28+
hooks:
29+
- id: mypy
30+
language_version: python
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
"""pyseed."""
22

3-
import pkg_resources
4-
5-
version = pkg_resources.get_distribution(__package__).version
3+
__version__ = "0.0.1"

python_seed/template/module/pyseed/scripts/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
import click
44

5-
from .. import version
5+
from .. import __version__
66

77

88
@click.group(short_help="pyseed CLI")
9-
@click.version_option(version=version, message="%(version)s")
9+
@click.version_option(version=__version__, message="%(version)s")
1010
def pyseed():
1111
"""pyseed subcommands."""
1212
pass
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[bumpversion]
2+
current_version = 0.0.1
3+
commit = True
4+
tag = True
5+
tag_name = {new_version}
6+
7+
[bumpversion:file:setup.py]
8+
search = version="{current_version}"
9+
replace = version="{new_version}"
10+
11+
[bumpversion:file:pyseed/__init__.py]
12+
search = __version__ = "{current_version}"
13+
replace = __version__ = "{new_version}"
14+
15+
[isort]
16+
profile = black
17+
known_first_party = pyseed
18+
19+
[flake8]
20+
ignore = E501,W503,E203
21+
exclude = .git,__pycache__,docs/source/conf.py,old,build,dist
22+
max-complexity = 12
23+
max-line-length = 90
24+
25+
[mypy]
26+
no_strict_optional = True
27+
ignore_missing_imports = True
28+
29+
[pydocstyle]
30+
select = D1
31+
match = (?!test).*\.py

0 commit comments

Comments
 (0)