Skip to content

Commit

Permalink
Added CI (#243)
Browse files Browse the repository at this point in the history
* Refactored entry point
  • Loading branch information
jssuzanne committed Feb 17, 2024
1 parent 997cbfe commit 4b2a12f
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 15 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/tests.yaml
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
services:
postgres:
image: postgres:latest
Expand Down Expand Up @@ -59,6 +59,8 @@ jobs:
ANYBLOK_DATABASE_HOST: localhost
ANYBLOK_DATABASE_USER: postgres
ANYBLOK_DATABASE_PASSWORD: postgres
COVERAGE_CORE: sysmon
PYDEVD_DISABLE_FILE_VALIDATION: 1
run: pytest anyblok/tests
- name: Drop db
env:
Expand Down Expand Up @@ -92,6 +94,8 @@ jobs:
ANYBLOK_DATABASE_HOST: localhost
ANYBLOK_DATABASE_USER: postgres
ANYBLOK_DATABASE_PASSWORD: postgres
COVERAGE_CORE: sysmon
PYDEVD_DISABLE_FILE_VALIDATION: 1
run: pytest --cov-append anyblok/bloks/anyblok_core
- name: Generate lcov
run: coverage-lcov
Expand Down
19 changes: 10 additions & 9 deletions anyblok/__init__.py
@@ -1,14 +1,15 @@
# This file is a part of the AnyBlok project
# this file is a part of the anyblok project
#
# Copyright (C) 2014 Jean-Sebastien SUZANNE <jssuzanne@anybox.fr>
# Copyright (C) 2015 Jean-Sebastien SUZANNE <jssuzanne@anybox.fr>
# Copyright (C) 2016 Jean-Sebastien SUZANNE <jssuzanne@anybox.fr>
# Copyright (C) 2017 Jean-Sebastien SUZANNE <jssuzanne@anybox.fr>
# copyright (c) 2014 jean-sebastien suzanne <jssuzanne@anybox.fr>
# copyright (c) 2015 jean-sebastien suzanne <jssuzanne@anybox.fr>
# copyright (c) 2016 jean-sebastien suzanne <jssuzanne@anybox.fr>
# copyright (c) 2017 jean-sebastien suzanne <jssuzanne@anybox.fr>
# copyright (c) 2024 jean-sebastien suzanne <js.suzanne@gmail.com>
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file,You can
# obtain one at http://mozilla.org/MPL/2.0/.
from pkg_resources import iter_entry_points
# this source code form is subject to the terms of the mozilla public license,
# v. 2.0. if a copy of the mpl was not distributed with this file,you can
# obtain one at http://mozilla.org/mpl/2.0/.
from .pkg_metadata import iter_entry_points
from logging import getLogger
from .schema import ( # noqa
ForeignKeyConstraint,
Expand Down
3 changes: 1 addition & 2 deletions anyblok/blok.py
Expand Up @@ -11,12 +11,11 @@
from sys import modules
from time import sleep

from pkg_resources import iter_entry_points

from anyblok.environment import EnvironmentManager
from anyblok.imp import ImportManager

from .logging import log
from .pkg_metadata import iter_entry_points

logger = getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion anyblok/migration.py
Expand Up @@ -17,7 +17,6 @@
from alembic.autogenerate import compare_metadata
from alembic.migration import MigrationContext
from alembic.operations import Operations
from pkg_resources import iter_entry_points
from sqlalchemy import and_, func, inspect, select, text, update
from sqlalchemy.exc import IntegrityError, OperationalError
from sqlalchemy.ext.compiler import compiles
Expand All @@ -32,6 +31,7 @@
from anyblok.config import Configuration

from .common import return_list, sgdb_in
from .pkg_metadata import iter_entry_points

logger = getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion anyblok/model/plugins.py
Expand Up @@ -7,7 +7,7 @@
# obtain one at http://mozilla.org/MPL/2.0/.
from logging import getLogger

from pkg_resources import iter_entry_points
from ..pkg_metadata import iter_entry_points

logger = getLogger(__name__)

Expand Down
14 changes: 14 additions & 0 deletions anyblok/pkg_metadata.py
@@ -0,0 +1,14 @@
# this file is a part of the anyblok project
#
# copyright (c) 2024 jean-sebastien suzanne <js.suzanne@gmail.com>
#
# this source code form is subject to the terms of the mozilla public license,
# v. 2.0. if a copy of the mpl was not distributed with this file,you can
# obtain one at http://mozilla.org/mpl/2.0/.
try:
from pkg_resources import iter_entry_points
except ImportError:
from importlib.metadata import entry_points

def iter_entry_points(group):
return entry_points(group=group)
6 changes: 5 additions & 1 deletion anyblok/registry.py
Expand Up @@ -7,9 +7,12 @@
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file,You can
# obtain one at http://mozilla.org/MPL/2.0/.
# try:
# from importlib.metadata import entry_points
# except ImportError:
# from importlib_metadata import entry_points
from logging import getLogger

from pkg_resources import iter_entry_points
from sqlalchemy import MetaData, create_engine, event, text
from sqlalchemy.exc import (
InternalError,
Expand All @@ -30,6 +33,7 @@
from .environment import EnvironmentManager
from .logging import log
from .migration import Migration
from .pkg_metadata import iter_entry_points
from .version import parse_version

try:
Expand Down
2 changes: 2 additions & 0 deletions doc/CHANGES.rst
Expand Up @@ -30,6 +30,8 @@ CHANGELOG
the Many2One when the target could be coming from any Model validate by
the model_validator choosen. If you have only one targeted Model use the
relationship ManyToOne
* Reverted the deletion of the core.Session
* removed dependencies of pkg_ressource for entrypoints and use importlib.

2.1.0 (2023-07-26)
------------------
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Expand Up @@ -26,6 +26,7 @@ dependencies = [
'python-dateutil',
'texttable',
'testfixtures',
'importlib_metadata',
]
dynamic = ["readme"]
keywords = [
Expand All @@ -41,6 +42,7 @@ classifiers = [
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
"Topic :: Database",
Expand Down Expand Up @@ -130,3 +132,7 @@ src_paths = ["anyblok", "anyblok_nose"]
filter_files = true
line_length = 80
skip = ["anyblok/__init__.py"]

[tool.coverage.run]
# Whether to measure branch coverage in addition to statement coverage
branch = false

0 comments on commit 4b2a12f

Please sign in to comment.