-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
479 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FLASK_APP=pypnnomenclature:create_app | ||
FLASK_ENV=development | ||
FLASK_DEBUG=1 | ||
NOMENCLATURE_SETTINGS=settings.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: pytest | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
branches: | ||
- master | ||
- develop | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- name: "Debian 10" | ||
python-version: "3.7" | ||
postgres-version: "11-stretch" | ||
- name: "Debian 11" | ||
python-version: "3.9" | ||
postgres-version: "13-bullseye" | ||
|
||
name: ${{ matrix.name }} | ||
|
||
services: | ||
postgres: | ||
image: postgres:${{ matrix.postgres-version }} | ||
env: | ||
POSTGRES_PASSWORD: postgres | ||
ports: | ||
- 5432:5432 | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
- name: Add database extensions | ||
run: | | ||
psql -h localhost -U postgres -d postgres -tc 'CREATE EXTENSION "uuid-ossp";' | ||
psql -h localhost -U postgres -d postgres -tc 'CREATE EXTENSION "pg_trgm";' | ||
env: | ||
PGPASSWORD: postgres | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- name: Set up Python ${{ matrix.python-version }} | ||
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-cov \ | ||
-e .[tests] \ | ||
-e file:dependencies/Utils-Flask-SQLAlchemy#egg=utils-flask-sqlalchemy \ | ||
-e file:dependencies/TaxHub#egg=taxhub \ | ||
-e file:dependencies/UsersHub-authentification-module#egg=pypnusershub | ||
- name: Install database | ||
run: | | ||
flask db upgrade nomenclatures@head | ||
flask db upgrade nomenclatures_inpn_data@head | ||
flask db upgrade nomenclatures_taxonomie@head | ||
flask db upgrade nomenclatures_taxonomie_inpn_data@head | ||
env: | ||
NOMENCLATURE_SETTINGS: test_settings.py | ||
- name: Test with pytest | ||
run: | | ||
pytest -v --cov --cov-report xml | ||
env: | ||
NOMENCLATURE_SETTINGS: test_settings.py | ||
- name: Upload coverage to Codecov | ||
if: ${{ matrix.name == 'Debian 11' }} | ||
uses: codecov/codecov-action@v2 | ||
with: | ||
flags: pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,3 +103,8 @@ ENV/ | |
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
*.swp | ||
*.swo | ||
|
||
/*settings.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[submodule "dependencies/Utils-Flask-SQLAlchemy"] | ||
path = dependencies/Utils-Flask-SQLAlchemy | ||
url = https://github.com/PnX-SI/Utils-Flask-SQLAlchemy.git | ||
[submodule "dependencies/TaxHub"] | ||
path = dependencies/TaxHub | ||
url = https://github.com/PnX-SI/TaxHub.git | ||
[submodule "dependencies/UsersHub-authentification-module"] | ||
path = dependencies/UsersHub-authentification-module | ||
url = https://github.com/PnX-SI/UsersHub-authentification-module.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.4.5 | ||
1.5.0 |
Submodule UsersHub-authentification-module
added at
699efc
Submodule Utils-Flask-SQLAlchemy
added at
df44a2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[tool.pytest.ini_options] | ||
minversion = "6.0" | ||
testpaths = [ | ||
"src", | ||
] | ||
|
||
[tool.coverage.run] | ||
source = [ | ||
"pypnnomenclature", | ||
] | ||
omit = [ | ||
"*/tests/*", | ||
"*/migrations/*", | ||
] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
python-dotenv | ||
flask | ||
Flask-Admin | ||
flask-sqlalchemy | ||
flask-migrate | ||
psycopg2 | ||
utils-flask-sqlalchemy | ||
utils-flask-sqlalchemy>=0.2.6 | ||
flask-marshmallow | ||
marshmallow-sqlalchemy | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,33 @@ | ||
__version__ = "1.1.1" | ||
from pathlib import Path | ||
from itertools import chain | ||
from pkg_resources import iter_entry_points | ||
|
||
from flask import Flask | ||
from flask_migrate import Migrate | ||
|
||
from pypnnomenclature.env import db, ma | ||
from pypnnomenclature.routes import routes | ||
|
||
|
||
migrate = Migrate() | ||
|
||
|
||
@migrate.configure | ||
def configure_alembic(alembic_config): | ||
version_locations = alembic_config.get_main_option('version_locations', default='').split() | ||
for entry_point in chain(iter_entry_points('alembic', 'migrations')): | ||
_, migrations = str(entry_point).split('=', 1) | ||
version_locations += [ migrations.strip() ] | ||
alembic_config.set_main_option('version_locations', ' '.join(version_locations)) | ||
return alembic_config | ||
|
||
|
||
def create_app(): | ||
app = Flask('Habref') | ||
app.config.from_envvar('NOMENCLATURE_SETTINGS') | ||
ma.init_app(app) | ||
db.init_app(app) | ||
migrate.init_app(app, db, directory=Path(__file__).parent / 'migrations') | ||
app.register_blueprint(routes, url_prefix='/nomenclatures') | ||
# TODO admin | ||
return app |
Oops, something went wrong.