Skip to content

Commit

Permalink
chore:使用flit替代setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
amisadmin committed Feb 16, 2022
1 parent 60639ca commit d2a334a
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 109 deletions.
50 changes: 28 additions & 22 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package
name: Pytest

on:
workflow_dispatch:
Expand All @@ -15,32 +12,41 @@ on:
# paths:
# - 'fastapi_amis_admin/**'
# - 'tests/**'
jobs:
build:

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.6", "3.7", "3.8", "3.9", "3.10" ]
fail-fast: false

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest aiosqlite
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
- uses: actions/cache@v2
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test

- name: Install Flit
if: steps.cache.outputs.cache-hit != 'true'
run: pip install flit
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: flit install --symlink
- name: Test
run: pytest
# - name: Upload coverage
# uses: codecov/codecov-action@v1
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

66 changes: 27 additions & 39 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,34 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package
name: Publish Python Package

on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'fastapi_amis_admin/__init__.py'
release:
types:
- created

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build

- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

- name: Publish distribution to PyPI
# if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- uses: actions/cache@v2
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-publish
- name: Install Flit
if: steps.cache.outputs.cache-hit != 'true'
run: pip install flit
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: flit install --symlink
- name: Publish to PyPI
# if: startsWith(github.ref, 'refs/tags')
run: flit publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion fastapi_amis_admin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "0.0.13"
__version__ = "0.0.15"
__url__ = "https://github.com/amisadmin/fastapi_amis_admin"
64 changes: 64 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "fastapi_amis_admin"
authors = [
{ name = "Atomi", email = "[email protected]" },
]
maintainers = [
{ name = "Atomi", email = "[email protected]" },
]
description = "fastapi-amis-admin is a high-performance, efficient and easily extensible FastAPI admin framework. Inspired by Django-admin, and has as many powerful functions as Django-admin. "
readme = "README.md"
requires-python = ">=3.6.1"
dynamic = ["version"]
keywords = [
"fastapi",
"fastapi-admin",
"fastapi-amis-admin",
"django-admin",
"sqlmodel",
"sqlalchemy",
]
classifiers = [
"Framework :: FastAPI",
"Environment :: Web Environment",
"Topic :: System :: Systems Administration",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]
dependencies = [
"fastapi>=0.68.0",
"sqlmodel>=0.0.4",
"ujson>=4.0.1",
"python-multipart>=0.0.5",
]



[project.urls]
Documentation = "http://docs.amis.work/"
Source = "https://github.com/amisadmin/fastapi_amis_admin"

[project.optional-dependencies]
test = [
"pytest >=6.2.4,<7.0.0",
"aiosqlite",
]
dev = [
"jinja2 >=2.11.2,<4.0.0",
"aiosqlite",
"uvicorn[standard] >=0.12.0,<0.16.0",
]
all = [
"jinja2 >=2.11.2,<4.0.0",
"uvicorn[standard] >=0.12.0,<0.16.0",
]
47 changes: 0 additions & 47 deletions setup.py

This file was deleted.

0 comments on commit d2a334a

Please sign in to comment.