Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion py/envoy.distribution.release/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.10-dev
0.0.10.dev0
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

import sys
from typing import Optional

from .runner import ReleaseRunner
from .commands import (
Expand All @@ -26,7 +25,7 @@ def _register_commands():
# from memory_profiler import profile

# @profile
def main(*args: str) -> Optional[int]:
def main(*args: str) -> int | None:
_register_commands()
result = ReleaseRunner(*args)()
return result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import argparse
import pathlib
import re
from typing import Dict, List, Optional, Pattern

from aio.core.functional import async_property

Expand All @@ -11,7 +10,7 @@

class AssetsCommand(AGithubReleaseCommand):

async def run(self) -> Optional[int]:
async def run(self) -> int | None:
assets = await self.release.assets
if not assets:
self.runner.log.warning(f"Version {self.version} has no assets")
Expand All @@ -31,35 +30,35 @@ def add_arguments(self, parser: argparse.ArgumentParser) -> None:
"Path to push assets from, can either be a directory "
"or a tarball"))

async def run(self) -> Optional[int]:
async def run(self) -> int | None:
return self.format_response(
**await self.release.create(assets=self.artefacts))


class DeleteCommand(AGithubReleaseCommand):

async def run(self) -> Optional[int]:
async def run(self) -> int | None:
await self.release.delete()
return 0


class InfoCommand(AGithubReleaseCommand):

async def run(self) -> Optional[int]:
async def run(self) -> int | None:
return self.format_response(await self.release.release)


class ListCommand(AGithubReleaseCommand):

async def run(self) -> Optional[int]:
async def run(self) -> int | None:
for release in await self.runner.release_manager.releases:
self.runner.stdout.info(release["tag_name"])


class FetchCommand(AGithubReleaseCommand):

@property
def asset_types(self) -> Dict[str, Pattern]:
def asset_types(self) -> dict[str, re.Pattern]:
return {
t.split(":", 1)[0]: re.compile(t.split(":", 1)[1])
for t in self.args.asset_type or []}
Expand All @@ -73,7 +72,7 @@ def find_latest(self) -> bool:
return any(release.count(".") < 2 for release in self.versions)

@async_property(cache=True)
async def releases(self) -> Dict[str, AGithubRelease]:
async def releases(self) -> dict[str, AGithubRelease]:
if self.find_latest:
latest = await self.manager.latest
return {
Expand All @@ -84,7 +83,7 @@ async def releases(self) -> Dict[str, AGithubRelease]:
for version in self.versions}

@property
def versions(self) -> List[str]:
def versions(self) -> list[str]:
return self.args.version

def add_arguments(self, parser: argparse.ArgumentParser) -> None:
Expand All @@ -104,7 +103,7 @@ def add_arguments(self, parser: argparse.ArgumentParser) -> None:
nargs="*",
help="Regex to match asset type and folder to fetch assets into")

async def run(self) -> Optional[int]:
async def run(self) -> int | None:
for i, release in enumerate((await self.releases).values()):
await release.fetch(self.path, self.asset_types, append=(i != 0))

Expand All @@ -120,5 +119,5 @@ def add_arguments(self, parser: argparse.ArgumentParser) -> None:
"Path to push assets from, can either be a directory "
"or a tarball"))

async def run(self) -> Optional[int]:
async def run(self) -> int | None:
await self.release.push(self.artefacts)
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

import argparse
from functools import cached_property
from typing import Optional, Type

import gidgethub
import gidgethub.abc
Expand Down Expand Up @@ -30,7 +29,7 @@ def release_manager(self) -> AGithubReleaseManager:
return super().release_manager

@property
def release_manager_class(self) -> Type[AGithubReleaseManager]:
def release_manager_class(self) -> type[AGithubReleaseManager]:
return manager.GithubReleaseManager

def add_arguments(self, parser: argparse.ArgumentParser) -> None:
Expand All @@ -41,5 +40,5 @@ def add_arguments(self, parser: argparse.ArgumentParser) -> None:
(gidgethub.GitHubException,
GithubReleaseError,
KeyboardInterrupt))
async def run(self) -> Optional[int]:
async def run(self) -> int | None:
return await super().run()
28 changes: 16 additions & 12 deletions py/envoy.distribution.release/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,28 @@ author_email = ryan@synca.io
maintainer = Ryan Northey
maintainer_email = ryan@synca.io
license = Apache Software License 2.0
url = https://github.com/envoyproxy/toolshed/tree/main/envoy.distribution.release
description = "Release publishing tool used in Envoy proxy's CI"
url = https://github.com/envoyproxy/toolshed/tree/main/py/envoy.distribution.release
description = Release publishing tool used in Envoy proxy's CI
long_description = file: README.rst
classifiers =
Development Status :: 4 - Beta
Framework :: Pytest
Intended Audience :: Developers
Topic :: Software Development :: Testing
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.13
Programming Language :: Python :: Implementation :: CPython
Operating System :: OS Independent
License :: OSI Approved :: Apache Software License
Topic :: Software Development
Typing :: Typed

[options]
python_requires = >=3.5
py_modules = envoy.distribution.release
python_requires = >=3.12
packages = find_namespace:
install_requires =
aio.run.runner>=0.3.4
aio.run.runner>=0.4.0
envoy.github.release>=0.1.0

[options.extras_require]
Expand All @@ -44,7 +43,12 @@ types =
publish = wheel

[options.package_data]
* = py.typed
envoy.distribution.release = py.typed

[options.packages.find]
include =
envoy.distribution.release
envoy.distribution.release.*

[options.entry_points]
console_scripts =
Expand Down
Loading