Update package metadata and dev experience

This commit is contained in:
Ofek Lev
2022-10-20 18:04:41 -04:00
committed by Will McGugan
parent 30b5f1d7f7
commit cd9ea54329
6 changed files with 84 additions and 1865 deletions

View File

@@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
defaults:
run:
shell: bash
@@ -19,26 +19,14 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install and configure Poetry
uses: snok/install-poetry@v1.3.3
with:
version: 1.2.2
virtualenvs-in-project: true
- name: Install dependencies
run: poetry install --extras "dev"
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Install Hatch
run: pip install --upgrade hatch
- name: Format check with black
run: |
source $VENV
make format-check
run: hatch run lint:check
# - name: Typecheck with mypy
# run: |
# source $VENV
# make typecheck
# run: hatch run lint:typing
- name: Test with pytest
run: |
source $VENV
pytest tests -v --cov=./src/textual --cov-report=xml:./coverage.xml --cov-report term-missing
run: hatch run pytest tests -v --cov=./src/textual --cov-report=xml:./coverage.xml --cov-report term-missing
- name: Upload snapshot report
if: always()
uses: actions/upload-artifact@v3

10
docs.md
View File

@@ -1,14 +1,14 @@
# Documentation Workflow
* Ensure you're inside a *Python 3.10+* virtual environment
* Run the live-reload server using `mkdocs serve` from the project root
* [Install Hatch](https://hatch.pypa.io/latest/install/)
* Run the live-reload server using `hatch run docs:serve` from the project root
* Create new pages by adding new directories and Markdown files inside `docs/*`
## Commands
- `mkdocs serve` - Start the live-reloading docs server.
- `mkdocs build` - Build the documentation site.
- `mkdocs -h` - Print help message and exit.
- `hatch run docs:serve` - Start the live-reloading docs server.
- `hatch run docs:build` - Build the documentation site.
- `hatch run docs:help` - Print help message and exit.
## Project layout

38
hatch.toml Normal file
View File

@@ -0,0 +1,38 @@
[envs.default]
features = ["dev"]
dependencies = [
"jinja2 < 3.1.0",
"pytest >= 7.1.3, <8",
"pytest-aiohttp >= 1.0.4, <2",
"pytest-cov >= 2.12.1, <3",
"syrupy >= 3.0.0, <4",
"time-machine >= 2.6.0, <3",
]
[envs.default.scripts]
test = "pytest --cov-report term-missing --cov=textual tests/ -vv"
test-snapshot-update = "pytest --cov-report term-missing --cov=textual tests/ -vv --snapshot-update"
unit-test = 'pytest --cov-report term-missing --cov=textual tests/ -vv -m "not integration_test"'
[envs.lint]
detached = true
dependencies = [
"black >= 22.3.0, <23",
"mypy >= 0.982, <1",
"pre-commit >= 2.12.1, <3",
]
[envs.lint.scripts]
format = "black src"
check = "black --check src"
typing = "mypy src/textual"
[envs.docs]
dependencies = [
"mkdocs >= 1.3.0, <2",
"mkdocs-material >= 8.2.15, <9",
"mkdocstrings[python] >= 0.19.0, <1",
]
[envs.docs.scripts]
build = "mkdocs build"
deploy = "mkdocs gh-deploy"
serve = "mkdocs serve"
help = "mkdocs --help"

1804
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,12 @@
[tool.poetry]
[project]
name = "textual"
dynamic = ["readme"]
version = "0.3.0"
homepage = "https://github.com/Textualize/textual"
description = "Modern Text User Interface framework"
authors = ["Will McGugan <will@textualize.io>"]
authors = [
{ name = "Will McGugan", email = "will@textualize.io" },
]
license = "MIT"
readme = "README.md"
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
@@ -19,42 +20,40 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Typing :: Typed",
]
include = [
"src/textual/py.typed"
requires-python = ">=3.7"
dependencies = [
"importlib-metadata >= 4.11.3, <5",
"nanoid >= 2.0.0",
"rich >= 12.6.0, <13",
"typing-extensions >= 4.0.0, <5; python_version < '3.10'",
]
[tool.poetry.scripts]
[project.optional-dependencies]
dev = [
"aiohttp >= 3.8.1",
"click >= 8.1.2",
"msgpack >= 1.0.3",
]
[project.scripts]
textual = "textual.cli.cli:run"
[tool.poetry.dependencies]
python = "^3.7"
rich = "^12.6.0"
#rich = {path="../rich", develop=true}
importlib-metadata = "^4.11.3"
typing-extensions = { version = "^4.0.0", python = "<3.10" }
[project.urls]
Homepage = "https://github.com/Textualize/textual"
# Dependencies below are required for devtools only
aiohttp = { version = ">=3.8.1", optional = true }
click = {version = ">=8.1.2", optional = true}
msgpack = { version = ">=1.0.3", optional = true }
nanoid = ">=2.0.0"
[tool.hatch.metadata.hooks.fancy-pypi-readme]
content-type = "text/markdown"
fragments = [
{ path = "README.md" },
]
[tool.poetry.extras]
dev = ["aiohttp", "click", "msgpack"]
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = '(?<=\]\()\./(.+?\.py)(?=\))'
replacement = 'https://github.com/Textualize/textual/blob/main/\1'
[tool.poetry.dev-dependencies]
pytest = "^7.1.3"
black = "^22.3.0"
mypy = "^0.982"
pytest-cov = "^2.12.1"
mkdocs = "^1.3.0"
mkdocstrings = {extras = ["python"], version = "^0.19.0"}
mkdocs-material = "^8.2.15"
pre-commit = "^2.13.0"
pytest-aiohttp = "^1.0.4"
time-machine = "^2.6.0"
Jinja2 = "<3.1.0"
syrupy = "^3.0.0"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = '(?<=\]\()\./(.+?\.(png|svg))(?=\))'
replacement = 'https://raw.githubusercontent.com/Textualize/textual/main/\1'
[tool.poetry.group.dev.dependencies]
mkdocs-rss-plugin = "^1.5.0"
@@ -71,5 +70,5 @@ markers = [
]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ['hatchling>=1.11.1', 'hatch-fancy-pypi-readme>=22.5.0']
build-backend = 'hatchling.build'

View File

@@ -2,9 +2,7 @@
## Installation
Using the Textual Devtools requires installation of the `dev` extra dependency.
https://python-poetry.org/docs/pyproject/#extras
Using the Textual Devtools requires installation of the `dev` [optional dependency group](https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#dependencies-optional-dependencies).
## Running