s+: update root files

This commit is contained in:
Mark Joshwel 2024-06-18 18:55:15 +08:00
parent 822eee5b11
commit 387d2a222a
5 changed files with 96 additions and 48 deletions

9
.gitignore vendored
View file

@ -1,9 +1,18 @@
.idea/
old/* old/*
# cached files # cached files
__pycache__/ __pycache__/
*.py[cod] *.py[cod]
*$py.class *$py.class
.cache/
# documentation
docs/spow.sh
docs/termux.sh
docs/whatsapp.sh
docs/telegram.sh
/site
# distribution # distribution
.Python .Python

2
CONTRIBUTORS Normal file
View file

@ -0,0 +1,2 @@
Mark Joshwel <mark@joshwel.co>
shamsu07 <shamsuddeenks@gmail.com>

View file

@ -4,25 +4,25 @@ surplus (s+) is a Python script to convert [Google Maps Plus Codes](https://maps
to iOS Shortcuts-like shareable text to iOS Shortcuts-like shareable text
- [quickstart](#quickstart) - [quickstart](#quickstart)
- [documentation](https://joshwel.co/surplus) - [documentation](https://surplus.joshwel.co)
- [the user's guide (command-line)](https://joshwel.co/surplus/using#as-a-command-line-tool) - [the user's guide (command-line)](https://surplus.joshwel.co/using#as-a-command-line-tool)
- [the user's guide (library)](https://joshwel.co/surplus/using#as-a-library) - [the user's guide (library)](https://surplus.joshwel.co/using#as-a-library)
- [the developer's guide](https://joshwel.co/surplus/developing) - [the developer's guide](https://surplus.joshwel.co/developing)
- [api reference](https://joshwel.co/surplus/developing) - [api reference](https://surplus.joshwel.co/developing)
- [the contributor's guide](https://joshwel.co/surplus/contributing) - [the contributor's guide](https://surplus.joshwel.co/contributing)
this repository is also monorepo for the following sibling projects: this repository is also monorepo for the following sibling projects:
- **surplus on wheels** (s+ow) \ - **surplus on wheels** (s+ow)
a pure shell script to get your location using `termux-location`, process it through surplus, and a pure shell script to get your location using `termux-location`, process it through surplus, and
send it to messaging service or wherever, using "bridges" send it to messaging service or wherever, using "bridges"
- **surplus on wheels: whatsapp bridge** - **surplus on wheels: Whatsapp Bridge**
- **surplus on wheels: telegram bridge** - **surplus on wheels: Telegram Bridge**
## quickstart ## quickstart
> [!TIP] > [!TIP]
> termux users can consider [surplus on wheels](https://joshwel.co/surplus/onwheels), a sibling > termux users can consider [surplus on wheels](https://surplus.joshwel.co/onwheels), a sibling
> project that allows you to run surplus regularly throughout the day and send it to someone on a > project that allows you to run surplus regularly throughout the day and send it to someone on a
> messaging platform > messaging platform
@ -40,7 +40,7 @@ then, use the `surplus` command, or its `s+` shorthand:
```text ```text
$ s+ 7RGX+GJ Singapore $ s+ 7RGX+GJ Singapore
surplus version 2024.0.0 surplus version 2024.0.0-beta
Singapore Conference Hall Singapore Conference Hall
7 Shenton Way 7 Shenton Way
068809 068809
@ -49,52 +49,52 @@ Central, Singapore
the types of queries you can pass in are: the types of queries you can pass in are:
- full-length Plus Codes \ - full-length Plus Codes
`6PH58QMF+FX` `6PH58QMF+FX`
- shortened Plus Codes / 'local codes' \ - shortened Plus Codes / 'local codes'
`8QMF+FX Singapore` `8QMF+FX Singapore`
- latitude and longitude coordinate pairs \ - latitude and longitude coordinate pairs
`1.3336875, 103.7749375` `1.3336875, 103.7749375`
- string queries \ - string queries
`Wisma Atria` `Wisma Atria`
or, alternatively pass in `-` to read from stdin or, alternatively pass in `-` to read from stdin
more documentation is available at <https://joshwel.co/surplus>, more documentation is available at <https://surplus.joshwel.co>,
or alternatively available locally in the [docs/](docs) folder or alternatively available locally in the [docs/](docs) folder
## licences ## licences
- [**surplus**](src/surplus) \ - [**surplus**](src/surplus)
The Unlicence The Unlicence
surplus is free and unencumbered software released into the public domain. for more information, surplus is free and unencumbered software released into the public domain. for more information,
please refer to the [UNLICENCE](src/surplus/UNLICENCE), <https://unlicense.org>, or the python please refer to the [UNLICENCE](src/surplus/UNLICENCE), <https://unlicense.org>, or the python
module docstring module docstring
however, the direct dependencies surplus relies on are licenced under different, but still however, the dependencies surplus relies on are licenced under different, but still permissive
permissive and open-source licences: and open-source licences:
- **[geopy](https://pypi.org/project/geopy/)** - [**geopy**](https://pypi.org/project/geopy/) —
Python Geocoding Toolbox \ Python Geocoding Toolbox
MIT Licence MIT Licence
- **[geographiclib](https://pypi.org/project/geographiclib/)** - [**geographiclib**](https://pypi.org/project/geographiclib/) —
The geodesic routines from GeographicLib \ The geodesic routines from GeographicLib
MIT Licence MIT Licence
- **[pluscodes](https://pypi.org/project/pluscodes/)** - [**pluscodes**](https://pypi.org/project/pluscodes/) —
Compute Plus Codes (Open Location Codes) \ Compute Plus Codes (Open Location Codes)
Apache 2.0 Apache 2.0
- [**surplus on wheels**](src/surplus-on-wheels) \ - [**surplus on wheels**](src/surplus-on-wheels)
The Unlicence The Unlicence
surplus on wheels is free and unencumbered software released into the public domain. for more surplus on wheels is free and unencumbered software released into the public domain. for more
information, please refer to [UNLICENCE](src/surplus-on-wheels/UNLICENCE) or information, please refer to [UNLICENCE](src/surplus-on-wheels/UNLICENCE) or
<https://unlicense.org/> <http://unlicense.org/>
- [**surplus on wheels: WhatsApp Bridge**](src/spow-whatsapp-bridge) \ - [**surplus on wheels: WhatsApp Bridge**](src/spow-whatsapp-bridge)
Mozilla Public Licence 2.0 Mozilla Public Licence 2.0
the s+ow WhatsApp Bridge is based off mdtest code from the the s+ow WhatsApp Bridge is based off mdtest code from the
@ -106,10 +106,10 @@ or alternatively available locally in the [docs/](docs) folder
permissive and open-source licences: permissive and open-source licences:
- [**whatsmeow**](https://github.com/tulir/whatsmeow) — - [**whatsmeow**](https://github.com/tulir/whatsmeow) —
Go library for the WhatsApp web multidevice API \ Go library for the WhatsApp web multidevice API
Mozilla Public Licence 2.0 Mozilla Public Licence 2.0
- [**surplus on wheels: Telegram Bridge**](src/spow-telegram-bridge) \ - [**surplus on wheels: Telegram Bridge**](src/spow-telegram-bridge)
The Unlicence The Unlicence
the s+ow Telegram Bridge is free and unencumbered software released into the public domain. for the s+ow Telegram Bridge is free and unencumbered software released into the public domain. for
@ -119,6 +119,30 @@ or alternatively available locally in the [docs/](docs) folder
however, the direct dependencies surplus relies on are licenced under different, but still however, the direct dependencies surplus relies on are licenced under different, but still
permissive and open-source licences: permissive and open-source licences:
- **[Telethon](https://github.com/LonamiWebs/Telethon)** - [**Telethon**](https://pypi.org/project/Telethon/)
Pure Python 3 MTProto API Telegram client library, for bots too! \ Pure Python 3 MTProto API Telegram client library, for bots too!
MIT Licence MIT Licence
- [**surplus documentation**](docs)
CC0 1.0 Universal
the textual contents of surplus documentation by [Mark Joshwel](https://joshwel.co) is marked
with [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/).
to view a copy of this license, visit <https://creativecommons.org/publicdomain/zero/1.0/>
the fonts the documentation website relies on are licenced under different, but still
permissive and open-source licences:
- [**Geist and Geist Mono**](https://github.com/vercel/geist-font)
SIL Open Font Licence 1.1 ([file](docs/fonts/LICENSE.txt))
the direct software dependencies the documentation are also licenced under different, but still
permissive and open-source licences:
- [**mkdocs-material**](https://squidfunk.github.io/mkdocs-material/) —
Documentation that simply works
MIT Licence
- [**mkdocs**](https://www.mkdocs.org/) —
Project documentation with Markdown
BSD-2-Clause Licence

View file

@ -42,10 +42,10 @@ exclude = [
packages = ["src.surplus"] packages = ["src.surplus"]
[project.urls] [project.urls]
Documentation = "https://joshwel.co/surplus" Documentation = "https://surplus.joshwel.co"
Issues = "https://joshwel.co/surplus/issues" Issues = "https://surplus.joshwel.co/issues"
Source = "https://github.com/markjoshwel/surplus" Source = "https://github.com/markjoshwel/surplus"
Changelog = "https://joshwel.co/surplus/changelog" Changelog = "https://surplus.joshwel.co/changelog"
[tool.ruff] [tool.ruff]
line-length = 100 line-length = 100
@ -63,17 +63,17 @@ python = ["3.11", "3.12"]
[tool.hatch.envs.default] [tool.hatch.envs.default]
description = "default development environment" description = "default development environment"
dependencies = ["mypy", "isort"] dependencies = ["mypy", "ruff", "isort"]
[tool.hatch.envs.default.scripts] [tool.hatch.envs.default.scripts]
check = [ check = [
"mypy *.py", "mypy src",
"hatch fmt --check", "hatch fmt --check",
"isort --check surplus" "isort --check src"
] ]
format = [ format = [
"hatch fmt -f", "hatch fmt -f",
"isort surplus" "isort src"
] ]
[tool.hatch.envs.hatch-static-analysis] [tool.hatch.envs.hatch-static-analysis]
@ -83,8 +83,15 @@ dependencies = ["ruff>=0.3.2"]
detached = true detached = true
description = "env for generator documentation" description = "env for generator documentation"
dependencies = [ dependencies = [
"mkdocs" "mkdocs",
"mkdocs-material",
"mkdocs-git-revision-date-localized-plugin",
"mkdocs-exporter",
"playwright",
] ]
[tool.hatch.envs.docs.scripts] [tool.hatch.envs.docs.scripts]
build = "mkdocs build --clean --strict" build = [
"python src/tools/docs-prebuild.py",
"mkdocs build --clean --strict",
]
serve = "mkdocs serve --dev-addr localhost:8000" serve = "mkdocs serve --dev-addr localhost:8000"

View file

@ -47,16 +47,22 @@ _insert_build_branch = getenv(
capture_output=True, capture_output=True,
text=True, text=True,
check=False, check=False,
).stdout.strip("\n").strip(), )
.stdout.strip("\n")
.strip(),
) )
insert_build_branch = _insert_build_branch if _insert_build_branch != "" else "unknown" insert_build_branch = _insert_build_branch if _insert_build_branch != "" else "unknown"
_insert_build_commit: str = run( _insert_build_commit: str = (
run(
"git rev-parse HEAD".split(), "git rev-parse HEAD".split(),
capture_output=True, capture_output=True,
text=True, text=True,
check=False, check=False,
).stdout.strip("\n").strip() )
.stdout.strip("\n")
.strip()
)
insert_build_commit = _insert_build_commit if _insert_build_commit != "" else "unknown" insert_build_commit = _insert_build_commit if _insert_build_commit != "" else "unknown"
insert_build_datetime: str = repr(build_time).replace("datetime.", "") insert_build_datetime: str = repr(build_time).replace("datetime.", "")