Add Flit and change namer

This commit is contained in:
Andras Schmelczer 2022-07-05 10:45:51 +02:00
parent 50db7b8cb2
commit f188724d4b
13 changed files with 138 additions and 119 deletions

View file

@ -28,7 +28,7 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: schmelczera/great-ai
images: schmelczera/great_ai
- name: Build and push
uses: docker/build-push-action@v3

View file

@ -16,14 +16,11 @@ jobs:
with:
python-version: 3.9
- name: Install pypa/build
run: python -m pip install build --user
- name: Install Flit
run: pip install --upgrade flit --user
- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Build and publish
run: flit publish --setup-py
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}

View file

@ -30,11 +30,10 @@ jobs:
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install --upgrade --requirement dev-requirements.txt
pip install --upgrade .
pip install --upgrade './[dev]'
- name: Check code and formatting
run: scripts/check-python.sh .
run: scripts/check-python.sh . tests
- name: Run tests
run: python3 -m pytest --doctest-modules --cov=. --cov-report=xml --junit-xml pytest.xml --asyncio-mode=strict || true

4
.vscode/tasks.json vendored
View file

@ -4,9 +4,9 @@
{
"label": "Format and lint",
"type": "shell",
"command": "source .env/bin/activate && scripts/format-python.sh .",
"command": "source .env/bin/activate && scripts/format-python.sh . tests",
"windows": {
"command": ".env\\bin\\activate.bat; scripts\\format-python.sh ."
"command": ".env\\bin\\activate.bat; scripts\\format-python.sh . tests"
},
"group": "test",
"presentation": {

View file

@ -3,7 +3,7 @@ FROM python:3.10.4-slim-bullseye
LABEL org.opencontainers.image.title="GreatAI package wrapper container"
LABEL org.opencontainers.image.vendor="ScoutinScience B.V."
LABEL org.opencontainers.image.authors="andras@schmelczer.dev"
LABEL org.opencontainers.image.source="https://github.com/ScoutinScience/great-ai"
LABEL org.opencontainers.image.source="https://github.com/ScoutinScience/great_ai"
ENV ENVIRONMENT=production
EXPOSE 6060

View file

@ -2,22 +2,26 @@
**work in progress, do not use!**
[![Test](https://github.com/ScoutinScience/great_ai/actions/workflows/test.yml/badge.svg)](https://github.com/ScoutinScience/great_ai/actions/workflows/check.yml) [![Quality Gate Status](https://sonar.scoutinscience.com/api/project_badges/measure?project=great-ai&metric=alert_status)](https://sonar.scoutinscience.com/dashboard?id=great-ai) [![Publish on PyPI](https://github.com/ScoutinScience/great_ai/actions/workflows/publish.yaml/badge.svg)](https://github.com/ScoutinScience/great_ai/actions/workflows/publish.yaml) [![Publish on DockerHub](https://github.com/ScoutinScience/great_ai/actions/workflows/docker.yaml/badge.svg)](https://github.com/ScoutinScience/great_ai/actions/workflows/docker.yaml)
[![Test](https://github.com/ScoutinScience/great_ai/actions/workflows/test.yml/badge.svg)](https://github.com/ScoutinScience/great_ai/actions/workflows/check.yml)
[![Quality Gate Status](https://sonar.scoutinscience.com/api/project_badges/measure?project=great-ai&metric=alert_status)](https://sonar.scoutinscience.com/dashboard?id=great_ai)
[![Publish on PyPI](https://github.com/ScoutinScience/great_ai/actions/workflows/publish.yaml/badge.svg)](https://github.com/ScoutinScience/great_ai/actions/workflows/publish.yaml)
[![Publish on DockerHub](https://github.com/ScoutinScience/great_ai/actions/workflows/docker.yaml/badge.svg)](https://github.com/ScoutinScience/great_ai/actions/workflows/docker.yaml)
[![Downloads](https://pepy.tech/badge/great_ai/month)](https://pepy.tech/project/great_ai)
## Find `great-ai` on [DockerHub](https://hub.docker.com/repository/docker/schmelczera/great-ai)
## Find `great_ai` on [DockerHub](https://hub.docker.com/repository/docker/schmelczera/great_ai)
```sh
docker run -p6060:6060 schmelczera/great-ai
docker run -p6060:6060 schmelczera/great_ai
```
Find the dashboard at [http://localhost:6060](http://localhost:6060/dashboard/).
## Find `great-ai` on [PyPI](https://pypi.org/project/great-ai/)
## Find `great_ai` on [PyPI](https://pypi.org/project/great_ai/)
```sh
pip install great-ai
pip install great_ai
```
```python
@ -29,13 +33,13 @@ def hello_world(name: str) -> str:
```
> Create a new file called `main.py`
Deploy by executing `python3 -m great-ai main.py`
Deploy by executing `python3 -m great_ai main.py`
Find the dashboard at [http://localhost:6060](http://localhost:6060/dashboard/).
### Contribute
```sh
pip install --upgrade --requirement dev-requirements.txt
pip install 'great_ai[dev]'
```

View file

@ -1,13 +0,0 @@
build
mkdocs
mkdocstrings[python]
mkdocs-material
autoflake
isort
black[jupyter]
mypy
flake8
pytest
pytest-cov
pytest-subtests
pytest-asyncio

View file

@ -1,3 +1,7 @@
"""GreatAI"""
__version__ = "0.0.12"
from .context import configure
from .deploy import GreatAI
from .exceptions import (

14
mkdocs.yml Normal file
View file

@ -0,0 +1,14 @@
site_name: GreatAI documentation
theme:
name: "material"
plugins:
- mkdocstrings
nav:
- Home: index.md
- tutorials.md
- How-To Guides: how-to-guides.md
- reference.md
- explanation.md

View file

@ -1,7 +1,65 @@
[build-system]
requires = [
"setuptools>=42",
"setuptools-git",
"wheel"
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"
[project]
name = "great_ai"
dynamic = ["version", "description"]
readme = "README.md"
authors = [{ name = "András Schmelczer", email = "andras@schmelczer.dev" }]
license = { file = "LICENSE" }
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)"
]
build-backend = "setuptools.build_meta"
keywords = ["SE4ML", "MLOps", "AI engineering", "general", "robust", "end-to-end", "automated", "trustworthy", "ai", "deployment"]
requires-python = ">= 3.8"
dependencies = [
"scikit-learn",
"matplotlib",
"numpy",
"nbconvert",
"ipython",
"unidecode >= 1.3.0",
"syntok >= 1.4.0",
"langcodes[data] >= 3.3.0",
"langdetect >= 1.0.9",
"tinydb >= 4.7.0",
"boto3 >= 1.23.0",
"plotly >= 5.8.0",
"pandas",
"dash >= 2.4.0",
"fastapi >= 0.70.0",
"uvicorn[standard] >= 0.18.0",
"watchdog >= 2.1.0",
"typeguard >= 2.10.0",
"pymongo >= 3.0.0",
"dill >= 0.3.5.0",
"aiohttp[speedups] >= 3.8.0",
]
[project.optional-dependencies]
dev = [
"flit",
"mkdocs",
"mkdocstrings[python]",
"mkdocs-material",
"autoflake",
"isort",
"black[jupyter]",
"mypy",
"flake8",
"pytest",
"pytest-cov",
"pytest-subtests",
"pytest-asyncio"
]
[project.urls]
Homepage = "https://github.com/ScoutinScience/great_ai"
DockerHub = "https://hub.docker.com/repository/docker/schmelczera/great_ai"
[project.scripts]
great_ai = "great_ai:main"
large_file = "great_ai.large_file:main"

View file

@ -2,21 +2,24 @@
set -e
echo "Checking $1"
echo "Installing dependencies if necessary"
python3 -m pip install --upgrade autoflake isort black[jupyter] mypy flake8
cd $1
for dir in "$@"; do
echo "Checking $dir"
python3 -m autoflake --expand-star-imports --remove-all-unused-imports --ignore-init-module-imports --remove-unused-variables --in-place -r . --check
python3 -m isort --profile black --skip .env . --check
python3 -m black . --exclude .env --check
cd "$dir"
if ls *.py 1> /dev/null 2>&1; then
yes | python3 -m mypy . --install-types > /dev/null || true
python3 -m mypy --namespace-packages --ignore-missing-imports --install-types --non-interactive --disallow-untyped-defs --disallow-incomplete-defs --follow-imports=silent --exclude=external/ --exclude=/build/ --pretty .
fi
python3 -m autoflake --expand-star-imports --remove-all-unused-imports --ignore-init-module-imports --remove-unused-variables --in-place -r . --check
python3 -m isort --profile black --skip .env . --check
python3 -m black . --exclude .env --check
python3 -m flake8 . --count --show-source --statistics --exclude=__init__.py,.env,external --ignore=E501,E722,E402,W503,E203
if find . -name "*.py" 2>/dev/null | grep -q .; then
yes | python3 -m mypy . --install-types > /dev/null || true
python3 -m mypy --namespace-packages --ignore-missing-imports --install-types --non-interactive --disallow-untyped-defs --disallow-incomplete-defs --follow-imports=silent --exclude=external/ --exclude=/build/ --pretty .
fi
cd -
python3 -m flake8 . --count --show-source --statistics --exclude=__init__.py,.env,external --ignore=E501,E402,F821,W503,E722,E203
echo "Finished checking"
cd -
done

View file

@ -2,27 +2,29 @@
set -e
echo "Formatting and checking $1"
for dir in "$@"; do
echo "Formatting and checking $dir"
cd $1
cd "$dir"
echo Running autoflake
python3 -m autoflake --expand-star-imports --remove-all-unused-imports --ignore-init-module-imports --remove-unused-variables --in-place -r .
echo Running autoflake
python3 -m autoflake --expand-star-imports --remove-all-unused-imports --ignore-init-module-imports --remove-unused-variables --in-place -r .
echo Running isort
python3 -m isort --profile black --skip .env .
echo Running isort
python3 -m isort --profile black --skip .env .
echo Running black
python3 -m black . --exclude .env
echo Running black
python3 -m black . --exclude .env
if ls *.py 1> /dev/null 2>&1; then
echo Running mypy
python3 -m mypy --namespace-packages --ignore-missing-imports --install-types --non-interactive --disallow-untyped-defs --disallow-incomplete-defs --pretty --follow-imports=silent --exclude=external/ --exclude=/build/ .
fi
if find . -name "*.py" 2>/dev/null | grep -q .; then
echo Running mypy
echo Running Flake8
python3 -m flake8 . --count --show-source --statistics --exclude=__init__.py,.env,external --ignore=E501,E722,E402,W503,E203
if [ ! -d .mypy_cache ]; then
python3 -m mypy --namespace-packages --ignore-missing-imports --disallow-untyped-defs --disallow-incomplete-defs --follow-imports=silent --exclude=external/ --exclude=/build/ --pretty . || true
fi
cd -
python3 -m mypy --namespace-packages --ignore-missing-imports --install-types --non-interactive --disallow-untyped-defs --disallow-incomplete-defs --follow-imports=silent --exclude=external/ --exclude=/build/ --pretty . || true
fi
echo "Finished formatting"
cd -
done

View file

@ -1,49 +0,0 @@
[metadata]
name = great-ai
version = 0.0.11
author = András Schmelczer
author_email = andras@scoutinscience.com
description =
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/ScoutinScience/great-ai
project_urls =
Bug Tracker = https://github.com/ScoutinScience/great-ai/issues
classifiers =
Programming Language :: Python :: 3
Operating System :: OS Independent
[options]
package_dir =
great_ai = great_ai
include_package_data = True
python_requires = >= 3.8
install_requires =
scikit-learn
matplotlib
numpy
nbconvert
ipython
unidecode >= 1.3.0
syntok >= 1.4.0
langcodes[data] >= 3.3.0
langdetect >= 1.0.9
tinydb >= 4.7.0
boto3 >= 1.23.0
plotly >= 5.8.0
pandas
dash >= 2.4.0
fastapi >= 0.70.0
uvicorn[standard] >= 0.18.0
watchdog >= 2.1.0
typeguard >= 2.10.0
pymongo >= 3.0.0
dill >= 0.3.5.0
aiohttp[speedups] >= 3.8.0
[options.package_data]
* = *.conf, *.css, *.png
[options.packages.find]
where = .