Skip to content

Commit

Permalink
Update to Poetry, version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
kkinder committed Jul 3, 2024
1 parent 4664c8a commit cfb8195
Show file tree
Hide file tree
Showing 14 changed files with 383 additions and 84 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Unittests

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
curl -sSL https://install.python-poetry.org | python -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Tests
run: |
poetry run python -m unittest discover -s tests
42 changes: 42 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish Release

on:
release:
types: [ created ]

jobs:
publish:
strategy:
fail-fast: false
matrix:
python-version: [ 3.9 ]
poetry-version: [ 1.6.1 ]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Build Poetry image
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Run Poetry image
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Set release version
id: set_version
run: |
echo "RELEASE_VERSION=$(poetry version -s)" >> $GITHUB_ENV
- name: Show release version
run: echo "Release version is ${{ env.RELEASE_VERSION }}"
- name: Build PuePy
run: |
poetry build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
6 changes: 6 additions & 0 deletions .idea/GitLink.xml

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

15 changes: 15 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

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

5 changes: 4 additions & 1 deletion .idea/misc.xml

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

2 changes: 1 addition & 1 deletion .idea/wsgigo.iml

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

2 changes: 1 addition & 1 deletion LICENSE.txt → LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Ken Kinder
Copyright (c) 2018 - 2024 Ken Kinder

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# WsgiGo

## What is it?

WSGI go is a very simple WSGI router with no requirements. It is written for Python 3, though it could be
easily backported.

## Installation

```
pip install wsgigo
```

## Usage

You can use it to route WSGI requests to specific apps based on hostname, URL fragment, or (through extending the
Route class) other criteria. For example, suppose you have three wsgi apps which you want to serve as one::

```python
from wsgigo import AppRouter

app = AppRouter(default_app=main_website)
app.add_startswith(docs_app, '/docs/')
app.add_hostname(api_app, 'api.local')
app.add_regexp(animal_app, '/(?:monkey|ape)/')
```

You can also make your own router class, to route apps how you need them to be routed::

```python
class InternetExplorerRouter(Route):
def claim(self, environ):
user_agent = environ['HTTP_USER_AGENT']
if 'Trident/7.0' in user_agent or 'MSIE' in user_agent:
return True

internet_explorer_app = TestWsgiApp("<b>really simple webpage</b>")
real_app = TestWsgiApp("<b>really ADVANCED webpage</b>")

router = AppRouter(default_app=real_app)
router.add_route(InternetExplorerRouter(internet_explorer_app))
```
42 changes: 0 additions & 42 deletions README.rst

This file was deleted.

Loading

0 comments on commit cfb8195

Please sign in to comment.