Skip to content

Commit caa2a04

Browse files
committed
Initial commit
0 parents  commit caa2a04

23 files changed

+361
-0
lines changed

.github/workflows/publish.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Publish
3+
4+
on:
5+
push:
6+
tags:
7+
- '*'
8+
9+
jobs:
10+
publish:
11+
name: "Publish release"
12+
runs-on: "ubuntu-latest"
13+
14+
steps:
15+
- uses: "actions/checkout@v2"
16+
- uses: "actions/setup-python@v1"
17+
with:
18+
python-version: 3.8
19+
- name: "Publish"
20+
run: "scripts/publish"
21+
env:
22+
TWINE_USERNAME: __token__
23+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

.github/workflows/test-suite.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Test Suite
3+
4+
on:
5+
push:
6+
branches: ["main"]
7+
pull_request:
8+
branches: ["main"]
9+
10+
jobs:
11+
tests:
12+
name: "Python ${{ matrix.python-version }}"
13+
runs-on: "ubuntu-latest"
14+
15+
strategy:
16+
matrix:
17+
python-version: ["3.7", "3.8", "3.9", "3.10"]
18+
19+
steps:
20+
- uses: "actions/checkout@v2"
21+
- uses: "actions/setup-python@v2"
22+
with:
23+
python-version: "${{ matrix.python-version }}"
24+
- name: "Install dependencies"
25+
run: "scripts/install"
26+
- name: "Run linting checks"
27+
run: "scripts/check"
28+
- name: "Build package & docs"
29+
run: "scripts/build"
30+
# - name: "Run tests"
31+
# run: "scripts/test"
32+
# - name: "Enforce coverage"
33+
# run: "scripts/coverage"

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*.egg-info
2+
*.pyc
3+
.env
4+
venv/
5+
__pycache__/
6+
htmlcov/
7+
.coverage
8+
.pytest_cache/
9+
.mypy_cache/
10+
examples/

LICENSE.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright © 2022, Amin Alaee.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
7+
* Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
9+
10+
* Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
* Neither the name of the copyright holder nor the names of its
15+
contributors may be used to endorse or promote products derived from
16+
this software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# SQLAlchemy Admin dashboard

docs/js/chat.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
((window.gitter = {}).chat = {}).options = {
2+
room: 'encode/community'
3+
};

docs/js/sidecar-1.5.0.js

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mkdocs.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
site_name: SQLAlchemy Admin
2+
site_description: An admin dashboard for SQLAlchemy.
3+
4+
theme:
5+
name: 'material'
6+
7+
repo_name: sqlalchemy-admin/sqlalchemy-admin
8+
repo_url: https://github.com/sqlalchemy-admin/sqlalchemy-admin
9+
edit_uri: ""
10+
11+
# nav:
12+
# - Introduction: 'index.md'
13+
14+
markdown_extensions:
15+
- markdown.extensions.codehilite:
16+
guess_lang: false
17+
- mkautodoc
18+
19+
extra_javascript:
20+
- 'js/chat.js'
21+
- 'js/sidecar-1.5.0.js'

requirements.txt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-e .[starlette]
2+
3+
# Tests
4+
autoflake==1.4
5+
black==21.12b0
6+
coverage==6.2
7+
flake8==4.0.1
8+
isort==5.10.1
9+
mypy==0.920
10+
pytest==6.2.5
11+
12+
# Documentation
13+
mkdocs==1.2.3
14+
mkdocs-material==8.1.2
15+
mkautodoc==0.1.0
16+
17+
# Packaging
18+
twine==3.7.1
19+
wheel==0.37.0

scripts/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Development Scripts
2+
3+
* `scripts/build` - Build python package and documentations.
4+
* `scripts/check` - Run the code linting, checking that it passes.
5+
* `scripts/clean` - Delete any build artifacts.
6+
* `scripts/coverage` - Check test coverage.
7+
* `scripts/docs` - Run the documentation server locally.
8+
* `scripts/install` - Install dependencies in a virtual environment.
9+
* `scripts/lint` - Run the code linting.
10+
* `scripts/test` - Run the test suite.
11+
* `scripts/publish` - Publish the latest version to PyPI.
12+
13+
Styled after GitHub's ["Scripts to Rule Them All"](https://github.com/github/scripts-to-rule-them-all).

scripts/build

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh -e
2+
3+
if [ -d 'venv' ] ; then
4+
PREFIX="venv/bin/"
5+
else
6+
PREFIX=""
7+
fi
8+
9+
set -x
10+
11+
${PREFIX}python setup.py sdist bdist_wheel
12+
${PREFIX}twine check dist/*
13+
${PREFIX}mkdocs build

scripts/check

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh -e
2+
3+
export PREFIX=""
4+
if [ -d 'venv' ] ; then
5+
export PREFIX="venv/bin/"
6+
fi
7+
export SOURCE_FILES="sqladmin tests"
8+
9+
set -x
10+
11+
${PREFIX}isort --check --diff --project=sqladmin $SOURCE_FILES
12+
${PREFIX}black --check --diff $SOURCE_FILES
13+
${PREFIX}flake8 $SOURCE_FILES
14+
# ${PREFIX}mypy $SOURCE_FILES

scripts/clean

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh -e
2+
3+
PACKAGE="sqladmin"
4+
5+
if [ -d 'dist' ] ; then
6+
rm -r dist
7+
fi
8+
if [ -d 'site' ] ; then
9+
rm -r site
10+
fi
11+
if [ -d 'htmlcov' ] ; then
12+
rm -r htmlcov
13+
fi
14+
if [ -d "${PACKAGE}.egg-info" ] ; then
15+
rm -r "${PACKAGE}.egg-info"
16+
fi
17+
18+
find ${PACKAGE} -type f -name "*.py[co]" -delete
19+
find ${PACKAGE} -type d -name __pycache__ -delete

scripts/coverage

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh -e
2+
3+
export PREFIX=""
4+
if [ -d 'venv' ] ; then
5+
export PREFIX="venv/bin/"
6+
fi
7+
8+
set -x
9+
10+
${PREFIX}coverage report --show-missing --skip-covered --fail-under=100

scripts/docs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh -e
2+
3+
export PREFIX=""
4+
if [ -d 'venv' ] ; then
5+
export PREFIX="venv/bin/"
6+
fi
7+
8+
set -x
9+
10+
${PREFIX}mkdocs serve

scripts/install

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh -e
2+
3+
PYTHON="python3"
4+
REQUIREMENTS="requirements.txt"
5+
VENV="venv"
6+
7+
set -x
8+
9+
if [ -z "$GITHUB_ACTIONS" ]; then
10+
"$PYTHON" -m venv "$VENV"
11+
PIP="$VENV/bin/pip"
12+
else
13+
PIP="pip"
14+
fi
15+
16+
"$PIP" install -r "$REQUIREMENTS"

scripts/lint

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh -e
2+
3+
if [ -d 'venv' ] ; then
4+
PREFIX="venv/bin/"
5+
else
6+
PREFIX=""
7+
fi
8+
SOURCE_FILES="sqladmin tests"
9+
10+
set -x
11+
12+
${PREFIX}autoflake --in-place --recursive ${SOURCE_FILES}
13+
${PREFIX}isort --project=sqladmin ${SOURCE_FILES}
14+
${PREFIX}black ${SOURCE_FILES}

scripts/publish

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh -e
2+
3+
if [ -d 'venv' ] ; then
4+
PREFIX="venv/bin/"
5+
else
6+
PREFIX=""
7+
fi
8+
9+
if [ ! -z "$GITHUB_ACTIONS" ]; then
10+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
11+
git config --local user.name "GitHub Action"
12+
13+
VERSION=`grep __version__ ./sqladmin/__init__.py | grep -o '[0-9][^"]*'`
14+
15+
if [ "refs/tags/${VERSION}" != "${GITHUB_REF}" ] ; then
16+
echo "GitHub Ref '${GITHUB_REF}' did not match package version '${VERSION}'"
17+
exit 1
18+
fi
19+
fi
20+
21+
set -x
22+
23+
${PREFIX}twine upload dist/*
24+
${PREFIX}mkdocs gh-deploy --force

scripts/test

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
3+
export PREFIX=""
4+
if [ -d 'venv' ] ; then
5+
export PREFIX="venv/bin/"
6+
fi
7+
8+
set -ex
9+
10+
if [ -z $GITHUB_ACTIONS ]; then
11+
scripts/check
12+
fi
13+
14+
${PREFIX}coverage run -m pytest $@
15+
16+
if [ -z $GITHUB_ACTIONS ]; then
17+
scripts/coverage
18+
fi

setup.cfg

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
[metadata]
2+
name = sqladmin
3+
version = attr: sqladmin.__init__.__version__
4+
author = Amin Alaee
5+
author_email = [email protected]
6+
description = Admin interface for SQLAlchemy.
7+
long_description = file: README.md
8+
long_description_content_type = text/markdown
9+
url = https://github.com/sqlalchemy-admin/sqlalchemy-admin
10+
license = BSD
11+
classifiers =
12+
Development Status :: 3 - Alpha
13+
Environment :: Web Environment
14+
Intended Audience :: Developers
15+
License :: OSI Approved :: BSD License
16+
Operating System :: OS Independent
17+
Topic :: Internet :: WWW/HTTP
18+
Programming Language :: Python :: 3
19+
Programming Language :: Python :: 3.7
20+
Programming Language :: Python :: 3.8
21+
Programming Language :: Python :: 3.9
22+
Programming Language :: Python :: 3.10
23+
24+
[options]
25+
packages = find:
26+
include_package_data = True
27+
zip_safe = False
28+
python_requires = >=3.7
29+
install_requires =
30+
sqlalchemy >=1.4, <1.5
31+
jinja2 >=3, <4
32+
wtforms >=3, <4
33+
34+
[options.package_data]
35+
starlette = py.typed
36+
37+
[options.packages.find]
38+
exclude =
39+
tests*
40+
41+
[options.extras_require]
42+
starlette =
43+
starlette
44+
uvicorn
45+
46+
47+
[flake8]
48+
ignore = E203
49+
max-line-length = 88
50+
51+
[mypy]
52+
disallow_untyped_defs = True
53+
ignore_missing_imports = True
54+
show_error_codes = True
55+
56+
[tool:isort]
57+
profile = black
58+
combine_as_imports = True
59+
60+
[coverage:run]
61+
source_pkgs = sqladmin, tests

setup.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env python
2+
from setuptools import setup
3+
4+
5+
setup()

sqladmin/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.0.0"

tests/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)