diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index 00a9651a..00000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,18 +0,0 @@ -[bumpversion] -current_version = 6.1.2rc -commit = True -parse = (?P\d+)\.(?P\d+)\.(?P\d+)((?P.*))? -serialize = - {major}.{minor}.{patch}{release} - {major}.{minor}.{patch} -tag_name = {new_version} - -[bumpversion:part:release] -optional_value = production -values = - rc - production - -[bumpversion:file:setup.py] - -[bumpversion:file:src/pydocstyle/utils.py] diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml new file mode 100644 index 00000000..f2511e55 --- /dev/null +++ b/.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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 61626a67..59f10fa1 100644 --- a/.github/workflows/release.yml +++ b/.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 }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9fe23070..ae9a2d81 100644 --- a/.github/workflows/test.yml +++ b/.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 }} diff --git a/docs/release_notes.rst b/docs/release_notes.rst index a9060aef..d7ca27fb 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -5,7 +5,7 @@ Release Notes `Semantic Versioning `_ specification. -Current Development Version +6.2.0 - January 2nd, 2023 --------------------------- New Features diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 00000000..458a3a06 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,82 @@ +# This file is automatically @generated by Poetry and should not be changed by hand. + +[[package]] +name = "importlib-metadata" +version = "4.8.3" +description = "Read metadata from Python packages" +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "importlib_metadata-4.8.3-py3-none-any.whl", hash = "sha256:65a9576a5b2d58ca44d133c42a241905cc45e34d2c06fd5ba2bafa221e5d7b5e"}, + {file = "importlib_metadata-4.8.3.tar.gz", hash = "sha256:766abffff765960fcc18003801f7044eb6755ffae4521c8e8ce8e83b9c9b0668"}, +] + +[package.dependencies] +typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} +zipp = ">=0.5" + +[package.extras] +docs = ["jaraco.packaging (>=8.2)", "rst.linker (>=1.9)", "sphinx"] +perf = ["ipython"] +testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pep517", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-flake8", "pytest-mypy", "pytest-perf (>=0.9.2)"] + +[[package]] +name = "snowballstemmer" +version = "2.2.0" +description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms." +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "snowballstemmer-2.2.0-py2.py3-none-any.whl", hash = "sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a"}, + {file = "snowballstemmer-2.2.0.tar.gz", hash = "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1"}, +] + +[[package]] +name = "toml" +version = "0.10.2" +description = "Python Library for Tom's Obvious, Minimal Language" +category = "main" +optional = true +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +files = [ + {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, + {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, +] + +[[package]] +name = "typing-extensions" +version = "4.1.1" +description = "Backported and Experimental Type Hints for Python 3.6+" +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "typing_extensions-4.1.1-py3-none-any.whl", hash = "sha256:21c85e0fe4b9a155d0799430b0ad741cdce7e359660ccbd8b530613e8df88ce2"}, + {file = "typing_extensions-4.1.1.tar.gz", hash = "sha256:1a9462dcc3347a79b1f1c0271fbe79e844580bb598bafa1ed208b94da3cdcd42"}, +] + +[[package]] +name = "zipp" +version = "3.6.0" +description = "Backport of pathlib-compatible object wrapper for zip files" +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "zipp-3.6.0-py3-none-any.whl", hash = "sha256:9fe5ea21568a0a70e50f273397638d39b03353731e6cbbb3fd8502a33fec40bc"}, + {file = "zipp-3.6.0.tar.gz", hash = "sha256:71c644c5369f4a6e07636f0aa966270449561fcea2e3d6747b8d23efaa9d7832"}, +] + +[package.extras] +docs = ["jaraco.packaging (>=8.2)", "rst.linker (>=1.9)", "sphinx"] +testing = ["func-timeout", "jaraco.itertools", "pytest (>=4.6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-flake8", "pytest-mypy"] + +[extras] +toml = ["toml"] + +[metadata] +lock-version = "2.0" +python-versions = ">=3.6" +content-hash = "cd980bd00cd4a5ba9efb4e38007da4c71deab59aac093b9eb1042d2d43505dc6" diff --git a/pyproject.toml b/pyproject.toml index 8992803e..607aa3fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,39 @@ +[tool.poetry] +name = "pydocstyle" +version = "0.0.0-dev" +description = "Python docstring style checker" +authors = ["Amir Rachum ", "Sambhav Kothari =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'] diff --git a/requirements/docs.txt b/requirements/docs.txt index 8d24eb88..29a63fed 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -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 +. diff --git a/requirements/runtime.txt b/requirements/runtime.txt index 80302751..ad37b513 100644 --- a/requirements/runtime.txt +++ b/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" diff --git a/setup.py b/setup.py deleted file mode 100644 index a9c5df1c..00000000 --- a/setup.py +++ /dev/null @@ -1,53 +0,0 @@ -from setuptools import setup - -# Do not update the version manually - it is managed by `bumpversion`. -version = '6.1.2rc' - - -requirements = [ - 'snowballstemmer', -] -extra_requirements = { - 'toml': ['toml'], -} - - -setup( - name='pydocstyle', - version=version, - description="Python docstring style checker", - long_description=open('README.rst').read(), - license='MIT', - author='Amir Rachum', - author_email='amir@rachum.com', - url='https://github.com/PyCQA/pydocstyle/', - classifiers=[ - 'Intended Audience :: Developers', - 'Environment :: Console', - 'Development Status :: 5 - Production/Stable', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3 :: Only', - 'Operating System :: OS Independent', - 'License :: OSI Approved :: MIT License', - ], - python_requires='>=3.6', - keywords='pydocstyle, PEP 257, pep257, PEP 8, pep8, docstrings', - packages=('pydocstyle',), - package_dir={'': 'src'}, - package_data={'pydocstyle': ['data/*.txt']}, - install_requires=requirements, - extras_require=extra_requirements, - entry_points={ - 'console_scripts': [ - 'pydocstyle = pydocstyle.cli:main', - ], - }, - project_urls={ - 'Release Notes': 'https://www.pydocstyle.org/en/latest/release_notes.html', - }, -) diff --git a/src/pydocstyle/__init__.py b/src/pydocstyle/__init__.py index 3fb5499e..363ea3ff 100644 --- a/src/pydocstyle/__init__.py +++ b/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 diff --git a/src/pydocstyle/_version.py b/src/pydocstyle/_version.py new file mode 100644 index 00000000..185d331f --- /dev/null +++ b/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" diff --git a/src/pydocstyle/config.py b/src/pydocstyle/config.py index ed00c874..4819cde5 100644 --- a/src/pydocstyle/config.py +++ b/src/pydocstyle/config.py @@ -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: diff --git a/src/pydocstyle/utils.py b/src/pydocstyle/utils.py index b88681b2..c4e3295f 100644 --- a/src/pydocstyle/utils.py +++ b/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 diff --git a/tox.ini b/tox.ini index 048ac44b..dc0d6691 100644 --- a/tox.ini +++ b/tox.ini @@ -26,7 +26,7 @@ deps = [testenv:install] skip_install = True commands = - python setup.py bdist_wheel + pip wheel . -w dist --no-deps pip install --no-index --find-links=dist pydocstyle pydocstyle --help @@ -64,4 +64,3 @@ commands = {[testenv:install]commands} [testenv:py310-install] skip_install = {[testenv:install]skip_install} commands = {[testenv:install]commands} -