Skip to content

Commit

Permalink
Setup automated deployment on Pypi by using OIDC
Browse files Browse the repository at this point in the history
- Manage version number by using git tags
- Modernize packaging by using pyproject.toml
- Remove old artifacts related to publishing
- Adding a github workflow dedicated to pypi publish
- Added OIDC trusted publisher management
  https://pypi.org/manage/project/eventlet/settings/publishing/

Related to recent discussions:
- eventlet#843
- eventlet#842
  • Loading branch information
4383 committed Dec 18, 2023
1 parent 39bf321 commit f0e1422
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 258 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
# deploy only when a new tag is pushed to github
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
153 changes: 0 additions & 153 deletions bin/release

This file was deleted.

108 changes: 51 additions & 57 deletions eventlet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,71 +8,65 @@
DeprecationWarning,
)

version_info = (0, 33, 3)
__version__ = '.'.join(map(str, version_info))
# This is to make Debian packaging easier, it ignores import
# errors of greenlet so that the packager can still at least
# access the version. Also this makes easy_install a little quieter
if os.environ.get('EVENTLET_IMPORT_VERSION_ONLY') != '1':
from eventlet import convenience
from eventlet import event
from eventlet import greenpool
from eventlet import greenthread
from eventlet import patcher
from eventlet import queue
from eventlet import semaphore
from eventlet import support
from eventlet import timeout
import greenlet
# Force monotonic library search as early as possible.
# Helpful when CPython < 3.5 on Linux blocked in `os.waitpid(-1)` before first use of hub.
# Example: gunicorn
# https://github.com/eventlet/eventlet/issues/401#issuecomment-327500352
try:
import monotonic
del monotonic
except ImportError:
pass
from eventlet import convenience
from eventlet import event
from eventlet import greenpool
from eventlet import greenthread
from eventlet import patcher
from eventlet import queue
from eventlet import semaphore
from eventlet import support
from eventlet import timeout
import greenlet
# Force monotonic library search as early as possible.
# Helpful when CPython < 3.5 on Linux blocked in `os.waitpid(-1)` before first use of hub.
# Example: gunicorn
# https://github.com/eventlet/eventlet/issues/401#issuecomment-327500352
try:
import monotonic
del monotonic
except ImportError:
pass

connect = convenience.connect
listen = convenience.listen
serve = convenience.serve
StopServe = convenience.StopServe
wrap_ssl = convenience.wrap_ssl
connect = convenience.connect
listen = convenience.listen
serve = convenience.serve
StopServe = convenience.StopServe
wrap_ssl = convenience.wrap_ssl

Event = event.Event
Event = event.Event

GreenPool = greenpool.GreenPool
GreenPile = greenpool.GreenPile
GreenPool = greenpool.GreenPool
GreenPile = greenpool.GreenPile

sleep = greenthread.sleep
spawn = greenthread.spawn
spawn_n = greenthread.spawn_n
spawn_after = greenthread.spawn_after
kill = greenthread.kill
sleep = greenthread.sleep
spawn = greenthread.spawn
spawn_n = greenthread.spawn_n
spawn_after = greenthread.spawn_after
kill = greenthread.kill

import_patched = patcher.import_patched
monkey_patch = patcher.monkey_patch
import_patched = patcher.import_patched
monkey_patch = patcher.monkey_patch

Queue = queue.Queue
Queue = queue.Queue

Semaphore = semaphore.Semaphore
CappedSemaphore = semaphore.CappedSemaphore
BoundedSemaphore = semaphore.BoundedSemaphore
Semaphore = semaphore.Semaphore
CappedSemaphore = semaphore.CappedSemaphore
BoundedSemaphore = semaphore.BoundedSemaphore

Timeout = timeout.Timeout
with_timeout = timeout.with_timeout
wrap_is_timeout = timeout.wrap_is_timeout
is_timeout = timeout.is_timeout
Timeout = timeout.Timeout
with_timeout = timeout.with_timeout
wrap_is_timeout = timeout.wrap_is_timeout
is_timeout = timeout.is_timeout

getcurrent = greenlet.greenlet.getcurrent
getcurrent = greenlet.greenlet.getcurrent

# deprecated
TimeoutError, exc_after, call_after_global = (
support.wrap_deprecated(old, new)(fun) for old, new, fun in (
('TimeoutError', 'Timeout', Timeout),
('exc_after', 'greenthread.exc_after', greenthread.exc_after),
('call_after_global', 'greenthread.call_after_global', greenthread.call_after_global),
))
# deprecated
TimeoutError, exc_after, call_after_global = (
support.wrap_deprecated(old, new)(fun) for old, new, fun in (
('TimeoutError', 'Timeout', Timeout),
('exc_after', 'greenthread.exc_after', greenthread.exc_after),
('call_after_global', 'greenthread.call_after_global', greenthread.call_after_global),
))

del os
os
51 changes: 51 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[build-system]
requires = [
"hatch-vcs>=0.3",
"hatchling>=1.12.2",
]
build-backend = "hatchling.build"

[project]
name = "eventlet"
authors = [
{name = "Liden Lab", email = "eventletdev@lists.secondlife.com"},
]
description = "Highly concurrent networking library"
readme = "README.rst"
requires-python = ">=3.8"
license = {text = "MIT"}
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python",
"Topic :: Internet",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dynamic = ["version"]
dependencies = []

[project.urls]
Homepage = "https://github.com/eventlet/eventlet"
History = "https://github.com/eventlet/aiohub/blob/main/NEWS"
Tracker = "https://github.com/eventlet/eventlet/issues"
Source = "https://github.com/eventlet/aiohub"

[project.optional-dependencies]
dev = ["black", "isort", "pip-tools", "build", "twine", "pre-commit", "commitizen"]

[options.packages.find]
where = "evenetlet"
exclude = "tests*"

[tool.hatch]
version.source = "vcs"
Loading

0 comments on commit f0e1422

Please sign in to comment.