Skip to content

Commit

Permalink
More package upgrades (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
florimondmanca authored Nov 13, 2022
1 parent 11c0979 commit d5c13be
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 70 deletions.
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
venv = venv
bin = ${venv}/bin/
bin = venv/bin/
pysources = src example/server tests

build:
${bin}python setup.py sdist bdist_wheel
${bin}twine check dist/*
rm -r build
${bin}python -m build

check:
${bin}black --check --diff --target-version=py37 ${pysources}
${bin}flake8 ${pysources}
${bin}mypy ${pysources}
${bin}isort --check --diff ${pysources}

install:
python3 -m venv ${venv}
install: install-python

venv:
python3 -m venv venv

install-python: venv
${bin}pip install -U pip wheel
${bin}pip install -U build
${bin}pip install -r requirements.txt

format:
Expand Down
8 changes: 4 additions & 4 deletions ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resources:
type: github
endpoint: github
name: florimondmanca/azure-pipelines-templates
ref: refs/tags/5.0
ref: refs/tags/6.0

trigger:
- master
Expand All @@ -25,19 +25,19 @@ stages:
jobs:
- template: job--python-check.yml@templates
parameters:
pythonVersion: "3.10"
pythonVersion: "3.11"

- template: job--python-test.yml@templates
parameters:
jobs:
py37: null
py310:
py311:
coverage: true

- stage: publish
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
jobs:
- template: job--python-publish.yml@templates
parameters:
pythonVersion: "3.10"
pythonVersion: "3.11"
token: $(pypiToken)
Empty file added example/__init__.py
Empty file.
4 changes: 2 additions & 2 deletions example/server/content.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict
from typing import Dict, Optional

import markdown as md

Expand All @@ -12,7 +12,7 @@ async def load_pages() -> None:
PAGES[path.name] = md.markdown(path.read_text())


def get_page_content(page: str = None) -> str:
def get_page_content(page: Optional[str] = None) -> str:
if page is None:
page = "README"
filename = f"{page}.md"
Expand Down
4 changes: 3 additions & 1 deletion example/server/routes.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Optional

from starlette.requests import Request
from starlette.responses import Response
from starlette.routing import Route, WebSocketRoute
Expand All @@ -8,7 +10,7 @@


async def render(request: Request) -> Response:
page = request.path_params.get("page")
page: Optional[str] = request.path_params.get("page")
context = {"request": request, "page_content": get_page_content(page)}
return templates.TemplateResponse("index.jinja", context=context)

Expand Down
36 changes: 36 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[build-system]
requires = ["setuptools", "setuptools-scm", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "arel"
description = "Browser hot reload for Python ASGI web apps"
requires-python = ">=3.7"
license = { text = "MIT" }
authors = [
{ name = "Florimond Manca", email = "florimond.manca@protonmail.com" },
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Framework :: AsyncIO",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
dependencies = [
"starlette==0.*",
"watchgod==0.*",
]
dynamic = ["version", "readme"]

[project.urls]
"Homepage" = "https://github.com/florimondmanca/arel"

[tool.setuptools.dynamic]
version = { attr = "arel.__version__" }
readme = { file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown" }
17 changes: 8 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@ wheel

# Example.
jinja2==3.*
markdown==3.3.*
starlette==0.20.*
uvicorn==0.17.*
markdown==3.*
starlette==0.21.*
uvicorn==0.19.*

# Tooling and tests.
autoflake
black==22.3.0
flake8
black==22.10.*
flake8==5.*
httpx==0.23.*
isort==5.*
mypy
pytest
pytest-asyncio
mypy==0.990
pytest==7.*
pytest-asyncio==0.20.*
pytest-cov
seed-isort-config
types-markdown
websockets==10.*
47 changes: 2 additions & 45 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,46 +1,3 @@
import re
from pathlib import Path
from setuptools import setup

from setuptools import find_packages, setup


def get_version(package: str) -> str:
version = (Path("src") / package / "__version__.py").read_text()
match = re.search("__version__ = ['\"]([^'\"]+)['\"]", version)
assert match is not None
return match.group(1)


def get_long_description() -> str:
with open("README.md", encoding="utf8") as readme:
with open("CHANGELOG.md", encoding="utf8") as changelog:
return readme.read() + "\n\n" + changelog.read()


setup(
name="arel",
version=get_version("arel"),
description="Browser hot reload for Python ASGI web apps",
long_description=get_long_description(),
long_description_content_type="text/markdown",
url="http://github.com/florimondmanca/arel",
author="Florimond Manca",
author_email="florimond.manca@gmail.com",
packages=find_packages("src"),
package_dir={"": "src"},
include_package_data=True,
zip_safe=False,
install_requires=["starlette==0.*", "watchgod==0.*"],
python_requires=">=3.7",
license="MIT",
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Framework :: AsyncIO",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
)
setup() # Editable installs.
3 changes: 2 additions & 1 deletion src/arel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .__version__ import __version__
from ._app import HotReload
from ._models import Path

__version__ = "0.2.0"

__all__ = ["__version__", "HotReload", "Path"]
1 change: 0 additions & 1 deletion src/arel/__version__.py

This file was deleted.

0 comments on commit d5c13be

Please sign in to comment.