Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into test/use-fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
mbelak-dtml committed Mar 8, 2024
2 parents df83c07 + eb78c67 commit e4a549f
Show file tree
Hide file tree
Showing 16 changed files with 239 additions and 122 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish
on: workflow_dispatch

env:
POETRY_VERSION: 1.7.1
POETRY_VERSION: 1.8.2
CONVCO_VERSION: v0.4.2
GITCLIFF_VERSION: 2.0.4
CHANGELOG_FILE: CHANGELOG.md
Expand All @@ -26,7 +26,7 @@ jobs:
outputs:
new_version: ${{ steps.set-vars.outputs.new_version }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install poetry
Expand Down Expand Up @@ -87,13 +87,13 @@ jobs:
runs-on: ubuntu-22.04
needs: publish-python
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install poetry
run: curl -sSL https://install.python-poetry.org | python3 - --version ${{ env.POETRY_VERSION }}
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: .venv/
key: ${{ runner.os }}-python-3.11-poetry-${{ hashFiles('pyproject.toml') }}
Expand All @@ -108,7 +108,7 @@ jobs:
poetry run sphinx-apidoc -o docs/source/ edvart
poetry run make -C docs html
- name: Upload HTML
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: html
path: docs/build/html
Expand All @@ -126,15 +126,15 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Setup Pages
uses: actions/configure-pages@v3
- uses: actions/download-artifact@v3
uses: actions/configure-pages@v4
- uses: actions/download-artifact@v4
with:
name: html
path: docs/build/html
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
path: docs/build/html
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4
17 changes: 8 additions & 9 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
branches: [main]

env:
POETRY_VERSION: 1.7.1
POETRY_VERSION: 1.8.2
CONVCO_VERSION: v0.4.2

jobs:
Expand All @@ -21,16 +21,16 @@ jobs:
matrix:
# Test against all supported Python minor versions
# Specified only minor version: the latest patch is used
python-version: ['3.11', '3.10', '3.9', '3.8']
python-version: ['3.12', '3.11', '3.10', '3.9']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: curl -sSL https://install.python-poetry.org | python3 - --version ${{ env.POETRY_VERSION }}
- id: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .venv/
key: ${{ runner.os }}-python-${{ matrix.python-version }}-poetry-${{ hashFiles('pyproject.toml') }}
Expand All @@ -45,9 +45,8 @@ jobs:
poetry run python -m pytest -n auto --disable-warnings --cov=edvart tests/
- name: Lint
run: |
poetry run pylint --rcfile=.pylintrc edvart/
poetry run black --check --line-length 100 edvart/ tests/
poetry run isort --check --line-length 100 --profile black edvart/ tests/
poetry run ruff check .
poetry run ruff format --check .
dismiss-stale-reviews:
runs-on: ubuntu-22.04
Expand All @@ -64,7 +63,7 @@ jobs:
commit-check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # actions/checkout checks out HEAD only by default
- name: Get convco
Expand Down
32 changes: 11 additions & 21 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,30 +85,20 @@ If you add a new section, add the section description into `docs/sections.rst`

## Code style

* The line length is limited to 100 characters in Python code, except if it would make the code less readable.
* `black` is used for formatting Python code. The following command can be used to properly format the code:
* The line length is limited to 100 characters in Python code,
except if it would make the code less readable.
* `ruff` is used for formatting and linting Python code.
The following commands can be used to properly format the code and check
for linting errors with automatic fixing:
```bash
poetry run black --line-length 100 edvart/ tests/
poetry run ruff format .
poetry run ruff check . --fix
```
The following command can be used to check if the code is properly formatted:
The following command can be used to check if the code is properly
formatted and check for linting errors:
```bash
poetry run black --check --line-length 100 edvart/ tests/
````

* `isort` is used for sorting imports.
The following command can be used to properly sort imports:
```bash
poetry run isort --line-length 100 --profile black edvart/ tests/
```
The following command can be used to check if the imports are properly sorted:
```bash
poetry run isort --check --line-length 100 --profile black edvart/ tests/
```

* `pylint` is used to lint Python code. Tests are not required to be linted.
The following command can be used to lint the code:
```bash
poetry run pylint --rcfile=".pylintrc" edvart
poetry run ruff format --check .
poetry run ruff check .
```

All of the above code style requirements are enforced by the CI pipeline.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@
<a href="https://pypi.org/project/edvart">
<img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/edvart.svg?label=PyPI%20downloads">
</a>
<a href="https://github.com/psf/black">
<img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg">
<a href="https://github.com/astral-sh/ruff">
<img alt="Ruff", src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json">
</a>
<a href="https://pycqa.github.io/isort/">
<img alt="Imports: isort" src="https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat">
</a>

</p>

Edvart is an open-source Python library designed to simplify and streamline
Expand Down
80 changes: 42 additions & 38 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,27 @@
#
import os
import sys
import re
from datetime import datetime
from pathlib import Path

sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../'))
import toml # make sure that toml is a developer dependency

# -- Project information -----------------------------------------------------
sys.path.insert(0, os.path.abspath("."))
sys.path.insert(0, os.path.abspath("../"))

project = 'edvart'
copyright = f'{datetime.now().year}, Datamole'
author = 'Hellen team'
# -- Project information -----------------------------------------------------

project = "edvart"
copyright = f"{datetime.now().year}, Datamole"
author = "Hellen team"

import toml # make sure that toml is a developer dependency

metadata = toml.load(Path(__file__).parent.parent / "pyproject.toml")["tool"]["poetry"]
version = release = metadata["version"]

version_long = version
# The short X.Y.Z version
version = '.'.join(version_long.split('.')[0:3])
version = ".".join(version_long.split(".")[0:3])
# The full version, including alpha/beta/rc tags
release = version_long

Expand All @@ -51,29 +50,29 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx_copybutton',
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.mathjax",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
"sphinx_copybutton",
]

# napoleon_google_docstring = False
# napoleon_use_param = False
# napoleon_use_ivar = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -85,20 +84,20 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
#html_theme = 'alabaster'
#html_theme = 'sphinx_rtd_theme'
html_theme = 'sphinx_rtd_theme'
# html_theme = 'alabaster'
# html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand All @@ -109,7 +108,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand All @@ -125,7 +124,7 @@
# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'edvartdoc'
htmlhelp_basename = "edvartdoc"


# -- Options for LaTeX output ------------------------------------------------
Expand All @@ -134,15 +133,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -152,19 +148,21 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'edvart.tex', 'edvart Documentation',
'Your name (or your organization/company/team)', 'manual'),
(
master_doc,
"edvart.tex",
"edvart Documentation",
"Your name (or your organization/company/team)",
"manual",
),
]


# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'edvart', 'edvart Documentation',
[author], 1)
]
man_pages = [(master_doc, "edvart", "edvart Documentation", [author], 1)]


# -- Options for Texinfo output ----------------------------------------------
Expand All @@ -173,9 +171,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'edvart', 'edvart Documentation',
author, 'edvart', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"edvart",
"edvart Documentation",
author,
"edvart",
"One line description of project.",
"Miscellaneous",
),
]


Expand All @@ -184,4 +188,4 @@
# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
intersphinx_mapping = {"https://docs.python.org/": None}
2 changes: 1 addition & 1 deletion edvart/data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pandas as pd

try:
import pyarrow # pylint: disable=unused-import
import pyarrow # noqa: F401
except ImportError:
PYARROW_PANDAS_BACKEND_AVAILABLE = False
else:
Expand Down
Loading

0 comments on commit e4a549f

Please sign in to comment.