mirror of https://github.com/doccano/doccano.git
Browse Source
Merge pull request #1090 from doccano/enhancement/pip-installation
Merge pull request #1090 from doccano/enhancement/pip-installation
Support pip Installationpull/1100/head
Hiroki Nakayama
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 208 additions and 42 deletions
Unified View
Diff Options
-
48.github/workflows/pypi-publish.yml
-
19MANIFEST.in
-
95README.md
-
0app/doccano/__init__.py
-
38app/doccano/doccano.py
-
50setup.py
@ -0,0 +1,48 @@ |
|||||
|
name: Upload Python Package |
||||
|
|
||||
|
on: |
||||
|
release: |
||||
|
types: [created] |
||||
|
|
||||
|
jobs: |
||||
|
deploy: |
||||
|
runs-on: ubuntu-latest |
||||
|
|
||||
|
steps: |
||||
|
- uses: actions/checkout@v2 |
||||
|
- name: Preparation |
||||
|
run: | |
||||
|
mkdir app/client |
||||
|
- name: Use Node.js |
||||
|
uses: actions/setup-node@v1 |
||||
|
with: |
||||
|
node-version: '12.x' |
||||
|
- name: Build with Node.js |
||||
|
run: | |
||||
|
yarn install |
||||
|
yarn build |
||||
|
cp -r dist ../app/client/ |
||||
|
working-directory: ./frontend |
||||
|
env: |
||||
|
PUBLIC_PATH: "/static/_nuxt/" |
||||
|
- name: Setup Python 3.8 |
||||
|
uses: actions/setup-python@v2 |
||||
|
with: |
||||
|
python-version: 3.8 |
||||
|
- name: Install dependencies |
||||
|
run: | |
||||
|
python -m pip install --upgrade pip |
||||
|
pip install setuptools wheel |
||||
|
pip install -r requirements.txt |
||||
|
- name: collectstatic |
||||
|
run: | |
||||
|
python manage.py collectstatic --noinput |
||||
|
working-directory: ./app |
||||
|
- name: Build a binary wheel and a source tarball |
||||
|
run: | |
||||
|
python setup.py sdist bdist_wheel |
||||
|
- name: Publish a Python distribution to PyPI |
||||
|
uses: pypa/gh-action-pypi-publish@master |
||||
|
with: |
||||
|
user: ${{ secrets.PYPI_USERNAME }} |
||||
|
password: ${{ secrets.PYPI_PASSWORD }} |
@ -0,0 +1,19 @@ |
|||||
|
include app/manage.py |
||||
|
include app/requirements.txt |
||||
|
include README.md |
||||
|
exclude *.yml |
||||
|
exclude *.yaml |
||||
|
|
||||
|
graft app/staticfiles |
||||
|
graft app/client |
||||
|
graft app/doccano |
||||
|
|
||||
|
prune app/staticfiles/bundle |
||||
|
prune app/staticfiles/assets |
||||
|
prune app/staticfiles/components |
||||
|
prune app/server/static |
||||
|
prune frontend |
||||
|
prune docs |
||||
|
prune nginx |
||||
|
prune tools |
||||
|
global-exclude *.pyc |
@ -0,0 +1,38 @@ |
|||||
|
import argparse |
||||
|
import os |
||||
|
import subprocess |
||||
|
|
||||
|
|
||||
|
def main(): |
||||
|
parser = argparse.ArgumentParser(description='doccano.') |
||||
|
parser.add_argument('--username', type=str, default='admin', help='admin username') |
||||
|
parser.add_argument('--password', type=str, default='password', help='admin password') |
||||
|
parser.add_argument('--email', type=str, default='example@example.com', help='admin email') |
||||
|
parser.add_argument('--port', type=int, default=8000, help='port') |
||||
|
parser.add_argument('--workers', type=int, default=1, help='workers') |
||||
|
parser.add_argument('--database_url', type=str, default='sqlite:///doccano.db', help='data store') |
||||
|
args = parser.parse_args() |
||||
|
|
||||
|
os.environ.setdefault('DEBUG', 'False') |
||||
|
os.environ.setdefault('DATABASE_URL', args.database_url) |
||||
|
|
||||
|
print('Setup Database.') |
||||
|
base = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) |
||||
|
manage_path = os.path.join(base, 'manage.py') |
||||
|
subprocess.call(['python', manage_path, 'wait_for_db'], shell=False) |
||||
|
subprocess.call(['python', manage_path, 'migrate'], shell=False) |
||||
|
subprocess.call(['python', manage_path, 'create_roles'], shell=False) |
||||
|
|
||||
|
print('Create admin user.') |
||||
|
subprocess.call(['python', manage_path, 'create_admin', |
||||
|
'--username', args.username, |
||||
|
'--password', args.password, |
||||
|
'--email', args.email, |
||||
|
'--noinput'], shell=False) |
||||
|
|
||||
|
print(f'Starting server with port {args.port}.') |
||||
|
subprocess.call(['python', manage_path, 'runserver', f'0.0.0.0:{args.port}']) |
||||
|
|
||||
|
|
||||
|
if __name__ == '__main__': |
||||
|
main() |
@ -0,0 +1,50 @@ |
|||||
|
#!/usr/bin/env python |
||||
|
# -*- coding: utf-8 -*- |
||||
|
import io |
||||
|
import os |
||||
|
|
||||
|
from setuptools import find_packages, setup |
||||
|
|
||||
|
NAME = 'doccano' |
||||
|
DESCRIPTION = 'doccano' |
||||
|
URL = 'https://github.com/doccano/doccano' |
||||
|
EMAIL = 'hiroki.nakayama.py@gmail.com' |
||||
|
AUTHOR = 'Hironsan' |
||||
|
LICENSE = 'MIT' |
||||
|
|
||||
|
here = os.path.abspath(os.path.dirname(__file__)) |
||||
|
with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f: |
||||
|
long_description = '\n' + f.read() |
||||
|
|
||||
|
# required = ['requests', 'boto3', 'pydantic', 'jinja2'] |
||||
|
required = [line.rstrip() for line in io.open(os.path.join(here, 'app/requirements.txt')) if not line.startswith('psy')] |
||||
|
|
||||
|
setup( |
||||
|
name=NAME, |
||||
|
use_scm_version=True, |
||||
|
setup_requires=['setuptools_scm'], |
||||
|
description=DESCRIPTION, |
||||
|
long_description=long_description, |
||||
|
long_description_content_type='text/markdown', |
||||
|
author=AUTHOR, |
||||
|
author_email=EMAIL, |
||||
|
url=URL, |
||||
|
packages=find_packages(exclude=('*.tests',)), |
||||
|
entry_points={ |
||||
|
'console_scripts': [ |
||||
|
'doccano = app.doccano.doccano:main' |
||||
|
] |
||||
|
}, |
||||
|
install_requires=required, |
||||
|
include_package_data=True, |
||||
|
license=LICENSE, |
||||
|
classifiers=[ |
||||
|
'License :: OSI Approved :: MIT License', |
||||
|
'Programming Language :: Python', |
||||
|
'Programming Language :: Python :: 3.6', |
||||
|
'Programming Language :: Python :: 3.7', |
||||
|
'Programming Language :: Python :: 3.8', |
||||
|
'Programming Language :: Python :: Implementation :: CPython', |
||||
|
'Programming Language :: Python :: Implementation :: PyPy' |
||||
|
], |
||||
|
) |
Write
Preview
Loading…
Cancel
Save