Add mypy checks

This commit is contained in:
c-bata
2020-10-27 03:01:40 +09:00
parent 7bcee94878
commit b2038f17cc
3 changed files with 11 additions and 9 deletions
+1
View File
@@ -22,6 +22,7 @@ jobs:
pip install --progress-bar off .[lint]
- run: flake8 . --show-source
- run: black --check .
- run: mypy .
test:
runs-on: ubuntu-latest
steps:
+7 -6
View File
@@ -1,6 +1,6 @@
# Developers Guide
## Building source and running dashboard
## Building source and running dashboard server
### Building TypeScript files
@@ -39,9 +39,9 @@ $ optuna-dashboard sqlite:///db.sqlite3
## Submitting patches
Before you submitting patches, I recommend you to run tests, linters and auto-formatters.
To approve your patch, you need to pass following tests, lint checks.
### Running Python tests
### Running Python unit tests
```
$ python setup.py test
@@ -52,11 +52,13 @@ Ran 4 tests in 0.004s
OK
```
### Linters
### Linters (flake8, black and mypy)
```
$ pip install .[lint]
$ flake8
$ black --check .
$ mypy .
```
### Auto-formatting TypeScript files (by prettier)
@@ -68,7 +70,6 @@ $ npm run fmt
### Auto-formatting Python files (by black)
```
$ pip install .[lint]
$ black .
```
@@ -78,7 +79,7 @@ $ black .
The release process is fully automated by GitHub Actions.
GitHub Actions will be automatically building TypeScript, packaging Python distributions and uploading to PyPI after you push the git tag.
1. Replace 'optuna_dashboard.version.__version__' to the next version.
1. Replace `optuna_dashboard.version.__version__` to the next version.
2. Create a git tag (e.g. `$ git tag v0.X.Y`).
3. Push the tag to GitHub (e.g. `$ git push origin v0.X.Y`)
+3 -3
View File
@@ -7,13 +7,13 @@ from importlib.machinery import SourceFileLoader
BASE_PATH = os.path.dirname(__file__)
def get_long_description():
def get_long_description() -> str:
readme_filepath = os.path.join(BASE_PATH, "README.md")
with open(readme_filepath) as f:
return f.read()
def get_version():
def get_version() -> int:
version_filepath = os.path.join(BASE_PATH, "optuna_dashboard", "version.py")
module_name = "version"
target_module = types.ModuleType(module_name)
@@ -34,7 +34,7 @@ setup(
packages=find_packages(),
install_requires=["optuna", "bottle"],
extras_require={
"lint": ["black", "flake8"],
"lint": ["black", "flake8", "mypy"],
"release": ["wheel", "twine"],
},
package_data={"optuna_dashboard": ["public/*"]},