Skip to content
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

⬆️(project) upgrade python dependencies #179

Merged
merged 4 commits into from
Apr 24, 2022
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
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,13 @@ jobs:
password: $DOCKER_HUB_PASSWORD
environment:
RALPH_APP_DIR: ~/fun/.ralph
- image: elasticsearch:7.10.1
- image: elasticsearch:8.1.0
auth:
username: $DOCKER_HUB_USER
password: $DOCKER_HUB_PASSWORD
environment:
discovery.type: single-node
xpack.security.enabled: "false"
working_directory: ~/fun
steps:
- checkout
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ and this project adheres to

## [Unreleased]

### Changed

- Upgrade `click` to `8.0.4`
- Upgrade `elasticsearch` to `8.1.0`
- Upgrade `fastapi` to `0.75.0`
- Upgrade `python-swiftclient` to `3.13.1`

## [2.1.0] - 2022-04-13

### Added
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ services:

# -- backends
elasticsearch:
image: elasticsearch:7.16.3
image: elasticsearch:8.1.0
environment:
discovery.type: single-node
xpack.security.enabled: "false"
ports:
- "9200:9200"
mem_limit: 2g
Expand Down
24 changes: 12 additions & 12 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ classifiers =
include_package_data = True
install_requires =
bcrypt==3.2.0
click==8.0.3
click==8.0.4
click-option-group==0.5.3
elasticsearch==7.17.0
fastapi==0.73.0
elasticsearch==8.1.0
fastapi==0.75.0
gunicorn==20.1.0
Jinja2==3.0.3
ovh==0.5.0
pydantic==1.9.0
pyparsing==3.0.7
python-keystoneclient==4.4.0
python-swiftclient==3.13.0
python-swiftclient==3.13.1
pyyaml==6.0
requests==2.27.1
sentry_sdk==1.5.5
Expand All @@ -49,24 +49,24 @@ python_requires = >= 3.9

[options.extras_require]
dev =
bandit==1.7.2
bandit==1.7.4
black==22.1.0
factory-boy==3.2.1
Faker==12.3.0
Faker==13.3.2
flake8==4.0.1
hypothesis==6.36.2
hypothesis==6.39.3
ipdb==0.13.9
ipython==8.0.1
ipython==8.1.1
isort==5.10.1
logging-gelf==0.0.26
memory-profiler==0.60.0
mkdocs==1.2.3
mkdocs-click==0.5.0
mkdocs-material==8.1.11
mkdocstrings==0.18.0
pyfakefs==4.5.4
mkdocs-material==8.2.5
mkdocstrings==0.18.1
pyfakefs==4.5.5
pylint==2.12.2
pytest==7.0.1
pytest==7.1.0
pytest-cov==3.0.0
ci =
twine==3.8.0
Expand Down
2 changes: 1 addition & 1 deletion src/ralph/backends/storage/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def read(self, name, chunk_size=4096):

logger.debug("Getting archive: %s", name)

with self._get_filepath(name).open("rb", encoding=LOCALE_ENCODING) as file:
with self._get_filepath(name).open("rb") as file:
while chunk := file.read(chunk_size):
sys.stdout.buffer.write(chunk)

Expand Down
2 changes: 1 addition & 1 deletion src/ralph/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def load_config(config_file_path):
SWIFT_OS_IDENTITY_API_VERSION = config("RALPH_SWIFT_OS_IDENTITY_API_VERSION", "3")
SWIFT_OS_PROJECT_DOMAIN_NAME = config("RALPH_SWIFT_OS_PROJECT_DOMAIN_NAME", "Default")
SWIFT_OS_USER_DOMAIN_NAME = config("RALPH_SWIFT_OS_USER_DOMAIN_NAME", "Default")
ES_HOSTS = config("RALPH_ES_HOSTS", "localhost:9200").split(",")
ES_HOSTS = config("RALPH_ES_HOSTS", "http://localhost:9200").split(",")
ES_MAX_SEARCH_HITS_COUNT = config("RALPH_ES_MAX_SEARCH_HITS_COUNT", 100)
ES_POINT_IN_TIME_KEEP_ALIVE = config("RALPH_ES_POINT_IN_TIME_KEEP_ALIVE", "1m")
CONVERTER_EDX_XAPI_UUID_NAMESPACE = config(
Expand Down
2 changes: 1 addition & 1 deletion tests/api/test_statements_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def teardown_es_index():
Clean up Elasticsearch after each test.
"""
yield
ES_INDICES_CLIENT.delete(ES_TEST_INDEX)
ES_INDICES_CLIENT.delete(index=ES_TEST_INDEX)


# pylint: disable=invalid-name
Expand Down
5 changes: 2 additions & 3 deletions tests/backends/database/test_es.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ def test_backends_database_es_client_kwargs(es):
client_options={"ca_certs": "/path/to/ca/bundle"},
)

assert "ca_certs" in database.client.transport.kwargs
assert database.client.transport.kwargs.get("ca_certs") == "/path/to/ca/bundle"
assert (
database.client.transport.get_connection().pool.ca_certs == "/path/to/ca/bundle"
database.client.transport.node_pool.get().config.ca_certs
== "/path/to/ca/bundle"
)


Expand Down
4 changes: 2 additions & 2 deletions tests/backends/storage/test_ldp.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import requests

from ralph.backends.storage.ldp import LDPStorage
from ralph.defaults import APP_DIR, HISTORY_FILE, LOCALE_ENCODING
from ralph.defaults import APP_DIR, HISTORY_FILE
from ralph.exceptions import BackendParameterException


Expand Down Expand Up @@ -382,7 +382,7 @@ def iter_content(self, chunk_size):
"""Fakes content file iteration."""
# pylint: disable=no-self-use

with archive_path.open("rb", encoding=LOCALE_ENCODING) as archive:
with archive_path.open("rb") as archive:
while chunk := archive.read(chunk_size):
yield chunk

Expand Down
51 changes: 27 additions & 24 deletions tests/fixtures/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,37 +67,40 @@ def es_data_stream():
client = Elasticsearch(ES_TEST_HOSTS)

# Create statements index template with enabled data stream
index_template = {
"index_patterns": [ES_TEST_INDEX_PATTERN],
"data_stream": {},
"template": {
"mappings": {
"dynamic": True,
"dynamic_date_formats": [
"strict_date_optional_time",
"yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z",
],
"dynamic_templates": [],
"date_detection": True,
"numeric_detection": True,
},
"settings": {
"index": {
"number_of_shards": "1",
"number_of_replicas": "1",
}
},
index_patterns = [ES_TEST_INDEX_PATTERN]
data_stream = {}
template = {
"mappings": {
"dynamic": True,
"dynamic_date_formats": [
"strict_date_optional_time",
"yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z",
],
"dynamic_templates": [],
"date_detection": True,
"numeric_detection": True,
},
"settings": {
"index": {
"number_of_shards": "1",
"number_of_replicas": "1",
}
},
}
client.indices.put_index_template(name=ES_TEST_INDEX_TEMPLATE, body=index_template)
client.indices.put_index_template(
name=ES_TEST_INDEX_TEMPLATE,
index_patterns=index_patterns,
data_stream=data_stream,
template=template,
)

# Create a datastream matching the index template
client.indices.create_data_stream(ES_TEST_INDEX)
client.indices.create_data_stream(name=ES_TEST_INDEX)

yield client

client.indices.delete_data_stream(ES_TEST_INDEX)
client.indices.delete_index_template(ES_TEST_INDEX_TEMPLATE)
client.indices.delete_data_stream(name=ES_TEST_INDEX)
client.indices.delete_index_template(name=ES_TEST_INDEX_TEMPLATE)


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_parsers_gelfparser_parse_gzipped_file(fs, gelf_logger):
# Compress the log file
log_file_name = gelf_logger.handlers[0].stream.name
gzipped_log_file_name = f"{log_file_name}.gz"
with open(log_file_name, "rb", encoding=LOCALE_ENCODING) as log_file:
with open(log_file_name, "rb") as log_file:
with gzip.open(gzipped_log_file_name, "wb") as gzipped_log_file:
shutil.copyfileobj(log_file, gzipped_log_file)

Expand Down