Skip to content

Major versions upgrade #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on: [push, pull_request]
jobs:
run-tox:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -20,7 +20,7 @@ jobs:
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: 3.6.15
python-version: 3.11.5
- name: Install Tox
run: pip install tox
- name: Upgrade setuptools
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.graphql-api
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM python:3.6.12-buster AS build
FROM python:3.11.5 AS build

COPY . /src
WORKDIR /src
RUN python3 setup.py bdist_wheel

FROM python:3.6.12-slim-buster
FROM python:3.11.5-slim

LABEL org.opencontainers.image.source=https://github.com/eiffel-community/eiffel-graphql-api
LABEL org.opencontainers.image.authors=eiffel-graphql-api-maintainers@googlegroups.com
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.storage
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM python:3.6.12-buster AS build
FROM python:3.11.5 AS build

COPY . /src
WORKDIR /src
RUN python3 setup.py bdist_wheel

FROM python:3.6.12-slim-buster
FROM python:3.11.5-slim

LABEL org.opencontainers.image.source=https://github.com/eiffel-community/eiffel-graphql-api
LABEL org.opencontainers.image.authors=eiffel-graphql-api-maintainers@googlegroups.com
Expand Down
12 changes: 12 additions & 0 deletions deploy/development.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
RABBITMQ_HOST=rabbitmq
RABBITMQ_EXCHANGE=amq.fanout
RABBITMQ_USERNAME=guest
RABBITMQ_PASSWORD=guest
RABBITMQ_PORT=5672
RABBITMQ_VHOST=
RABBITMQ_QUEUE=graphql-test
RABBITMQ_DURABLE_QUEUE=true
MONGODB_CONNSTRING=mongodb://root:pass@mongodb/admin
MONGODB_DATABASE=admin
MONGODB_INITDB_ROOT_USERNAME=root
MONGODB_INITDB_ROOT_PASSWORD=pass
44 changes: 44 additions & 0 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
networks:
eiffel-graphql-api-network:
name: "eiffel-graphql-api-network"

services:
mongodb:
image: "mongodb/mongodb-community-server"
env_file:
- development.env
networks:
- eiffel-graphql-api-network

rabbitmq:
image: "rabbitmq:3-management-alpine"
networks:
- eiffel-graphql-api-network
ports:
- 15672:15672
- 5672:5672

api:
build:
context: ../
dockerfile: Dockerfile.graphql-api
ports:
- 5000:5000
networks:
- eiffel-graphql-api-network
env_file:
- development.env
depends_on:
- mongodb

storage:
build:
context: ../
dockerfile: Dockerfile.storage
networks:
- eiffel-graphql-api-network
env_file:
- development.env
depends_on:
- rabbitmq
- mongodb
8 changes: 3 additions & 5 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
sphinx<2
pyscaffold==2.5.10
mistune==0.8.4
m2r==0.2.1
sphinx-rtd-theme<0.5
sphinx~=6.2.1
m2r==0.3.1
sphinx-rtd-theme==1.3.0
20 changes: 10 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
# numpy==1.13.3
# scipy==1.0
#
eiffellib==1.2.0
requests==2.22.0
eiffellib[rabbitmq]==2.4
requests==2.31.0
pymongo[srv]==3.12.0
graphql-core==2.2.1
gql==0.1.0
Flask==1.1.1
Flask-GraphQL==2.0.0
graphene==2.1.8
gunicorn==20.0.4
greenlet==0.4.14
gevent==1.4.0
graphql-core==3.2.3
gql[requests]==3.4.1
Flask==2.3.3
graphql-server==3.0.0b6
graphene==3.3
gunicorn==21.2.0
greenlet==2.0.2
gevent==22.10.2
21 changes: 16 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
name = eiffel-graphql-api
description = Eiffel GraphQL API and storage solution.
author = Tobias Persson
author-email = [email protected]
author_email = [email protected]
license = Apache License, Version 2.0
long-description = file: README.rst
long-description-content-type = text/x-rst; charset=UTF-8
long_description = file: README.rst
long_description_content_type = text/x-rst; charset=UTF-8
url = https://github.com/eiffel-community/eiffel-graphql-api
project-urls =
project_urls =
Documentation = https://eiffel-graphql-api.readthedocs.io
platforms = any
classifiers =
Expand All @@ -23,7 +23,18 @@ package_dir =
=src
# DON'T CHANGE THE FOLLOWING LINE! IT WILL BE UPDATED BY PYSCAFFOLD!
setup_requires = pyscaffold>=3.2a0,<3.3a0
install_requires = eiffellib==1.2.0;requests==2.22.0;pymongo[srv]==3.12.0;graphql-core==2.2.1;gql==0.1.0;Flask==1.1.1;Flask-GraphQL==2.0.0;graphene==2.1.8;gunicorn==20.0.4;greenlet==0.4.14;gevent==1.4.0
install_requires =
eiffellib[rabbitmq]==2.4.1
requests==2.31.0
pymongo[srv]==3.12.0
graphql-core==3.2.3
gql[requests]==3.4.1
Flask==2.3.3
graphql-server==3.0.0b6
graphene==3.3
gunicorn==21.2.0
greenlet==2.0.2
gevent==22.10.2

[options.package_data]
* = *.json
Expand Down
2 changes: 1 addition & 1 deletion src/eiffel_graphql_api/graphql/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
"""Eiffel GraphQL Flask API APP."""
from flask import Flask
from flask_graphql import GraphQLView
from graphql_server.flask.graphqlview import GraphQLView

from .schemas.schema import SCHEMA

Expand Down
2 changes: 1 addition & 1 deletion src/eiffel_graphql_api/graphql/schemas/lib/bigint.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def serializer(value):
@staticmethod
def parse_literal(node):
"""Parse node literal and convert to float if too large."""
if isinstance(node, ast.IntValue):
if isinstance(node, ast.IntValueNode):
num = int(node.value)
if num > MAX_INT or num < MIN_INT:
return float(int(num))
Expand Down
40 changes: 38 additions & 2 deletions src/eiffel_graphql_api/graphql/schemas/links/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,45 @@ def resolve_artifact_created(self, _):
return ArtifactCreated(event)


class ReusedArtifact(Artifact):
class ReusedArtifact(graphene.ObjectType):
"""Reused artifact link."""

artifact_created = graphene.Field(ArtifactCreated)

def __init__(self, link):
"""Initialize link."""
# pylint:disable=super-init-not-called
self.link = link

def resolve_artifact_created(self, _):
"""Resolve artifact created link."""
from ..union import NotFound # pylint:disable=import-outside-toplevel

event = find_one(
"EiffelArtifactCreatedEvent", {"meta.id": self.link.get("target")}
)
if event is None:
return NotFound(self.link, "Could not find event in database.")
return ArtifactCreated(event)


class ArtifactPreviousVersion(Artifact):
class ArtifactPreviousVersion(graphene.ObjectType):
"""Previous artifact version link."""

artifact_created = graphene.Field(ArtifactCreated)

def __init__(self, link):
"""Initialize link."""
# pylint:disable=super-init-not-called
self.link = link

def resolve_artifact_created(self, _):
"""Resolve artifact created link."""
from ..union import NotFound # pylint:disable=import-outside-toplevel

event = find_one(
"EiffelArtifactCreatedEvent", {"meta.id": self.link.get("target")}
)
if event is None:
return NotFound(self.link, "Could not find event in database.")
return ArtifactCreated(event)
2 changes: 1 addition & 1 deletion src/eiffel_graphql_api/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def parse_args(args):
:param args: Command line parameters as list of strings.
:type args: list
:return: Command line parameters namespace.
:rtype: :obj:`argparse.Namespace
:rtype: :obj:`argparse.Namespace`
"""
parser = argparse.ArgumentParser(
description="Tool for storing eiffel events in a Mongo database."
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def wait_for_webserver_connection():
timeout = time.time() + 30
while time.time() < timeout:
try:
query_handler.execute("{nothing}")
query_handler.execute("{ __schema { description } }")
LOGGER.info("Up and running")
return
except HTTPError: # BadRequest means the webserver came up.
Expand Down
18 changes: 9 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
# and then run "tox" from this directory.

[tox]
envlist = py36,black,docs,pylint,pydocstyle
envlist = py311,black,docs,pylint,pydocstyle

[testenv]
deps =
pytest==7.0
pytest-cov==4.0.0
pytest==7.4.1
pytest-cov==4.1.0
mongomock==4.1.2
setenv = MONGODB_CONNSTRING = mongodb://localhost:27017
MONGODB_DATABASE = testing_eiffel_graphql_api
commands =
pytest -s --log-format="%(levelname)%: %(message)s" {posargs}
basepython = python3.6
pytest -s --log-format="%(levelname)s: %(message)s" {posargs}
basepython = python3.11.5

[testenv:black]
deps =
black==22.8.0
black==23.9.1
commands =
black --check --diff .

Expand All @@ -31,9 +31,9 @@ commands =

[testenv:pylint]
deps =
pylint==2.12.2
pytest==7.0
pytest-cov==4.0.0
pylint==2.17.5
pytest==7.4.1
pytest-cov==4.1.0
mongomock==4.1.2
commands =
pylint src/eiffel_graphql_api tests
Expand Down