Skip to content

Commit bdf9617

Browse files
olivetree123gaojian
andauthored
remove flask_script (#15)
* remove flask_script * remove flask_script Co-authored-by: gaojian <gaojian@g13125g.h3c.huawei-3com.com>
1 parent 5c3dfd9 commit bdf9617

File tree

5 files changed

+17
-26
lines changed

5 files changed

+17
-26
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ target/
5757

5858
# PyCharm
5959
.idea/
60+
61+
# vscode
62+
.vscode
6063

6164
# OSX
6265
.DS_Store

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Flask ApiDoc is a Flask extension which adds support for the ApiDoc_.
77

88
Features
99
===============
10-
- Flask-Script command to generate the apidoc's files, by default they are generated into static/docs
10+
- click command to generate the apidoc's files, by default they are generated into static/docs
1111
- Host apidoc's files, by default they are hosted in http://localhost:5000/docs
1212
- Replace the base URL for the endpoints by the current Flask URL.
1313
- Allow absolute urls in @api

example/manage.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
from views import app
1+
from .views import app
22
from flask_apidoc.commands import GenerateApiDoc
3-
from flask_script import Manager
43

5-
manager = Manager(app)
6-
manager.add_command('apidoc', GenerateApiDoc())
4+
app.cli.add_command(GenerateApiDoc(), "apidoc")
75

86
if __name__ == "__main__":
9-
manager.run()
7+
pass

flask_apidoc/commands.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
1-
"""
2-
Provides an integration with flask_script to generate the ApiDoc files.
3-
"""
4-
5-
6-
try:
7-
import flask_script
8-
except ImportError:
9-
raise ImportError('Missing flask-script library (pip install flask-script)')
10-
11-
121
import subprocess
13-
14-
from flask_script import Command
2+
from click import Command
153

164

175
class GenerateApiDoc(Command):
186
"""
19-
GenerateApiDoc adds to Flask-Script a command to generate the apidoc files.
7+
GenerateApiDoc is a command to generate the apidoc files.
208
"""
21-
22-
def __init__(self, input_path=None, output_path=None, template_path=None):
23-
super(GenerateApiDoc, self).__init__()
9+
def __init__(self,
10+
input_path="./",
11+
output_path="static/docs",
12+
template_path=None):
13+
super(GenerateApiDoc, self).__init__(name="GenerateApiDoc")
2414
self.input_path = input_path
25-
self.output_path = output_path or 'static/docs'
15+
self.output_path = output_path
2616
self.template_path = template_path
17+
self.callback = self.run
2718

2819
def run(self):
2920
cmd = ['apidoc']

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
flask>=0.10.1
2-
flask_script>=2.0.5
1+
flask>=1.0.1

0 commit comments

Comments
 (0)