Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Commit 7007961

Browse files
authored
Move to poetry and automated relases via Github UI (#614)
* Move to poetry and automated relases via Github UI * Bump release notes to 6.2.0 * Fix readthedocs PR builds
1 parent b6cb2c6 commit 7007961

15 files changed

+214
-116
lines changed

.bumpversion.cfg

-18
This file was deleted.

.github/workflows/pre-release.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: Test PyPI publish
3+
4+
on:
5+
release:
6+
types: [prereleased]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
environment: pypi-dev
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Install poetry
17+
run: pipx install poetry
18+
19+
- name: Setup Python
20+
uses: actions/setup-python@v3
21+
with:
22+
python-version: "3.7"
23+
cache: "poetry"
24+
25+
- name: Install dependencies
26+
run: |
27+
poetry env use "3.7"
28+
poetry install
29+
30+
- name: Bump version number
31+
run: poetry version ${{ github.event.release.tag_name }}
32+
33+
- name: Build package
34+
run: poetry build
35+
36+
- name: Publish package
37+
run: poetry publish -r testpypi -u __token__ -p ${{ secrets.TEST_PYPI_PASSWORD }}

.github/workflows/release.yml

+28-34
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,37 @@
1-
name: Release
1+
---
2+
name: PyPI publish
23

34
on:
45
release:
5-
types:
6-
- published
7-
8-
env:
9-
DEFAULT_PYTHON: "3.11"
10-
11-
permissions:
12-
contents: read
6+
types: [released]
137

148
jobs:
15-
release-pypi:
16-
name: Upload release to PyPI
9+
build:
1710
runs-on: ubuntu-latest
18-
environment:
19-
name: pypi-prod
20-
url: https://pypi.org/project/pydocstyle/
11+
environment: pypi-prod
2112
steps:
22-
- name: Check out code from Github
23-
uses: actions/[email protected]
24-
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
25-
id: python
26-
uses: actions/[email protected]
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Install poetry
17+
run: pipx install poetry
18+
19+
- name: Setup Python
20+
uses: actions/setup-python@v3
2721
with:
28-
python-version: ${{ env.DEFAULT_PYTHON }}
29-
check-latest: true
30-
- name: Install requirements
31-
run: |
32-
python -m pip install twine build
33-
- name: Build distributions
34-
run: |
35-
python -m build
36-
- name: Upload to PyPI
37-
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
38-
env:
39-
TWINE_REPOSITORY: pypi
40-
TWINE_USERNAME: __token__
41-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
22+
python-version: "3.7"
23+
cache: "poetry"
24+
25+
- name: Install dependencies
4226
run: |
43-
twine upload --verbose dist/*
27+
poetry env use "3.7"
28+
poetry install
29+
30+
- name: Bump version number
31+
run: poetry version ${{ github.event.release.tag_name }}
32+
33+
- name: Build package
34+
run: poetry build
35+
36+
- name: Publish package
37+
run: poetry publish -u __token__ -p ${{ secrets.PYPI_PASSWORD }}

.github/workflows/test.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
name: Run tests
22

3-
on: [push, pull_request]
4-
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
510
jobs:
611
test-latest:
712
runs-on: ${{ matrix.os }}

docs/release_notes.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Release Notes
55
`Semantic Versioning <http://semver.org/>`_ specification.
66

77

8-
Current Development Version
8+
6.2.0 - January 2nd, 2023
99
---------------------------
1010

1111
New Features

poetry.lock

+82
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+36
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
[tool.poetry]
2+
name = "pydocstyle"
3+
version = "0.0.0-dev"
4+
description = "Python docstring style checker"
5+
authors = ["Amir Rachum <[email protected]>", "Sambhav Kothari <[email protected]"]
6+
license = "MIT"
7+
readme = "README.rst"
8+
documentation = "https://www.pydocstyle.org/en/stable/"
9+
homepage = "https://www.pydocstyle.org/en/stable/"
10+
repository = "https://github.com/PyCQA/pydocstyle"
11+
classifiers = [
12+
"Intended Audience :: Developers",
13+
"Environment :: Console",
14+
"Development Status :: 5 - Production/Stable",
15+
"Operating System :: OS Independent"
16+
]
17+
18+
[tool.poetry.urls]
19+
"Release Notes" = "https://www.pydocstyle.org/en/stable/release_notes.html"
20+
21+
[tool.poetry.dependencies]
22+
python = ">=3.6"
23+
snowballstemmer = ">=2.2.0"
24+
toml = {version = ">=0.10.2", optional = true}
25+
importlib-metadata = {version = ">=2.0.0,<5.0.0", python = "<3.8"}
26+
27+
[tool.poetry.extras]
28+
toml = ["toml"]
29+
30+
[tool.poetry.scripts]
31+
pydocstyle = "pydocstyle.cli:main"
32+
33+
[build-system]
34+
requires = ["poetry-core"]
35+
build-backend = "poetry.core.masonry.api"
36+
137
[tool.black]
238
line-length = 79
339
target-version = ['py36']

requirements/docs.txt

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ sphinx==1.6.2
55
# Pinned to 3.0.3 to prevent an issue with Sphinx
66
# See https://github.com/PyCQA/pydocstyle/pull/585
77
Jinja2==3.0.3
8+
# adding . so that pydocstyle gets installed
9+
.

requirements/runtime.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
snowballstemmer==1.2.1
2-
toml==0.10.2
1+
snowballstemmer>=1.2.1
2+
toml>=0.10.2
3+
importlib-metadata<5.0.0,>=2.0.0; python_version < "3.8"

setup.py

-53
This file was deleted.

src/pydocstyle/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
from ._version import __version__
2+
13
# Temporary hotfix for flake8-docstrings
24
from .checker import ConventionChecker, check
35
from .parser import AllError
4-
from .utils import __version__
56
from .violations import Error, conventions

src/pydocstyle/_version.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import sys
2+
3+
if sys.version_info[:2] >= (3, 8):
4+
from importlib import metadata
5+
else:
6+
import importlib_metadata as metadata # pragma: no cover
7+
8+
# Used to automatically set version number from github actions
9+
# as well as not break when being tested locally
10+
try:
11+
__version__ = metadata.version(__package__)
12+
except metadata.PackageNotFoundError: # pragma: no cover
13+
__version__ = "0.0.0"

src/pydocstyle/config.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
from functools import reduce
1111
from re import compile as re
1212

13-
from .utils import __version__, log
13+
from ._version import __version__
14+
from .utils import log
1415
from .violations import ErrorRegistry, conventions
1516

1617
try:

src/pydocstyle/utils.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
"""General shared utilities."""
2-
import ast
32
import logging
43
import re
54
from itertools import tee, zip_longest
65
from typing import Any, Iterable, Tuple
76

87
# Do not update the version manually - it is managed by `bumpversion`.
9-
__version__ = '6.1.2rc'
108
log = logging.getLogger(__name__)
119

1210
#: Regular expression for stripping non-alphanumeric characters

0 commit comments

Comments
 (0)