Browse Source

Merge pull request #1696 from doccano/feature/createPackageScript

Add create-package.sh
pull/1697/head
Hiroki Nakayama 2 years ago
committed by GitHub
parent
commit
bf5506ea5e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 0 deletions
  1. 2
      .github/workflows/pypi-publish.yml
  2. 24
      docs/getting-started.md
  3. 11
      tools/create-package.sh

2
.github/workflows/pypi-publish.yml

@ -37,9 +37,11 @@ jobs:
- name: collectstatic
run: |
poetry run task collectstatic
working-directory: ./backend
- name: Build a binary wheel and a source tarball
run: |
poetry build
working-directory: ./backend
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:

24
docs/getting-started.md

@ -103,3 +103,27 @@ Then run the `dev` command to serve with hot reload at <localhost:3000>:
```bash
yarn dev
```
## How to create a Python package
During development, you may want to create a Python package and verify it works correctly. In such a case, you can create a package by running the following command in the root directory of your project:
```bash
./tools/create-package.sh
```
This command builds the frontend, copies the files, and packages them. This will take a few minutes. After finishing the command, you will find `sdist` and `wheel` in `backend/dist`:
```bash
Building doccano (1.5.5.post335.dev0+6be6d198)
- Building sdist
- Built doccano-1.5.5.post335.dev0+6be6d198.tar.gz
- Building wheel
- Built doccano-1.5.5.post335.dev0+6be6d198-py3-none-any.whl
```
Then, you can install the package via `pip install` command:
```bash
pip install doccano-1.5.5.post335.dev0+6be6d198-py3-none-any.whl
```

11
tools/create-package.sh

@ -0,0 +1,11 @@
#!/usr/bin/env bash
mkdir -p backend/client
cd frontend
export PUBLIC_PATH="/static/_nuxt/"
yarn build
cp -r dist ../backend/client/
cd ../backend
poetry run task collectstatic
poetry build
Loading…
Cancel
Save