diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index 85a103c..0000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,17 +0,0 @@ -[bumpversion] -commit = True -tag = True -message = "Release {new_version}" -current_version = 0.6.2 - -[bumpversion:file:setup.cfg] -search = version = {current_version} -replace = version = {new_version} - -[bumpversion:file:src/port_for/__init__.py] - -[bumpversion:file:CHANGES.rst] -search = unreleased - ---------- -replace = {new_version} - ---------- diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index c16adf0..01430f3 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -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]' }} diff --git a/Pipfile b/Pipfile index af87728..603708f 100644 --- a/Pipfile +++ b/Pipfile @@ -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" diff --git a/Pipfile.lock b/Pipfile.lock index 0dae894..28672bd 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "4b6c32aac959a3ff9b2b9c1be25868be2af2d3478aa9cdf64a1573119901373c" + "sha256": "6d3cabf24024e99de98efca883c80051b3a7be0561bde81c7c7c8914e448f72c" }, "pipfile-spec": 6, "requires": {}, @@ -41,6 +41,14 @@ "index": "pypi", "version": "==22.12.0" }, + "cli-ui": { + "hashes": [ + "sha256:2f67e50cf474e76ad160c3e660bbad98bf8b8dfb8d847765f3a261b7e13c05fa", + "sha256:6a1ebdbbcd83a0fa06b2f63f4434082a3ba8664aebedd91f1ff86b9e4289d53e" + ], + "markers": "python_version >= '3.7' and python_version < '4.0'", + "version": "==0.17.2" + }, "click": { "hashes": [ "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e", @@ -55,6 +63,22 @@ ], "version": "==1.2.2" }, + "colorama": { + "hashes": [ + "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", + "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'", + "version": "==0.4.6" + }, + "contextlib2": { + "hashes": [ + "sha256:3fbdb64466afd23abaf6c977627b75b6139a5a3e8ce38405c5b413aed7a0471f", + "sha256:ab1e2bfe1d01d968e1b7e8d9023bc51ef3509bba217bb730cee3827e1ee82869" + ], + "markers": "python_version >= '3.6'", + "version": "==21.6.0" + }, "coverage": { "hashes": [ "sha256:027018943386e7b942fa832372ebc120155fd970837489896099f5cfa2890f79", @@ -111,6 +135,12 @@ "index": "pypi", "version": "==6.5.0" }, + "docopt": { + "hashes": [ + "sha256:49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491" + ], + "version": "==0.6.2" + }, "incremental": { "hashes": [ "sha256:912feeb5e0f7e0188e6f42241d2f450002e11bbc0937c65865045854c24c0bd0", @@ -289,6 +319,13 @@ "index": "pypi", "version": "==4.0.0" }, + "schema": { + "hashes": [ + "sha256:f06717112c61895cabc4707752b88716e8420a8819d71404501e114f91043197", + "sha256:f3ffdeeada09ec34bf40d7d79996d9f7175db93b7a5065de0faa7f41083c1e6c" + ], + "version": "==0.7.5" + }, "setuptools": { "hashes": [ "sha256:57f6f22bde4e042978bcd50176fdb381d7c21a9efa4041202288d3737a0c6a54", @@ -304,6 +341,23 @@ ], "version": "==2.2.0" }, + "tabulate": { + "hashes": [ + "sha256:0ba055423dbaa164b9e456abe7920c5e8ed33fcc16f6d1b2f2d152c8e1e8b4fc", + "sha256:436f1c768b424654fce8597290d2764def1eea6a77cfa5c33be00b1bc0f4f63d", + "sha256:6c57f3f3dd7ac2782770155f3adb2db0b1a269637e42f27599925e64b114f519" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", + "version": "==0.8.10" + }, + "tbump": { + "hashes": [ + "sha256:683eab2e5a4d4861b6928c422d9e51e1d3aeccbbd69d0281fab2c374345e1d9f", + "sha256:cf711835b155eaefcf2023ca8963200d893cb40998c9393684df020e6ab1c0b3" + ], + "index": "pypi", + "version": "==6.9.0" + }, "toml": { "hashes": [ "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b", @@ -319,6 +373,14 @@ "markers": "python_version >= '3.7'", "version": "==2.0.1" }, + "tomlkit": { + "hashes": [ + "sha256:07de26b0d8cfc18f871aec595fda24d95b08fef89d147caa861939f37230bf4b", + "sha256:71b952e5721688937fb02cf9d354dbcf0785066149d2855e44531ebdd2b65d73" + ], + "markers": "python_version >= '3.6'", + "version": "==0.11.6" + }, "towncrier": { "hashes": [ "sha256:3b780c3d966e1b26414830aec3d15000654b31e64e024f3e5fd128b4c6eb8f47", @@ -334,6 +396,14 @@ ], "markers": "python_version >= '3.7'", "version": "==4.4.0" + }, + "unidecode": { + "hashes": [ + "sha256:547d7c479e4f377b430dd91ac1275d593308dce0fc464fb2ab7d41f82ec653be", + "sha256:fed09cf0be8cf415b391642c2a5addfc72194407caee4f98719e40ec2a72b830" + ], + "markers": "python_version >= '3.5'", + "version": "==1.3.6" } } } diff --git a/README.rst b/README.rst index 0b44cea..d863f61 100644 --- a/README.rst +++ b/README.rst @@ -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 \ No newline at end of file +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] diff --git a/newsfragments/109.misc.rst b/newsfragments/109.misc.rst new file mode 100644 index 0000000..9b920ec --- /dev/null +++ b/newsfragments/109.misc.rst @@ -0,0 +1 @@ +Migrate versioning tool to tbump, and move package definition to pyproject.toml \ No newline at end of file diff --git a/scripts/port-for b/port_for/cmd.py similarity index 95% rename from scripts/port-for rename to port_for/cmd.py index f21a764..8667dd7 100644 --- a/scripts/port-for +++ b/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. @@ -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__, @@ -60,3 +60,7 @@ def _unbind(app: str) -> None: _list() elif args["--unbind"]: _unbind(args["--unbind"]) + + +if __name__ == "__main__": + main() diff --git a/pyproject.toml b/pyproject.toml index 2801374..e4ecbd5 100644 --- a/pyproject.toml +++ b/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 @@ -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///" + +[tool.tbump.version] +current = "0.6.2" + +# Example of a semver regexp. +# Make sure this matches current_version before +# using tbump +regex = ''' + (?P\d+) + \. + (?P\d+) + \. + (?P\d+) + (\- + (?P.+) + )? + ''' + +[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" \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index a39e94d..7592ce9 100644 --- a/setup.cfg +++ b/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/*