Skip to content

Commit

Permalink
Migrate versioning tool to tbump, and most of setup.cfg into pyprojec…
Browse files Browse the repository at this point in the history
…t.toml
  • Loading branch information
fizyk committed Dec 15, 2022
1 parent 66de07d commit ec2f107
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 78 deletions.
17 changes: 0 additions & 17 deletions .bumpversion.cfg

This file was deleted.

20 changes: 10 additions & 10 deletions .github/workflows/pr-check.yml
Expand Up @@ -5,16 +5,16 @@ on:
branches: [ master ]

jobs:
# bump:
# runs-on: ubuntu-latest
# steps:
# - name: Check out repository
# uses: actions/checkout@v3
# - uses: fizyk/actions-reuse/.github/actions/pipenv@v1.6.3
# with:
# python-version: "3.11"
# pipenv-install-options: "--skip-lock"
# command: tbump --dry-run --only-patch $(pipenv run tbump current-version)"-x"
bump:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- uses: fizyk/actions-reuse/.github/actions/pipenv@v1.6.3
with:
python-version: "3.11"
pipenv-install-options: "--skip-lock"
command: tbump --dry-run --only-patch $(pipenv run tbump current-version)"-x"
towncrier:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
Expand Down
1 change: 1 addition & 0 deletions Pipfile
Expand Up @@ -14,3 +14,4 @@ black = "==22.12.0"
pydocstyle = {version = "==6.1.1", extras = ["toml"]}
pycodestyle = "==2.10.0"
mypy = "==0.991"
tbump = "==6.9.0"
72 changes: 71 additions & 1 deletion Pipfile.lock

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

11 changes: 10 additions & 1 deletion README.rst
Expand Up @@ -158,4 +158,13 @@ Contributing

Development happens at github: https://github.com/kmike/port-for/

Issue tracker: https://github.com/kmike/port-for/issues/new
Issue tracker: https://github.com/kmike/port-for/issues/new

Release
=======

Install pipenv and --dev dependencies first, Then run:

.. code-block::
pipenv run tbump [NEW_VERSION]
1 change: 1 addition & 0 deletions newsfragments/109.misc.rst
@@ -0,0 +1 @@
Migrate versioning tool to tbump, and move package definition to pyproject.toml
8 changes: 6 additions & 2 deletions scripts/port-for → port_for/cmd.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
"""
port-for is a command-line utility that
cmd.py is a command-line utility that
helps with local TCP ports management. It
finds 'good' unused TCP localhost port and
remembers the association.
Expand Down Expand Up @@ -47,7 +47,7 @@ def _unbind(app: str) -> None:
store.unbind_port(app)


if __name__ == "__main__":
def main() -> None:
args = docopt(
__doc__,
version="port-for %s" % port_for.__version__,
Expand All @@ -60,3 +60,7 @@ def _unbind(app: str) -> None:
_list()
elif args["--unbind"]:
_unbind(args["--unbind"])


if __name__ == "__main__":
main()
109 changes: 108 additions & 1 deletion pyproject.toml
@@ -1,7 +1,53 @@
[project]
name = "port-for"
version = "0.6.2"
description = "Utility that helps with local TCP ports management. It can find an unused TCP localhost port and remember the association."
readme = "README.rst"
keywords = ["port", "posix"]
license = {file = "LICENSE.txt"}
authors = [
{name = "Mikhail Korobov", email = "kmike84@gmail.com"}
]
maintainers = [
{name = "Grzegorz Śliwiński", email = "fizyk+pypi@fizyk.dev"}
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Operating System :: POSIX",
"Topic :: System :: Installation/Setup",
"Topic :: System :: Systems Administration",
"Topic :: Internet :: WWW/HTTP :: Site Management",
]
requires-python = ">= 3.7"

[project.urls]
"Source" = "https://github.com/kmike/port-for/"
"Bug Tracker" = "https://github.com/kmike/port-for/issues"
"Changelog" = "https://github.com/kmike/port-for/blob/v0.6.2/CHANGES.rst"

[project.scripts]
port-for = "port_for.cmd:main"

[build-system]
requires = ["setuptools >= 40.6.0", "wheel"]
requires = ["setuptools >= 61.0.0", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
zip-safe = true
packages = ["port_for"]

[tool.setuptools.package-data]
port_for = ["py.typed"]

[tool.towncrier]
directory = "newsfragments"
single_file=true
Expand All @@ -28,3 +74,64 @@ showcontent = true
line-length = 80
target-version = ['py38']
include = '.*\.pyi?$'


[tool.tbump]
# Uncomment this if your project is hosted on GitHub:
# github_url = "https://github.com/<user or organization>/<project>/"

[tool.tbump.version]
current = "0.6.2"

# Example of a semver regexp.
# Make sure this matches current_version before
# using tbump
regex = '''
(?P<major>\d+)
\.
(?P<minor>\d+)
\.
(?P<patch>\d+)
(\-
(?P<extra>.+)
)?
'''

[tool.tbump.git]
message_template = "Release {new_version}"
tag_template = "v{new_version}"

[[tool.tbump.field]]
# the name of the field
name = "extra"
# the default value to use, if there is no match
default = ""


# For each file to patch, add a [[file]] config
# section containing the path of the file, relative to the
# tbump.toml location.
[[tool.tbump.file]]
src = "port_for/__init__.py"

[[tool.tbump.file]]
src = "pyproject.toml"
search = 'version = "{current_version}"'

[[tool.tbump.file]]
src = "pyproject.toml"
search = '"Changelog" = "https://github.com/kmike/port-for/blob/v{current_version}/CHANGES.rst"'

# You can specify a list of commands to
# run after the files have been patched
# and before the git commit is made

[[tool.tbump.before_commit]]
name = "Build changelog"
cmd = "pipenv run towncrier build --version {new_version} --yes"

# Or run some commands after the git tag and the branch
# have been pushed:
# [[tool.tbump.after_push]]
# name = "publish"
# cmd = "./publish.sh"
46 changes: 0 additions & 46 deletions setup.cfg
@@ -1,49 +1,3 @@
[metadata]
name = port-for
version = 0.6.2
url = https://github.com/kmike/port-for/
description = Utility that helps with local TCP ports management. It can find an unused TCP localhost port and remember the association.
long_description = file: README.rst, CHANGES.rst
long_description_content_type = text/x-rst
keywords = port, posix
license = MIT license
author = Mikhail Korobov
author_email = kmike84@gmail.com
maintainer = Grzegorz Śliwiński
maintainer_email = fizyk+pypi@fizyk.net.pl
classifiers =
Development Status :: 4 - Beta
Intended Audience :: Developers
Intended Audience :: System Administrators
License :: OSI Approved :: MIT License
Programming Language :: Python
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
Operating System :: POSIX
Topic :: System :: Installation/Setup
Topic :: System :: Systems Administration
Topic :: Internet :: WWW/HTTP :: Site Management

[options]
zip_safe = False
include_package_data = True
python_requires = >= 3.7
packages = port_for
scripts =
scripts/port-for

[options.extras_require]
tests =
pytest
pytest-cov

[options.package_data]
port_for = py.typed

[pycodestyle]
max-line-length = 80
exclude = docs/*,build/*,venv/*
Expand Down

0 comments on commit ec2f107

Please sign in to comment.