Skip to content

feat: Migrate to PEP 621 compliant pyproject.toml format #5569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added

- Added `pointer_x`, `pointer_y`, `pointer_screen_x`, and `pointer_screen_y` attributes to mouse events https://github.com/Textualize/textual/pull/5556
- Added PEP 621 support to `pyproject.toml` for interoperability with other packaging tools while maintaining Poetry compatibility.

### Changed

Expand Down
158 changes: 63 additions & 95 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
[tool.poetry]
[project]
name = "textual"
version = "2.1.0"
homepage = "https://github.com/Textualize/textual"
repository = "https://github.com/Textualize/textual"
documentation = "https://textual.textualize.io/"

description = "Modern Text User Interface framework"
authors = ["Will McGugan <will@textualize.io>"]
license = "MIT"
readme = "README.md"
classifiers = [
license = { text = "MIT" }
authors = [
{ name = "Will McGugan", email = "will@textualize.io" }
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
Expand All @@ -25,94 +23,68 @@ classifiers = [
"Programming Language :: Python :: 3.13",
"Typing :: Typed",
]
include = [
"src/textual/py.typed",
{ path = "docs/examples", format = "sdist" },
{ path = "tests", format = "sdist" },
# The reason for the slightly convoluted path specification here is that
# poetry populates the exclude list with the content of .gitignore, and
# it also seems like exclude trumps include. So here we specify that we
# want to package up the content of the docs-offline directory in a way
# that works around that.
{ path = "docs-offline/**/*", format = "sdist" },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should docs and tests be included in sdist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomJGooding Thank you for catching this oversight. I've restored the include directives in the latest commit to ensure docs and tests are properly packaged in the sdist, maintaining the project's original behavior.

dependencies = [
"markdown-it-py[plugins,linkify]>=2.1.0",
"rich>=13.3.3",
"typing-extensions>=4.4.0,<5",
"platformdirs>=3.6.0,<5",
]
requires-python = ">=3.8.1,<4.0.0"

[tool.poetry.urls]
"Bug Tracker" = "https://github.com/Textualize/textual/issues"

[tool.ruff]
target-version = "py38"

[tool.poetry.dependencies]
python = "^3.8.1"
markdown-it-py = { extras = ["plugins", "linkify"], version = ">=2.1.0" }
rich = ">=13.3.3"
#rich = {path="../rich", develop=true}
typing-extensions = "^4.4.0"
platformdirs = ">=3.6.0,<5"

# start of [syntax] extras
# Require tree-sitter >= 0.23.0 and python >= 3.9
# Windows, MacOS and Linux binary wheels are available for all of the languages below.
tree-sitter = { version = ">=0.23.0", optional = true, python = ">=3.9" }
tree-sitter-python = { version = ">=0.23.0", optional = true, python = ">=3.9" }
tree-sitter-markdown = { version = ">=0.3.0", optional = true, python = ">=3.9"}
tree-sitter-json = { version = ">=0.24.0", optional = true, python = ">=3.9" }
tree-sitter-toml = { version = ">=0.6.0", optional = true, python = ">=3.9" }
tree-sitter-yaml = { version = ">=0.6.0", optional = true, python = ">=3.9" }
tree-sitter-html = { version = ">=0.23.0", optional = true, python = ">=3.9" }
tree-sitter-css = { version = ">=0.23.0", optional = true, python = ">=3.9" }
tree-sitter-javascript = { version = ">=0.23.0", optional = true, python = ">=3.9" }
tree-sitter-rust = { version = ">=0.23.0", optional = true, python = ">=3.9" }
tree-sitter-go = { version = ">=0.23.0", optional = true, python = ">=3.9" }
tree-sitter-regex = { version = ">=0.24.0", optional = true, python = ">=3.9" }
tree-sitter-xml = { version = ">=0.7.0", optional = true, python = ">=3.9" }
tree-sitter-sql = { version = ">=0.3.0,<0.3.8", optional = true, python = ">=3.9" }
tree-sitter-java = { version = ">=0.23.0", optional = true, python = ">=3.9" }
tree-sitter-bash = { version = ">=0.23.0", optional = true, python = ">=3.9" }
# end of [syntax] extras

[tool.poetry.extras]
[project.optional-dependencies]
syntax = [
"tree-sitter",
"tree-sitter-python",
"tree-sitter-markdown",
"tree-sitter-json",
"tree-sitter-toml",
"tree-sitter-yaml",
"tree-sitter-html",
"tree-sitter-css",
"tree-sitter-javascript",
"tree-sitter-rust",
"tree-sitter-go",
"tree-sitter-regex",
"tree-sitter-xml",
"tree-sitter-sql",
"tree-sitter-java",
"tree-sitter-bash",
"tree-sitter>=0.23.0; python_version >= '3.9'",
"tree-sitter-python>=0.23.0; python_version >= '3.9'",
"tree-sitter-markdown>=0.3.0; python_version >= '3.9'",
"tree-sitter-json>=0.24.0; python_version >= '3.9'",
"tree-sitter-toml>=0.6.0; python_version >= '3.9'",
"tree-sitter-yaml>=0.6.0; python_version >= '3.9'",
"tree-sitter-html>=0.23.0; python_version >= '3.9'",
"tree-sitter-css>=0.23.0; python_version >= '3.9'",
"tree-sitter-javascript>=0.23.0; python_version >= '3.9'",
"tree-sitter-rust>=0.23.0; python_version >= '3.9'",
"tree-sitter-go>=0.23.0; python_version >= '3.9'",
"tree-sitter-regex>=0.24.0; python_version >= '3.9'",
"tree-sitter-xml>=0.7.0; python_version >= '3.9'",
"tree-sitter-sql>=0.3.0,<0.3.8; python_version >= '3.9'",
"tree-sitter-java>=0.23.0; python_version >= '3.9'",
"tree-sitter-bash>=0.23.0; python_version >= '3.9'",
]
dev = [
"black==24.4.2",
"griffe==0.32.3",
"httpx>=0.23.1,<1",
"mkdocs>=1.3.0,<2",
"mkdocs-exclude>=1.0.2,<2",
"mkdocs-git-revision-date-localized-plugin>=1.2.5,<2",
"mkdocs-material>=9.0.11,<10",
"mkdocs-rss-plugin>=1.5.0,<2",
"mkdocstrings[python]>=0.20.0,<1",
"mkdocstrings-python>=1.0.0,<2",
"mypy>=1.0.0,<2",
"pre-commit>=2.13.0,<3",
"pytest>=8.3.1,<9",
"pytest-xdist>=3.6.1,<4",
"pytest-asyncio",
"pytest-cov>=5.0.0,<6",
"textual-dev>=1.7.0,<2",
"types-setuptools>=67.2.0.1,<68",
"isort>=5.13.2,<6",
"pytest-textual-snapshot>=1.0.0,<2",
]

[tool.poetry.group.dev.dependencies]
black = "24.4.2"
griffe = "0.32.3"
httpx = "^0.23.1"
mkdocs = "^1.3.0"
mkdocs-exclude = "^1.0.2"
mkdocs-git-revision-date-localized-plugin = "^1.2.5"
mkdocs-material = "^9.0.11"
mkdocs-rss-plugin = "^1.5.0"
mkdocstrings = { extras = ["python"], version = "^0.20.0" }
mkdocstrings-python = "^1.0.0"
mypy = "^1.0.0"
pre-commit = "^2.13.0"
pytest = "^8.3.1"
pytest-xdist = "^3.6.1"
pytest-asyncio = "*"
pytest-cov = "^5.0.0"
textual-dev = "^1.7.0"
types-setuptools = "^67.2.0.1"
isort = "^5.13.2"
pytest-textual-snapshot = "^1.0.0"
[project.urls]
Homepage = "https://github.com/Textualize/textual"
Repository = "https://github.com/Textualize/textual"
Documentation = "https://textual.textualize.io/"
"Bug Tracker" = "https://github.com/Textualize/textual/issues"

[build-system]
requires = ["poetry-core>=1.2.0"] # Keep poetry as the primary build tool
build-backend = "poetry.core.masonry.api"

[tool.ruff] # Moved ruff config up to be accessible by both
target-version = "py38"

[tool.pytest.ini_options]
asyncio_mode = "auto"
Expand All @@ -122,7 +94,3 @@ markers = [
"syntax: marks tests that require syntax highlighting (deselect with '-m \"not syntax\"')",
]
asyncio_default_fixture_loop_scope = "function"

[build-system]
requires = ["poetry-core>=1.2.0"]
build-backend = "poetry.core.masonry.api"