Skip to content

Commit

Permalink
✨ python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
juftin committed Mar 5, 2024
1 parent 05a1739 commit 5a01982
Show file tree
Hide file tree
Showing 15 changed files with 628 additions and 466 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
fail-fast: true
matrix:
include:
- { name: Python 3.12, python: "3.12" }
- { name: Python 3.11, python: "3.11" }
- { name: Python 3.10, python: "3.10" }
- { name: Python 3.9, python: "3.9" }
Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,29 @@ class UniversalDirectoryTreeApp(App):

def __init__(self, path: str, *args: Any, **kwargs: Any):
super().__init__(*args, **kwargs)
self.universal_path = path
self.file_content = Static()
self.file_path = path
self.file_content = Static(expand=True)

def compose(self) -> ComposeResult:
yield Header()
directory_tree = UniversalDirectoryTree(path=self.universal_path)
directory_tree = UniversalDirectoryTree(path=self.file_path)
yield Horizontal(directory_tree, VerticalScroll(self.file_content))
yield Footer()

@on(DirectoryTree.FileSelected)
def handle_file_selected(
self, message: DirectoryTree.FileSelected
) -> None:
def handle_file_selected(self, message: DirectoryTree.FileSelected) -> None:
"""
Do something with the selected file.
Objects returned by the FileSelected event are upath.UPath objects and
they are compatible with the familiar pathlib.Path API built into Python.
"""
selected_file_path = message.path
file_content = selected_file_path.read_text(errors="replace")
lexer = Syntax.guess_lexer(path=str(selected_file_path))
try:
file_content = message.path.read_text()
except UnicodeDecodeError:
self.file_content.update("")
return None
lexer = Syntax.guess_lexer(path=message.path.name)
code = Syntax(code=file_content, lexer=lexer)
self.file_content.update(code)
```
Expand Down
186 changes: 93 additions & 93 deletions docs/screenshots/test_github_screenshot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy"
]
dependencies = [
"textual>=0.27.0",
"universal-pathlib>=0.0.23,<=0.0.24"
"universal-pathlib>=0.2.2"
]
description = "A Textual Directory Tree for all File Systems"
dynamic = ["version"]
Expand Down Expand Up @@ -82,7 +83,7 @@ pip-compile-constraint = ""
template = "test"

[[tool.hatch.envs.all.matrix]]
python = ["3.8", "3.9", "3.10", "3.11"]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]

[tool.hatch.envs.default]
features = ["remote"]
Expand Down
68 changes: 30 additions & 38 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by hatch-pip-compile with Python 3.11
#
# - textual>=0.27.0
# - universal-pathlib<=0.0.24,>=0.0.23
# - universal-pathlib>=0.2.2
# - adlfs
# - aiohttp
# - gcsfs
Expand All @@ -11,11 +11,11 @@
# - s3fs
#

adlfs==2023.8.0
adlfs==2024.2.0
# via hatch.envs.default
aiobotocore==2.5.4
aiobotocore==2.11.2
# via s3fs
aiohttp==3.8.4
aiohttp==3.9.3
# via
# hatch.envs.default
# adlfs
Expand All @@ -26,11 +26,9 @@ aioitertools==0.11.0
# via aiobotocore
aiosignal==1.3.1
# via aiohttp
async-timeout==4.0.2
attrs==23.2.0
# via aiohttp
attrs==23.1.0
# via aiohttp
azure-core==1.29.1
azure-core==1.30.0
# via
# adlfs
# azure-identity
Expand All @@ -43,21 +41,19 @@ azure-storage-blob==12.19.0
# via adlfs
bcrypt==4.1.2
# via paramiko
botocore==1.31.17
botocore==1.34.34
# via aiobotocore
cachetools==5.3.2
# via google-auth
certifi==2023.5.7
certifi==2024.2.2
# via requests
cffi==1.16.0
# via
# azure-datalake-store
# cryptography
# pynacl
charset-normalizer==3.1.0
# via
# aiohttp
# requests
charset-normalizer==3.3.2
# via requests
cryptography==42.0.3
# via
# azure-identity
Expand All @@ -67,17 +63,17 @@ cryptography==42.0.3
# pyjwt
decorator==5.1.1
# via gcsfs
frozenlist==1.3.3
frozenlist==1.4.1
# via
# aiohttp
# aiosignal
fsspec==2023.5.0
fsspec==2024.2.0
# via
# adlfs
# gcsfs
# s3fs
# universal-pathlib
gcsfs==2023.5.0
gcsfs==2024.2.0
# via hatch.envs.default
google-api-core==2.17.1
# via
Expand All @@ -104,24 +100,22 @@ google-resumable-media==2.7.0
# via google-cloud-storage
googleapis-common-protos==1.62.0
# via google-api-core
idna==3.4
idna==3.6
# via
# requests
# yarl
importlib-metadata==6.6.0
# via textual
isodate==0.6.1
# via azure-storage-blob
jmespath==1.0.1
# via botocore
linkify-it-py==2.0.2
linkify-it-py==2.0.3
# via markdown-it-py
markdown-it-py==2.2.0
markdown-it-py==3.0.0
# via
# mdit-py-plugins
# rich
# textual
mdit-py-plugins==0.3.5
mdit-py-plugins==0.4.0
# via markdown-it-py
mdurl==0.1.2
# via markdown-it-py
Expand All @@ -132,13 +126,13 @@ msal==1.26.0
# msal-extensions
msal-extensions==1.1.0
# via azure-identity
multidict==6.0.4
multidict==6.0.5
# via
# aiohttp
# yarl
oauthlib==3.2.2
# via requests-oauthlib
packaging==23.1
packaging==23.2
# via msal-extensions
paramiko==3.4.0
# via hatch.envs.default
Expand All @@ -156,7 +150,7 @@ pyasn1-modules==0.3.0
# via google-auth
pycparser==2.21
# via cffi
pygments==2.15.1
pygments==2.17.2
# via rich
pyjwt==2.8.0
# via
Expand All @@ -166,7 +160,7 @@ pynacl==1.5.0
# via paramiko
python-dateutil==2.8.2
# via botocore
requests==2.30.0
requests==2.31.0
# via
# hatch.envs.default
# azure-core
Expand All @@ -178,35 +172,33 @@ requests==2.30.0
# requests-oauthlib
requests-oauthlib==1.3.1
# via google-auth-oauthlib
rich==13.3.5
rich==13.7.0
# via textual
rsa==4.9
# via google-auth
s3fs==2023.5.0
s3fs==2024.2.0
# via hatch.envs.default
six==1.16.0
# via
# azure-core
# isodate
# python-dateutil
textual==0.27.0
textual==0.48.2
# via hatch.envs.default
typing-extensions==4.5.0
typing-extensions==4.9.0
# via
# azure-core
# azure-storage-blob
# textual
uc-micro-py==1.0.2
uc-micro-py==1.0.3
# via linkify-it-py
universal-pathlib==0.0.24
universal-pathlib==0.2.2
# via hatch.envs.default
urllib3==1.26.16
urllib3==2.0.7
# via
# botocore
# requests
wrapt==1.15.0
wrapt==1.16.0
# via aiobotocore
yarl==1.9.2
yarl==1.9.4
# via aiohttp
zipp==3.15.0
# via importlib-metadata
Loading

0 comments on commit 5a01982

Please sign in to comment.