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

Commit

Permalink
Move to poetry and automated relases via Github UI (#614)
Browse files Browse the repository at this point in the history
* Move to poetry and automated relases via Github UI

* Bump release notes to 6.2.0

* Fix readthedocs PR builds
  • Loading branch information
samj1912 committed Jan 2, 2023
1 parent b6cb2c6 commit 7007961
Show file tree
Hide file tree
Showing 15 changed files with 214 additions and 116 deletions.
18 changes: 0 additions & 18 deletions .bumpversion.cfg

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/pre-release.yml
@@ -0,0 +1,37 @@
---
name: Test PyPI publish

on:
release:
types: [prereleased]

jobs:
build:
runs-on: ubuntu-latest
environment: pypi-dev
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install poetry
run: pipx install poetry

- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: "3.7"
cache: "poetry"

- name: Install dependencies
run: |
poetry env use "3.7"
poetry install
- name: Bump version number
run: poetry version ${{ github.event.release.tag_name }}

- name: Build package
run: poetry build

- name: Publish package
run: poetry publish -r testpypi -u __token__ -p ${{ secrets.TEST_PYPI_PASSWORD }}
62 changes: 28 additions & 34 deletions .github/workflows/release.yml
@@ -1,43 +1,37 @@
name: Release
---
name: PyPI publish

on:
release:
types:
- published

env:
DEFAULT_PYTHON: "3.11"

permissions:
contents: read
types: [released]

jobs:
release-pypi:
name: Upload release to PyPI
build:
runs-on: ubuntu-latest
environment:
name: pypi-prod
url: https://pypi.org/project/pydocstyle/
environment: pypi-prod
steps:
- name: Check out code from Github
uses: actions/checkout@v3.2.0
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v4.4.0
- name: Checkout code
uses: actions/checkout@v3

- name: Install poetry
run: pipx install poetry

- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
- name: Install requirements
run: |
python -m pip install twine build
- name: Build distributions
run: |
python -m build
- name: Upload to PyPI
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
env:
TWINE_REPOSITORY: pypi
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
python-version: "3.7"
cache: "poetry"

- name: Install dependencies
run: |
twine upload --verbose dist/*
poetry env use "3.7"
poetry install
- name: Bump version number
run: poetry version ${{ github.event.release.tag_name }}

- name: Build package
run: poetry build

- name: Publish package
run: poetry publish -u __token__ -p ${{ secrets.PYPI_PASSWORD }}
9 changes: 7 additions & 2 deletions .github/workflows/test.yml
@@ -1,7 +1,12 @@
name: Run tests

on: [push, pull_request]

on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test-latest:
runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion docs/release_notes.rst
Expand Up @@ -5,7 +5,7 @@ Release Notes
`Semantic Versioning <http://semver.org/>`_ specification.


Current Development Version
6.2.0 - January 2nd, 2023
---------------------------

New Features
Expand Down
82 changes: 82 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions pyproject.toml
@@ -1,3 +1,39 @@
[tool.poetry]
name = "pydocstyle"
version = "0.0.0-dev"
description = "Python docstring style checker"
authors = ["Amir Rachum <amir@rachum.com>", "Sambhav Kothari <sambhavs.email@gmail.com"]
license = "MIT"
readme = "README.rst"
documentation = "https://www.pydocstyle.org/en/stable/"
homepage = "https://www.pydocstyle.org/en/stable/"
repository = "https://github.com/PyCQA/pydocstyle"
classifiers = [
"Intended Audience :: Developers",
"Environment :: Console",
"Development Status :: 5 - Production/Stable",
"Operating System :: OS Independent"
]

[tool.poetry.urls]
"Release Notes" = "https://www.pydocstyle.org/en/stable/release_notes.html"

[tool.poetry.dependencies]
python = ">=3.6"
snowballstemmer = ">=2.2.0"
toml = {version = ">=0.10.2", optional = true}
importlib-metadata = {version = ">=2.0.0,<5.0.0", python = "<3.8"}

[tool.poetry.extras]
toml = ["toml"]

[tool.poetry.scripts]
pydocstyle = "pydocstyle.cli:main"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.black]
line-length = 79
target-version = ['py36']
Expand Down
2 changes: 2 additions & 0 deletions requirements/docs.txt
Expand Up @@ -5,3 +5,5 @@ sphinx==1.6.2
# Pinned to 3.0.3 to prevent an issue with Sphinx
# See https://github.com/PyCQA/pydocstyle/pull/585
Jinja2==3.0.3
# adding . so that pydocstyle gets installed
.
5 changes: 3 additions & 2 deletions requirements/runtime.txt
@@ -1,2 +1,3 @@
snowballstemmer==1.2.1
toml==0.10.2
snowballstemmer>=1.2.1
toml>=0.10.2
importlib-metadata<5.0.0,>=2.0.0; python_version < "3.8"
53 changes: 0 additions & 53 deletions setup.py

This file was deleted.

3 changes: 2 additions & 1 deletion src/pydocstyle/__init__.py
@@ -1,5 +1,6 @@
from ._version import __version__

# Temporary hotfix for flake8-docstrings
from .checker import ConventionChecker, check
from .parser import AllError
from .utils import __version__
from .violations import Error, conventions
13 changes: 13 additions & 0 deletions src/pydocstyle/_version.py
@@ -0,0 +1,13 @@
import sys

if sys.version_info[:2] >= (3, 8):
from importlib import metadata
else:
import importlib_metadata as metadata # pragma: no cover

# Used to automatically set version number from github actions
# as well as not break when being tested locally
try:
__version__ = metadata.version(__package__)
except metadata.PackageNotFoundError: # pragma: no cover
__version__ = "0.0.0"
3 changes: 2 additions & 1 deletion src/pydocstyle/config.py
Expand Up @@ -10,7 +10,8 @@
from functools import reduce
from re import compile as re

from .utils import __version__, log
from ._version import __version__
from .utils import log
from .violations import ErrorRegistry, conventions

try:
Expand Down
2 changes: 0 additions & 2 deletions src/pydocstyle/utils.py
@@ -1,12 +1,10 @@
"""General shared utilities."""
import ast
import logging
import re
from itertools import tee, zip_longest
from typing import Any, Iterable, Tuple

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

#: Regular expression for stripping non-alphanumeric characters
Expand Down

0 comments on commit 7007961

Please sign in to comment.