Skip to content

Commit

Permalink
Drop Python 3.7, tinker with devopsy stuff
Browse files Browse the repository at this point in the history
Too much stuff to list here..

Partial changes:
- Relax a bunch of overly-zealous linter args
- Ignore missing AssertionError in docstrings
- Lock down bandit (see: tylerwince/flake8-bandit#21)
- Disable strict optional
- Ignore missing stubs from third-party libraries pandas,tqdm,sqlalchemy
- Update lockfile
- Remove unused module
- Basic logging configuration (null handler)
- Use Poetry 1.2.0.a2 for builds

Notebooks:
- Add formatting of notebooks
- Add run-jupyter.sh convenience script (nosec)
- Add PerfTestTemplate.ipynb
  • Loading branch information
rsundqvist committed Mar 11, 2022
1 parent f1d3197 commit d3c707a
Show file tree
Hide file tree
Showing 32 changed files with 2,325 additions and 206 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ current_version = 0.1.0
search = version = "{current_version}"
replace = version = "{new_version}"

[bumpversion:file:src/rics/__init__.py]
[bumpversion:file:src/rics/__version__.py]
search = __version__ = "{current_version}"
replace = __version__ = "{new_version}"

Expand Down
29 changes: 29 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[paths]
source = src

[report]
omit =
tests/*
src/rics/translation/fetching/*
src/rics/translation/dio/*
src/rics/_internal*
*/exceptions.py

fail_under = 99

exclude_lines =
pragma: no cover
def __repr__
if self.debug
if settings.DEBUG:
raise AssertionError
raise NotImplementedError
if 0:
if __name__ == __main__:
LOGGER.isEnabledFor
if not isinstance\(other

show_missing = true

[html]
directory = htmlcov
1 change: 1 addition & 0 deletions .darglint
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[darglint]
strictness = short
ignore_raise=AssertionError
4 changes: 2 additions & 2 deletions .github/workflows/pre-commit-autoupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
steps:
- uses: actions/checkout@v2.3.4

- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v2.3.2
with:
python-version: 3.7
python-version: 3.8

- name: Install pre-commit
run: pip install pre-commit
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ jobs:
steps:
- uses: actions/checkout@v2.3.4

- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v2.3.2
with:
python-version: 3.7
python-version: 3.8

- name: Install system deps
shell: bash
run: |
pip install poetry
poetry config virtualenvs.in-project true
pip install poetry==1.2.0a2
- name: Build package
run: |
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: tests
on:
push:
branches:
- master
pull_request:
branches:

Expand All @@ -13,10 +14,10 @@ jobs:
steps:
- uses: actions/checkout@v2.3.4

- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v2.3.2
with:
python-version: 3.7
python-version: 3.8

- name: Linting
run: |
Expand All @@ -30,7 +31,7 @@ jobs:
strategy:
matrix:
os: [ Ubuntu, MacOS, Windows ]
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
python-version: [ '3.8', '3.9', '3.10' ]
fail-fast: true
steps:
- uses: actions/checkout@v2.3.4
Expand All @@ -44,8 +45,7 @@ jobs:
shell: bash
run: |
pip install nox
pip install poetry
poetry config virtualenvs.in-project true
pip install poetry==1.2.0a2
- name: Run mypy with nox
shell: bash
Expand All @@ -72,17 +72,16 @@ jobs:
steps:
- uses: actions/checkout@v2.3.4

- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v2.3.2
with:
python-version: 3.7
python-version: 3.8

- name: Install system deps
shell: bash
run: |
pip install nox
pip install poetry
poetry config virtualenvs.in-project true
pip install poetry==1.2.0a2
- name: Download coverage data
uses: actions/download-artifact@v2.1.0
Expand Down
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
codecov

# Data
*.pkl
*.gz
*.zip
*.csv
jupyterlab/data-cache/*

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
8 changes: 4 additions & 4 deletions .idea/runConfigurations/run_all_tests.xml

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

6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ repos:
'flake8-bugbear~=21.9.2',
'flake8-annotations~=2.6.2',
'flake8-docstrings~=1.6.0',
'flake8-bandit~=2.1.2',
'darglint~=1.8.0'
'flake8-bandit==2.1.2',
'flake8-bandit==2.1.2',
'bandit==1.7.2',
'darglint~=1.8.0',
]
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sphinx:
configuration: docs/conf.py

python:
version: 3.7
version: 3.8
install:
- requirements: docs/requirements.txt
- method: pip
Expand Down
7 changes: 7 additions & 0 deletions .venv/!PLACEHOLDER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Placeholder

Ensure that venv is installed locally. If Poetry doesn't respect this, run:

```bash
poetry config virtualenvs.in-project true
```
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- The `rics.utils` module for various common operations
- The `rics.translation` package for translating IDs into human-readable labels
- The `rics.mapping` package for linking elements in multiple directions
- The `rics.cardinality` package; enum types for `1:1`, `1:N`, `N:1`, and `M:N`


## [0.1.0] - 2022-02-24
### Added
- First release on PyPI.
Expand Down
56 changes: 47 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

# Rics

# Readme

<div align="center">

Expand All @@ -20,23 +18,63 @@

My personal little ML engineering library.


* GitHub repo: <https://github.com/rsundqvist/rics.git>
* Documentation: <https://rics.readthedocs.io>
* Free software: MIT


## Features

* TODO

## Quickstart

TODO
## Quickstart for development

### Notice
This project uses groups for extras dependencies, which is currently a **PRERELEASE** feature (slated for `1.2`). Assuming
poetry was installed the recommended way (see below), this can be done using:
```bash
curl -sSL https://install.python-poetry.org/ | python -
poetry self update --preview 1.2.0a2
```

### Setting up for local development
Assumes a "modern" version of Ubuntu (guide written under `Ubuntu 20.04.2 LTS`) with basic dev dependencies installed.
To get started, run the following commands:

Installing the latest version of Poetry
```bash
curl -sSL https://install.python-poetry.org/ | python -
```
This is the way recommended by the Poetry project.

```bash
git clone git@github.com:rsundqvist/rics.git
cd rics
poetry install
inv install-hooks
```
This project uses groups for extras dependencies. If installation fails, make sure that output from
`poetry --version` is `1.2.0` or greater.

### Registering the project on Codecov

Probably only for forking?
```bash
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
```

Visit https://app.codecov.io and log in, follow instructions to link the repo and get a token for private repos.
```bash
CODECOV_TOKEN="<from-the-website>"
inv coverage --fmt=xml
./codecov -t ${CODECOV_TOKEN}
```

## Credits

This package was created with [Cookiecutter][cookiecutter] and the [fedejaure/cookiecutter-modern-pypackage][cookiecutter-modern-pypackage] project template.
This package was created with [Cookiecutter][cookiecutter] and
the [fedejaure/cookiecutter-modern-pypackage][cookiecutter-modern-pypackage] project template.

[cookiecutter]: https://github.com/cookiecutter/cookiecutter

[cookiecutter-modern-pypackage]: https://github.com/fedejaure/cookiecutter-modern-pypackage
51 changes: 40 additions & 11 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
#
import rics

# -- Project information -----------------------------------------------------
# -- Project information -------------------------------------------------------

# General information about the project.
project = "rics"
copyright = "2022, Richard Sundqvist" # noqa: A001
author = "Richard Sundqvist"
project = rics.__title__
copyright = rics.__copyright__ # noqa: A001
author = rics.__author__
# The version info for the project you're documenting, acts as replacement
# for |version| and |release|, also used in various other places throughout
# the built documents.
Expand All @@ -28,7 +28,7 @@
# The full version, including alpha/beta/rc tags.
release = rics.__version__

# -- General configuration ---------------------------------------------------
# -- General configuration -----------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
Expand All @@ -37,6 +37,7 @@
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
"sphinx.ext.intersphinx",
"recommonmark",
]

Expand All @@ -48,25 +49,53 @@
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# -- Options for HTML output -------------------------------------------------
# -- 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"

# 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
# documentation.
html_theme_options = {
"display_version": True,
}

# Used py sphinx_rtd_theme
html_context = {
"github_user": "rsundqvist",
"github_repo": "rics",
"github_banner": True,
"show_related": False,
"fixed_sidebar": True,
"display_github": True, # Integrate GitHub
"github_version": "master", # Version
"conf_py_path": "/docs/", # Path in the checkout to the docs root
}

# 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"]

# -- Nitpicky configuration ----------------------------------------------------
nitpicky = True
nitpick_ignore = [("py:class", "re.Pattern")]
nitpick_ignore_regex = []
with open("nitpick-regex-exceptions") as f:
for line in map(str.rstrip, filter(lambda l: l.strip(), f.readlines())):
if line.startswith("#"):
continue
nitpick_ignore_regex.append(("py:.*", "rics.*" + line))

# -- Autodoc configuration -----------------------------------------------------
autodoc_typehints = "signature"
autodoc_default_options = {
"members": True,
"undoc-members": True,
"member-order": "bysource",
}

# -- Intersphinx configuration -------------------------------------------------
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"pandas": ("http://pandas.pydata.org/pandas-docs/stable/", None),
}
19 changes: 19 additions & 0 deletions docs/nitpick-regex-exceptions
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Regex exceptions for nitpick. There's an issue for any and all generics
# and typevars of which there are a lot.

\.types\..*

# Online translation
_fetch_instruction\.FetchInstruction
_resolve\.DefaultTranslatable
_ids_to_fetch\.IdsToFetch

# Offline translation
_placeholder_overrides\.T
online\.PlaceholderOverrides

# Mapping
mapping\.BidirectionalMapping
_directional_mapping\.(HL|HR)
score_functions\.H
_mapper\.(ValueType|CandidateType)
Loading

0 comments on commit d3c707a

Please sign in to comment.