Skip to content

Commit

Permalink
Dev (#48)
Browse files Browse the repository at this point in the history
- Code formatting
- Renamed Exceptions to match linter requirements
- Refactored some code
  • Loading branch information
niro1987 authored Nov 16, 2024
1 parent f1ca076 commit f97dfc4
Show file tree
Hide file tree
Showing 41 changed files with 3,837 additions and 1,565 deletions.
5 changes: 4 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ RUN pipx uninstall pydocstyle \
# Install Python dependencies from requirements
WORKDIR /usr/src
COPY . .
RUN pip install -r requirements.txt -r .devcontainer/requirements-dev.txt
RUN pip install -r requirements.txt
RUN pip install -r docs/requirements.txt
RUN pip install -r tests/requirements.txt
RUN pip install -r .devcontainer/requirements.txt
42 changes: 21 additions & 21 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,6 @@
},
"customizations": {
"vscode": {
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": false,
"python.testing.pytestArgs": ["--no-cov"],
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
}
},
"terminal.integrated.defaultProfile.linux": "zsh",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
}
},
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
Expand All @@ -38,9 +19,28 @@
"eamodio.gitlens",
"tamasfe.even-better-toml",
"github.vscode-github-actions"
]
],
"settings": {
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
},
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.testing.pytestArgs": ["--no-cov"],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": false,
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
}
}
}
}
},
"postCreateCommand": "git config --global --add safe.directory /workspaces/sapimclient && pre-commit install --install-hooks",
"postStartCommand": "pip install -e .[dev]"
"postStartCommand": "pip install -e ."
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
# Use this file to list development requirements for your project.

# build
setuptools>=61.0
setuptools_scm>=6.2
codespell==2.2.6
mypy==1.9.0

# cli
pandas-stubs>=2.2.2

# pre-commit
pre-commit==3.7.0
ruff==0.3.5
codespell==2.2.6
yamllint==1.35.1

# dev
pylint==3.1.0
mypy==1.9.0

# test
coverage==7.4.4
pytest==8.1.1
pytest-cov==5.0.0
pytest-asyncio==0.23.6
aioresponses>=0.7.6
python-dotenv==1.0.1

# cli
click==8.1.7
pandas==2.2.2
pandas-stubs>=2.2.2
ruff==0.3.5
# build
setuptools>=61.0
setuptools_scm>=6.2
yamllint==1.35.1
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ build/
.env
*.log
docs/html/
node_modules/
.coverage
*.http
.ruff_cache
.mypy_cache
50 changes: 36 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,60 @@
default_language_version:
python: python3.11
repos:
- repo: local
hooks:
- id: pytest
name: pytest
entry: pytest
language: system
types: [python]
pass_filenames: false
always_run: true
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
rev: v0.7.0
hooks:
- id: ruff
args:
- --fix
- id: ruff-format
files: ^((src|tests)/.+)?[^/]+\.py$
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
args:
- --ignore-words-list=perfors
- --skip="./.*,*.csv,*.json,*.txt,*.xml"
- --quiet-level=2
exclude_types: [csv, json, text, xml]
exclude: ^tests/fixtures/.*$
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
- id: yamllint
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-illegal-windows-names
- id: check-symlinks
- id: check-builtin-literals
- id: check-merge-conflict
- id: check-toml
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: mixed-line-ending
- id: name-tests-test
args:
Expand All @@ -40,11 +67,6 @@ repos:
- id: trailing-whitespace
- id: check-json
exclude: (.vscode|.devcontainer)
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
- id: yamllint
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
- id: check-xml
- id: check-toml
- id: check-yaml
45 changes: 22 additions & 23 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
"""Configuration file for the Sphinx documentation builder."""
# pylint: disable=all
from importlib.metadata import version as _version

from importlib.metadata import version as _version

# Project information
project = "sapimclient"
copyright = "2024, Niels Perfors"
author = "Niels Perfors"
project = 'sapimclient'
copyright = '2024, Niels Perfors'
author = 'Niels Perfors'
release = _version(project)
version = '.'.join(release.split('.')[:2])

# General configuration
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosectionlabel",
"sphinx.ext.autosummary",
"sphinx.ext.doctest",
"sphinx.ext.duration",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon", # https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html
"sphinx.ext.todo",
"sphinx.ext.viewcode",
'sphinx.ext.autodoc',
'sphinx.ext.autosectionlabel',
'sphinx.ext.autosummary',
'sphinx.ext.doctest',
'sphinx.ext.duration',
'sphinx.ext.intersphinx',
'sphinx.ext.napoleon', # https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html
'sphinx.ext.todo',
'sphinx.ext.viewcode',
]
templates_path = ["_templates"]
templates_path = ['_templates']
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
'python': ('https://docs.python.org/3/', None),
'sphinx': ('https://www.sphinx-doc.org/en/master/', None),
}
intersphinx_disabled_domains = ["std"]
intersphinx_disabled_domains = ['std']

# Extensions configuration
autosectionlabel_prefix_document = True
autodoc_class_signature = "separated"
autodoc_class_signature = 'separated'
autodoc_default_options = {
"exclude-members": "__init__, __new__",
"show-inheritance": True,
'exclude-members': '__init__, __new__',
'show-inheritance': True,
}
html_theme = "sphinx_rtd_theme"
epub_show_urls = "footnote"
html_theme = 'sphinx_rtd_theme'
epub_show_urls = 'footnote'
napoleon_google_docstring = True
napoleon_numpy_docstring = True
napoleon_include_init_with_doc = False
Expand Down
2 changes: 1 addition & 1 deletion docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ period ``January 2024`` on the ``Main Monthly Calendar``.
from aoihttp
from sapimclient import Tenant, model
from sapimclient.const import PipelineState, PipelineStatus
from sapimclient.model.base import Reference
from sapimclient.model import Reference
async def run_comp_and_pay(
client: Tenant,
Expand Down
Loading

0 comments on commit f97dfc4

Please sign in to comment.