feat: setup.py for installation
This commit is contained in:
parent
b56ffa6552
commit
19556e7527
|
@ -1,6 +1,8 @@
|
||||||
# Joint Teapot
|
# Joint Teapot
|
||||||
|
|
||||||
## Installation
|
A handy tool for TAs in JI to handle stuffs through [Gitea](https://focs.ji.sjtu.edu.cn/git/), [Canvas](https://umjicanvas.com/), and [JOJ](https://joj.sjtu.edu.cn/). Joint is related to JI and also this tool which join websites together. Teapot means to hold Gitea, inspired by [@nichujie](https://github.com/nichujie).
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
### Setup venv (Optional)
|
### Setup venv (Optional)
|
||||||
|
|
||||||
|
@ -9,6 +11,8 @@ python3 -m venv env
|
||||||
source env/Scripts/activate
|
source env/Scripts/activate
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Install
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip3 install -e .
|
pip3 install -e .
|
||||||
vi .env # configure environment
|
vi .env # configure environment
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
from joint_teapot import Canvas, Gitea
|
from joint_teapot import Canvas, Gitea
|
||||||
|
|
||||||
|
__version__ = "0.0.0"
|
||||||
|
|
||||||
|
|
||||||
class Teapot:
|
class Teapot:
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
|
|
46
setup.py
Normal file
46
setup.py
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
|
|
||||||
|
def get_version(package: str) -> str:
|
||||||
|
"""
|
||||||
|
Return package version as listed in `__version__` in `__main__.py`.
|
||||||
|
"""
|
||||||
|
path = os.path.join(package, "__main__.py")
|
||||||
|
main_py = open(path, "r", encoding="utf8").read()
|
||||||
|
match = re.search("__version__ = ['\"]([^'\"]+)['\"]", main_py)
|
||||||
|
if match is None:
|
||||||
|
return "0.0.0"
|
||||||
|
return match.group(1)
|
||||||
|
|
||||||
|
|
||||||
|
def get_long_description() -> str:
|
||||||
|
"""
|
||||||
|
Return the README.
|
||||||
|
"""
|
||||||
|
return open("README.md", "r", encoding="utf8").read()
|
||||||
|
|
||||||
|
|
||||||
|
def get_install_requires() -> List[str]:
|
||||||
|
return open("requirements.txt").read().splitlines()
|
||||||
|
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name="joint-teapot",
|
||||||
|
version=get_version("joint_teapot"),
|
||||||
|
url="https://github.com/BoYanZh/joint-teapot",
|
||||||
|
license="MIT",
|
||||||
|
description="A handy tool for TAs in JI to handle stuffs through Gitea, Canvas, and JOJ.",
|
||||||
|
long_description=get_long_description(),
|
||||||
|
long_description_content_type="text/markdown",
|
||||||
|
author="BoYanZh",
|
||||||
|
author_email="bomingzh@sjtu.edu.cn",
|
||||||
|
maintainer="BoYanZh",
|
||||||
|
maintainer_email="bomingzh@sjtu.edu.cn",
|
||||||
|
packages=find_packages(),
|
||||||
|
python_requires=">=3.6",
|
||||||
|
install_requires=get_install_requires(),
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user