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

Update CI tools and dependencies #24

Merged
merged 32 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a98dc83
Start adapting to [email protected]
glatterf42 Oct 3, 2023
35ab99a
Add some type hints
glatterf42 Oct 3, 2023
1913280
Address further [email protected] issues
glatterf42 Oct 4, 2023
81f9fe7
Start adapting api layer for [email protected]
glatterf42 Oct 4, 2023
542b3ef
remove Annotated type hint
meksor Oct 5, 2023
2e3c6b8
hopefully fix pydantic validator
meksor Oct 5, 2023
a9a1279
Let pydantic return a SchemaError instead of InconsistentIamcType
glatterf42 Oct 10, 2023
0e64dcc
Clean up accidental comment
glatterf42 Oct 10, 2023
f736024
Use pandera.DataFrameModel instead of pandera.SchemaModel
glatterf42 Oct 10, 2023
bf845f0
Clean up changes in API layer
glatterf42 Oct 10, 2023
3510253
Clean up changes in data/db to enable tests again
glatterf42 Oct 10, 2023
d024f96
Set field.alias only when it does not equal field.name
glatterf42 Oct 10, 2023
647dc54
Update version of ruff
glatterf42 Oct 10, 2023
72f1aea
Set field alias in Field directly
glatterf42 Oct 10, 2023
bec7440
Use httpx-preferred content to send bytes/raw content/json st
glatterf42 Oct 10, 2023
571b053
Use alias for model_ fields that conflict with pydantic protected nam…
glatterf42 Oct 10, 2023
a13a498
Use variable rather than unmapped class reference to resolve SAwarning
glatterf42 Oct 11, 2023
ba4c313
Delete unused import
glatterf42 Oct 11, 2023
e5df31c
Bump mypy and poetry versions
glatterf42 Oct 11, 2023
cfc29ae
Use pre-commit over lint-GHA
glatterf42 Oct 12, 2023
d89c162
Bump sphinx version
glatterf42 Oct 12, 2023
764cbec
Update docstrings according to new sphinx version
glatterf42 Oct 12, 2023
a0b35dc
Delete duplicate docs files
glatterf42 Oct 13, 2023
fb19369
TEMPORARY Use own fork for sphinxcontrib-openapi workaround
glatterf42 Oct 16, 2023
129e803
Bump dask,sqlalchemy,pre-commit versions
glatterf42 Oct 16, 2023
8de9433
restore filter framework api
meksor Oct 18, 2023
04b5df1
fix union types with filter subojects
meksor Oct 18, 2023
1b4be7e
fix code style
meksor Oct 18, 2023
0f0c1b0
fix formatting error
meksor Oct 18, 2023
274884a
Remove outdated comments
glatterf42 Oct 18, 2023
0f1ab0c
Update various things:
glatterf42 Oct 18, 2023
9c36ebc
Include pre-commit, ruff, etc in DEVELOPING.md
glatterf42 Oct 19, 2023
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
68 changes: 0 additions & 68 deletions .github/workflows/lint.yaml

This file was deleted.

44 changes: 43 additions & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
Expand Down Expand Up @@ -74,3 +73,46 @@ jobs:
run: |
source .venv/bin/activate
pytest --cov-report xml:.coverage.xml --cov-report term --cov=ixmp4 -rsx --benchmark-skip

pre-commit:
name: Code quality
runs-on: ubuntu-latest
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root --with dev,server
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
#----------------------------------------------
# run pre-commit/(mypy, black, ruff)
#----------------------------------------------
- uses: pre-commit/[email protected]
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
repos:
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
hooks:
- id: mypy
entry: bash -c "poetry run mypy ."
language: system
- repo: https://github.com/psf/black
rev: 23.10.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.0
hooks:
- id: ruff
1 change: 1 addition & 0 deletions doc/source/devs/ixmp4.core/iamc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ IAMC Data
:members:
:undoc-members:
:show-inheritance:
:noindex:


.. automodule:: ixmp4.core.iamc.repository
Expand Down
3 changes: 2 additions & 1 deletion doc/source/devs/ixmp4.core/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ Core API (ixmp4.core)

platform
run
model
scenario
iamc
meta
region
unit
exceptions

2 changes: 1 addition & 1 deletion doc/source/devs/ixmp4.core/scenario.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

Scenarios
=======
=========

.. toctree::
:maxdepth: 1
Expand Down
70 changes: 0 additions & 70 deletions doc/source/modules.rst

This file was deleted.

2 changes: 1 addition & 1 deletion doc/source/openapi-v1.json

Large diffs are not rendered by default.

82 changes: 0 additions & 82 deletions doc/source/tests.rst

This file was deleted.

2 changes: 1 addition & 1 deletion ixmp4/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def login(
),
):
try:
auth = ManagerAuth(username, password, settings.manager_url)
auth = ManagerAuth(username, password, str(settings.manager_url))
user = auth.get_user()
utils.good(f"Successfully authenticated as user '{user.username}'.")
if typer.confirm(
Expand Down
10 changes: 2 additions & 8 deletions ixmp4/cli/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,8 @@

@app.command()
def start(
host: Optional[str] = typer.Option(
"127.0.0.1",
help="The hostname to bind to.",
),
port: Optional[int] = typer.Option(
9000,
help="Requested server port.",
),
host: str = typer.Option(default="127.0.0.1", help="The hostname to bind to."),
port: int = typer.Option(default=9000, help="Requested server port."),
) -> None:
"""Starts the ixmp4 web api."""
reload = settings.mode != "production"
Expand Down
2 changes: 1 addition & 1 deletion ixmp4/conf/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def get_local_jwt(self):
"jti": self.jti,
"sub": "ixmp4",
"iss": "ixmp4",
"user": self.user.dict(),
"user": self.user.model_dump(),
},
self.secret,
algorithm="HS256",
Expand Down
4 changes: 2 additions & 2 deletions ixmp4/conf/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ManagerPlatformInfo(PlatformInfo):
access_group: int
url: str
name: str = Field(alias="slug")
notice: str | None
notice: str | None = Field(default=None)

class Accessibilty(str, enum.Enum):
PUBLIC = "PUBLIC"
Expand Down Expand Up @@ -101,7 +101,7 @@ def _request(
params = hashabledict(params)

if json is not None:
if type(json) is dict:
if isinstance(json, dict):
json = hashabledict(json)
else:
json = tuple(json)
Expand Down
Loading
Loading