Skip to content

Commit

Permalink
Adopt ruff and pre-commit for linting and formatting (#139)
Browse files Browse the repository at this point in the history
* linting and formatting with ruff

* configure pre-commit

* ignore notebooks

* pin jupyterlab

* rename step

* bump jupyter-bokeh

* bump codeql
  • Loading branch information
lmmentel authored Mar 23, 2024
1 parent b053a90 commit cac4b7b
Show file tree
Hide file tree
Showing 42 changed files with 1,657 additions and 4,546 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ jobs:
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
13 changes: 4 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,13 @@ jobs:
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.7.1
version: 1.8.2
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install dependencies
run: poetry install --with vis --no-interaction
- name: Lint with flake8
run: |
source $VENV
# stop the build if there are Python syntax errors or undefined names
flake8 mendeleev --count --select=E9,F63,F7,F82 --max-line-length=127 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
black --check mendeleev
run: poetry install --with vis --no-interaction -v
- name: Lint and format with ruff
uses: pre-commit/[email protected]
- name: Test with pytest
run: |
source $VENV
Expand Down
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
exclude: "^(alembic|notebooks)/"
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.3
hooks:
# Run the linter.
- id: ruff
types_or: [python, pyi, jupyter]
# Run the formatter.
- id: ruff-format
types_or: [python, pyi, jupyter]
29 changes: 29 additions & 0 deletions docs/source/api/mendeleev.cli.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
mendeleev.cli
=============

.. automodule:: mendeleev.cli







.. rubric:: Functions

.. autosummary::

clielement













31 changes: 31 additions & 0 deletions docs/source/api/mendeleev.db.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
mendeleev.db
============

.. automodule:: mendeleev.db







.. rubric:: Functions

.. autosummary::

get_engine
get_package_dbpath
get_session













40 changes: 40 additions & 0 deletions docs/source/api/mendeleev.econf.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
mendeleev.econf
===============

.. automodule:: mendeleev.econf







.. rubric:: Functions

.. autosummary::

get_l
get_spin_strings
print_spin_occupations
shell_capactity
subshell_capacity
subshell_degeneracy





.. rubric:: Classes

.. autosummary::

ElectronicConfiguration









37 changes: 37 additions & 0 deletions docs/source/api/mendeleev.electronegativity.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
mendeleev.electronegativity
===========================

.. automodule:: mendeleev.electronegativity







.. rubric:: Functions

.. autosummary::

allred_rochow
cottrell_sutton
generic
gordy
li_xue
martynov_batsanov
mulliken
nagle
sanderson













36 changes: 36 additions & 0 deletions docs/source/api/mendeleev.fetch.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
mendeleev.fetch
===============

.. automodule:: mendeleev.fetch







.. rubric:: Functions

.. autosummary::

add_plot_columns
fetch_electronegativities
fetch_ionic_radii
fetch_ionization_energies
fetch_neutral_data
fetch_table
get_app_data
get_zeff













29 changes: 29 additions & 0 deletions docs/source/api/mendeleev.ion.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
mendeleev.ion
=============

.. automodule:: mendeleev.ion











.. rubric:: Classes

.. autosummary::

Ion









33 changes: 33 additions & 0 deletions docs/source/api/mendeleev.mendeleev.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
mendeleev.mendeleev
===================

.. automodule:: mendeleev.mendeleev







.. rubric:: Functions

.. autosummary::

deltaN
element
get_all_elements
ids_to_attr
isotope













46 changes: 46 additions & 0 deletions docs/source/api/mendeleev.models.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
mendeleev.models
================

.. automodule:: mendeleev.models







.. rubric:: Functions

.. autosummary::

estimate_from_group
fetch_attrs_for_group
with_uncertainty





.. rubric:: Classes

.. autosummary::

Element
Group
IonicRadius
IonizationEnergy
Isotope
IsotopeDecayMode
OxidationState
PhaseTransition
ScreeningConstant
Series









30 changes: 30 additions & 0 deletions docs/source/api/mendeleev.utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
mendeleev.utils
===============

.. automodule:: mendeleev.utils







.. rubric:: Functions

.. autosummary::

coeffs
n_effective













Loading

0 comments on commit cac4b7b

Please sign in to comment.