Skip to content

Commit

Permalink
build: fix linting error
Browse files Browse the repository at this point in the history
  • Loading branch information
12rambau committed Dec 9, 2024
1 parent 4fe2cd7 commit 873e3d0
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 19 deletions.
7 changes: 4 additions & 3 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ author_email: pierrick.rambaud49@gmail.com
author_first_name: Pierrick
author_last_name: Rambaud
author_orcid: 0000-0001-8764-5749
creation_year: '2023'
creation_year: "2023"
github_repo_name: pygaul
github_user: gee-community
project_name: pyGAUL
project_slug: pygaul
short_description: Easy access to administrative boundary defined by FAO GAUL from
Python scripts
short_description:
Easy access to administrative boundary defined by FAO GAUL from
Python scripts
14 changes: 7 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "Python 3",
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
"features": {
"ghcr.io/devcontainers-contrib/features/nox:2": {},
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {}
},
"postCreateCommand": "python -m pip install commitizen uv && pre-commit install"
"name": "Python 3",
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
"features": {
"ghcr.io/devcontainers-contrib/features/nox:2": {},
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {}
},
"postCreateCommand": "python -m pip install commitizen uv && pre-commit install"
}
1 change: 0 additions & 1 deletion .github/workflows/pypackage_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,3 @@ jobs:
> You may need to reinstall ``copier`` and ``jinja2-time`` if they are not available in your environment.
After solving the merging issues you can push back the changes to your main branch.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,3 @@ repos:
- id: check-merge-conflict
stages: [pre-commit]
args: [--assume-in-merge]

4 changes: 2 additions & 2 deletions docs/_static/custom-icon.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
The nox run are build in isolated environment that will be stored in .nox. to force the venv update, remove the .nox/xxx folder.
"""

import datetime
import fileinput

import nox

nox.options.sessions = ["lint", "test", "docs", "mypy"]


@nox.session(reuse_venv=True, venv_backend="uv")
def lint(session):
"""Apply the pre-commits."""
Expand All @@ -23,6 +25,7 @@ def test(session):
test_files = session.posargs or ["tests"]
session.run("pytest", "--cov", "--cov-report=html", *test_files)


@nox.session(reuse_venv=True, name="ci-test", venv_backend="uv")
def ci_test(session):
"""Run all the test and report coverage in xml."""
Expand Down
2 changes: 1 addition & 1 deletion pygaul/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import ee
import numpy as np
import pandas as pd
from deprecated.sphinx import deprecated, versionadded
from deprecated.sphinx import deprecated, versionadded # type: ignore [import-untyped]

__version__ = "0.3.4"
__author__ = "Pierrick Rambaud"
Expand Down
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,21 @@ testpaths = "tests"

[tool.ruff]
line-length = 100
ignore-init-module-imports = true
fix = true


[tool.ruff.lint]
select = ["E", "F", "W", "I", "D", "RUF"]
ignore = [
"E501", # line too long | Black take care of it
"D212", # Multi-line docstring | We use D213
"D101", # Missing docstring in public class | We use D106
]

[tool.ruff.flake8-quotes]
[tool.ruff.lint.flake8-quotes]
docstring-quotes = "double"

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.coverage.run]
Expand Down
1 change: 0 additions & 1 deletion tests/check_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def check_warnings(file: Path) -> int:


if __name__ == "__main__":

# cast the file to path and resolve to an absolute one
file = Path.cwd() / "warnings.txt"

Expand Down
109 changes: 109 additions & 0 deletions warnings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@

Traceback (most recent call last):
File "/home/rambap/github/pygaul/.nox/docs/lib/python3.12/site-packages/sphinx/cmd/build.py", line 285, in build_main
app.build(args.force_all, args.filenames)
File "/home/rambap/github/pygaul/.nox/docs/lib/python3.12/site-packages/sphinx/application.py", line 353, in build
self.builder.build_update()
File "/home/rambap/github/pygaul/.nox/docs/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 311, in build_update
self.build(to_build,
File "/home/rambap/github/pygaul/.nox/docs/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 328, in build
updated_docnames = set(self.read())
^^^^^^^^^^^
File "/home/rambap/github/pygaul/.nox/docs/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 435, in read
self._read_serial(docnames)
File "/home/rambap/github/pygaul/.nox/docs/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 456, in _read_serial
self.read_doc(docname)
File "/home/rambap/github/pygaul/.nox/docs/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 512, in read_doc
publisher.publish()
File "/home/rambap/github/pygaul/.nox/docs/lib/python3.12/site-packages/docutils/core.py", line 226, in publish
self.apply_transforms()
File "/home/rambap/github/pygaul/.nox/docs/lib/python3.12/site-packages/docutils/core.py", line 206, in apply_transforms
self.document.transformer.apply_transforms()
File "/home/rambap/github/pygaul/.nox/docs/lib/python3.12/site-packages/sphinx/transforms/__init__.py", line 79, in apply_transforms
super().apply_transforms()
File "/home/rambap/github/pygaul/.nox/docs/lib/python3.12/site-packages/docutils/transforms/__init__.py", line 173, in apply_transforms
transform.apply(**kwargs)
File "/home/rambap/github/pygaul/.nox/docs/lib/python3.12/site-packages/jupyter_sphinx/execute.py", line 170, in apply
raise ExtensionError(
sphinx.errors.ExtensionError: Cell raised uncaught exception:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 2
 1 import pygaul
----> 2 from geemap import Map
 3 import ee
 5 ee.Initialize()

File ~/github/pygaul/.nox/docs/lib/python3.12/site-packages/geemap/__init__.py:55
 51 else:
 52 print(
 53 "Please restart Jupyter kernel after installation if you encounter any errors when importing geemap."
 54 )
---> 55 raise e
 57 if _use_eerepr():
 58 import eerepr

File ~/github/pygaul/.nox/docs/lib/python3.12/site-packages/geemap/__init__.py:45
 43 else:
 44 try:
---> 45 from .geemap import *
 46 except Exception as e:
 47 if in_colab_shell():

File ~/github/pygaul/.nox/docs/lib/python3.12/site-packages/geemap/geemap.py:28
 26 from .basemaps import get_xyz_dict, xyz_to_leaflet
 27 from .common import *
---> 28 from .conversion import *
 29 from .ee_tile_layers import *
 30 from . import core

File ~/github/pygaul/.nox/docs/lib/python3.12/site-packages/geemap/conversion.py:23
 20 from collections import deque
 21 from pathlib import Path
---> 23 import pkg_resources
 25 from .common import *
 28 def find_matching_bracket(lines, start_line_index, start_char_index, matching_char="{"):

ModuleNotFoundError: No module named 'pkg_resources'

Extension error:
Cell raised uncaught exception:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 2
 1 import pygaul
----> 2 from geemap import Map
 3 import ee
 5 ee.Initialize()

File ~/github/pygaul/.nox/docs/lib/python3.12/site-packages/geemap/__init__.py:55
 51 else:
 52 print(
 53 "Please restart Jupyter kernel after installation if you encounter any errors when importing geemap."
 54 )
---> 55 raise e
 57 if _use_eerepr():
 58 import eerepr

File ~/github/pygaul/.nox/docs/lib/python3.12/site-packages/geemap/__init__.py:45
 43 else:
 44 try:
---> 45 from .geemap import *
 46 except Exception as e:
 47 if in_colab_shell():

File ~/github/pygaul/.nox/docs/lib/python3.12/site-packages/geemap/geemap.py:28
 26 from .basemaps import get_xyz_dict, xyz_to_leaflet
 27 from .common import *
---> 28 from .conversion import *
 29 from .ee_tile_layers import *
 30 from . import core

File ~/github/pygaul/.nox/docs/lib/python3.12/site-packages/geemap/conversion.py:23
 20 from collections import deque
 21 from pathlib import Path
---> 23 import pkg_resources
 25 from .common import *
 28 def find_matching_bracket(lines, start_line_index, start_char_index, matching_char="{"):

ModuleNotFoundError: No module named 'pkg_resources'

0 comments on commit 873e3d0

Please sign in to comment.