Use the __main__.py special filename for main.py (#118)

* Use the __main__.py special filename for main.py

This allows users to run the program directly with `py -m tg` instead of `py -m tg.main`.

* Updated script in pyproject.toml to reflect the previous rename

* Updated readme.md to reflect the previous rename

* Update readme.md with a better description of how to install the software

* Once installed through flit, the tg command can be used directly

* Fix errors in the readme.md introduced in the previous commit

* Run the folder instead of the script

* Change title
This commit is contained in:
Stefano Pigozzi 2020-07-21 14:03:52 +02:00 committed by GitHub
parent 0e13cc1cc1
commit ecb8afb4ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 64 additions and 31 deletions

View file

@ -13,7 +13,7 @@ requires-python = ">=3.8"
requires = ['python-telegram==0.12.0']
[tool.flit.scripts]
tg = "tg.main:main"
tg = "tg.__main__:main"
[tool.black]
line-length = 79

View file

@ -29,37 +29,11 @@ TODO:
- [ ] create new chat
- [ ] bots (bot keyboard)
## Requirements
## Installation
To use tg, you'll need to have the following installed:
`python3.8` required.
From pip:
```sh
pip3 install tg
```
From sources:
```sh
pip3 install python-telegram
git clone git@github.com:paul-nameless/tg.git
cd tg
PYTHONPATH=. python3 tg/main.py
```
Docker (voice recordings and notifications won't work):
```sh
docker run -it --rm tg
```
Arch Linux users can install from the AUR: https://aur.archlinux.org/packages/telegram-tg-git/
```bash
yay -S telegram-tg-git
```
- [Python 3.8](https://www.python.org/downloads/release/python-380/)
## Optional dependencies
@ -76,8 +50,67 @@ yay -S telegram-tg-git
```ini
image/webp; mpv %s
```
- [ranger](https://github.com/ranger/ranger), [nnn](https://github.com/jarun/nnn) - can be used to choose file when sending, customizable with `FILE_PICKER_CMD`
- [ranger](https://github.com/ranger/ranger), [nnn](https://github.com/jarun/nnn):
can be used to choose file when sending, customizable with `FILE_PICKER_CMD`
## Installation
### From PyPI
This option is recommended for production:
```sh
pip3 install tg
tg
```
### Using flit
This option is recommended for development:
> Requires [flit](https://github.com/takluyver/flit) to be installed.
>
> Install it with:
> ```sh
> pip3 install flit
> ```
```sh
git clone https://github.com:paul-nameless/tg.git
cd tg
flit install
tg
```
### Running with virtualenv
> Ensure you have the correct version of Python installed before using this method!
```sh
git clone https://github.com:paul-nameless/tg.git
cd tg
python3 -m venv venv
source venv/bin/activate
pip install python-telegram
python3 tg
```
### Using Docker
> Please note that voice recordings and notifications won't work when using Docker.
```sh
docker run -it --rm tg
```
### From the AUR
If you're using Arch Linux, you can install tg through [its AUR package](https://aur.archlinux.org/packages/telegram-tg-git/):
If you're using the `yay` AUR helper, you can install the package with:
```bash
yay -S telegram-tg-git
```
## Configuration