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 id: meta
uses: docker/metadata-action@v4 uses: docker/metadata-action@v4
with: with:
images: schmelczera/great-ai images: schmelczera/great_ai
- name: Build and push - name: Build and push
uses: docker/build-push-action@v3 uses: docker/build-push-action@v3

View file

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

View file

@ -30,11 +30,10 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
python3 -m pip install --upgrade pip python3 -m pip install --upgrade pip
pip install --upgrade --requirement dev-requirements.txt pip install --upgrade './[dev]'
pip install --upgrade .
- name: Check code and formatting - name: Check code and formatting
run: scripts/check-python.sh . run: scripts/check-python.sh . tests
- name: Run tests - name: Run tests
run: python3 -m pytest --doctest-modules --cov=. --cov-report=xml --junit-xml pytest.xml --asyncio-mode=strict || true 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", "label": "Format and lint",
"type": "shell", "type": "shell",
"command": "source .env/bin/activate && scripts/format-python.sh .", "command": "source .env/bin/activate && scripts/format-python.sh . tests",
"windows": { "windows": {
"command": ".env\\bin\\activate.bat; scripts\\format-python.sh ." "command": ".env\\bin\\activate.bat; scripts\\format-python.sh . tests"
}, },
"group": "test", "group": "test",
"presentation": { "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.title="GreatAI package wrapper container"
LABEL org.opencontainers.image.vendor="ScoutinScience B.V." LABEL org.opencontainers.image.vendor="ScoutinScience B.V."
LABEL org.opencontainers.image.authors="andras@schmelczer.dev" 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 ENV ENVIRONMENT=production
EXPOSE 6060 EXPOSE 6060

View file

@ -2,22 +2,26 @@
**work in progress, do not use!** **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 ```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 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 ```sh
pip install great-ai pip install great_ai
``` ```
```python ```python
@ -29,13 +33,13 @@ def hello_world(name: str) -> str:
``` ```
> Create a new file called `main.py` > 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/). Find the dashboard at [http://localhost:6060](http://localhost:6060/dashboard/).
### Contribute ### Contribute
```sh ```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 .context import configure
from .deploy import GreatAI from .deploy import GreatAI
from .exceptions import ( 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] [build-system]
requires = [ requires = ["flit_core >=3.2,<4"]
"setuptools>=42", build-backend = "flit_core.buildapi"
"setuptools-git",
"wheel" [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 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"
cd "$dir"
python3 -m autoflake --expand-star-imports --remove-all-unused-imports --ignore-init-module-imports --remove-unused-variables --in-place -r . --check 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 isort --profile black --skip .env . --check
python3 -m black . --exclude .env --check python3 -m black . --exclude .env --check
if ls *.py 1> /dev/null 2>&1; then if find . -name "*.py" 2>/dev/null | grep -q .; then
yes | python3 -m mypy . --install-types > /dev/null || true 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 . 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 fi
python3 -m flake8 . --count --show-source --statistics --exclude=__init__.py,.env,external --ignore=E501,E722,E402,W503,E203 python3 -m flake8 . --count --show-source --statistics --exclude=__init__.py,.env,external --ignore=E501,E402,F821,W503,E722,E203
cd - cd -
done
echo "Finished checking"

View file

@ -2,9 +2,10 @@
set -e set -e
echo "Formatting and checking $1" for dir in "$@"; do
echo "Formatting and checking $dir"
cd $1 cd "$dir"
echo Running autoflake echo Running autoflake
python3 -m autoflake --expand-star-imports --remove-all-unused-imports --ignore-init-module-imports --remove-unused-variables --in-place -r . python3 -m autoflake --expand-star-imports --remove-all-unused-imports --ignore-init-module-imports --remove-unused-variables --in-place -r .
@ -15,14 +16,15 @@ python3 -m isort --profile black --skip .env .
echo Running black echo Running black
python3 -m black . --exclude .env python3 -m black . --exclude .env
if ls *.py 1> /dev/null 2>&1; then if find . -name "*.py" 2>/dev/null | grep -q .; then
echo Running mypy 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/ .
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 fi
echo Running Flake8 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
python3 -m flake8 . --count --show-source --statistics --exclude=__init__.py,.env,external --ignore=E501,E722,E402,W503,E203 fi
cd - cd -
done
echo "Finished formatting"

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 = .