Skip to content

Commit

Permalink
Prepare for release v0.0.2 (#12)
Browse files Browse the repository at this point in the history
* Increment miner version

* Add package build tool

* Add how to publish package document
  • Loading branch information
KanchiShimono authored Jul 11, 2021
1 parent 9183e54 commit b082a3f
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
35 changes: 35 additions & 0 deletions docs/build_and_publish_pypi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Build and Publish package to PyPI repository

## Build

Run build script in this repository.
If you encounted `already exists` errors, You have to remove `build` and `dist` directories before building.

```sh
bash tools/build_package.sh
```

## Publish

After build package, publish to PyPI repository.
You should publish to Test PyPI repository first.

### Test

Upload to test repository.

```sh
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
```

Then check to be able to install.

```sh
pip install --upgrade --index-url https://test.pypi.org/simple/ scopt
```

### Production

```sh
twine upload dist/*
```
2 changes: 1 addition & 1 deletion src/scopt/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.0.1'
__version__ = '0.0.2'
22 changes: 22 additions & 0 deletions tools/build_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

set -e
REPO_ROOT="$(cd "$(dirname "$0")/.."; pwd)"
BUILD_DIR="${REPO_ROOT}/build"
DIST_DIR="${REPO_ROOT}/dist"

# enable recursive match by **
shopt -s globstar
cd "${REPO_ROOT}"

# check directories are already exist
if [ -e ${BUILD_DIR} ]; then
echo "Build directory already exists: ${BUILD_DIR}"
exit 1
elif [ -e ${DIST_DIR} ]; then
echo "Dist directory already exists: ${DIST_DIR}"
exit 1
fi

# build package
python setup.py sdist bdist_wheel

0 comments on commit b082a3f

Please sign in to comment.