Skip to content

Commit

Permalink
added py-pkg files and updated age_split to have innit
Browse files Browse the repository at this point in the history
py-pkg files are not edited for pyDisagg yet
  • Loading branch information
saalUW committed Apr 18, 2024
1 parent 50e1cb6 commit 14ce469
Show file tree
Hide file tree
Showing 28 changed files with 707 additions and 105 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Lint

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install Ruff
run: pip install ruff

- name: Lint with Ruff
run: |
ruff check .
ruff fix .
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'Automatically fix Ruff issues'
branch: ${{ github.head_ref }}
111 changes: 111 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for
everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity
and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion,
or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take
appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for
moderation decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing
the community in public spaces. Examples of representing our community include using an official e-mail address, posting
via an official social media account, or acting as an appointed representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible
for enforcement at
[INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem
in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the
community.

**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation
and an explanation of why the behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of actions.

**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including
unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding
interactions in community spaces as well as external channels like social media. Violating these terms may lead to a
temporary or permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified
period of time. No public or private interaction with the people involved, including unsolicited interaction with those
enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate
behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
at [https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org

[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html

[Mozilla CoC]: https://github.com/mozilla/diversity

[FAQ]: https://www.contributor-covenant.org/faq

[translations]: https://www.contributor-covenant.org/translations
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
19 changes: 19 additions & 0 deletions docs/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* reduce the size of the main text */
p {
font-size: 0.95rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: 500;
}

.sidebar-brand-text {
font-size: 1rem;
font-weight: 500;
margin: auto;
}
Binary file added docs/_static/logo/logo-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/logo/logo-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions docs/_templates/sidebar/variant-selector.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div class="sidebar-tree">
<ul>
<li class="toctree-l1 has-children"><a class="reference internal" href="">Versions</a>
<input class="toctree-checkbox" id="toctree-checkbox-version" name="toctree-checkbox-version" role="switch" type="checkbox"/>
<label for="toctree-checkbox-version"><div class="visually-hidden">Toggle navigation of Versions</div>
<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>
</label>
<ul>
{% for version in versions %}
<li class="toctree-l2"><a class="reference internal" href="{{ pathto('/'.join(['..', version, pagename])) }}">{{ version }}</a></li>
{% endfor %}
</ul>
<li>
</ul>
</div>
5 changes: 5 additions & 0 deletions docs/api_reference/example.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pypkg.example
=============

.. automodule:: pypkg.example
:members:
13 changes: 13 additions & 0 deletions docs/api_reference/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
API reference
=============

.. toctree::
:hidden:
:glob:

*

.. note::
Briefly describe the organization of the API reference if any.

In PyPkg, we only provide a dummy function :py:func:`.example.add` to show the bone structure of a Python pacakge.
43 changes: 43 additions & 0 deletions docs/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import functools
import subprocess

import tomllib

run = functools.partial(subprocess.run, shell=True)


def build_doc(version: str) -> None:
run(f"git checkout v{version}")
run("git checkout main -- conf.py")
run("git checkout main -- versions.toml")

run("make html")
run(f"mv _build/html pages/{version}")
run("rm -rf _build")
run("git checkout main")


def build_init_page(version: str) -> None:
with open("pages/index.html", "w") as f:
f.write(
f"""<!doctype html>
<meta http-equiv="refresh" content="0; url=./{version}/">"""
)


if __name__ == "__main__":
# create pages folder
run("rm -rf pages")
run("mkdir pages")

# get versions
with open("meta.toml", "rb") as f:
versions = tomllib.load(f)["versions"]
versions.sort(reverse=True, key=lambda v: tuple(map(int, v.split("."))))

# build documentations for different versions
for version in versions:
build_doc(version)

# build initial page that redirect to the latest version
build_init_page(versions[0])
106 changes: 106 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath("."))
import datetime

import tomllib

with open("../pyproject.toml", "rb") as f:
about = tomllib.load(f)["project"]


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

project = about["name"]
author = ", ".join([info["name"] for info in about["authors"]])
copyright = f"2019-{datetime.datetime.today().year}, {author}"


# The full version, including alpha/beta/rc tags
version = about["version"]


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

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosectionlabel",
"sphinx.ext.extlinks",
"sphinx.ext.intersphinx",
"sphinx.ext.mathjax",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
]
autodoc_typehints = "description"
autodoc_member_order = "bysource"
autodoc_type_aliases = {
"ArrayLike": "ArrayLike",
"NDArray": "NDArray",
"DataFrame": "DataFrame",
}

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

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


# -- 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 = "furo"

# 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_css_files = ["css/custom.css"]
html_title = f"{project} {version}"
html_theme_options = {
"sidebar_hide_name": False,
"light_logo": "logo/logo-light.png",
"dark_logo": "logo/logo-dark.png",
"light_css_variables": {
"color-brand-primary": "#008080",
"color-brand-content": "#008080",
"color-problematic": "#BF5844",
"color-background-secondary": "#F8F8F8",
"color-admonition-title--note": "#008080",
"color-admonition-title-background--note": "#00808033",
},
"dark_css_variables": {
"color-brand-primary": "#6FD8D1",
"color-brand-content": "#6FD8D1",
"color-problematic": "#FA9F50",
"color-background-secondary": "#202020",
"color-admonition-title--note": "#6FD8D1",
"color-admonition-title-background--note": "#6FD8D133",
},
}
# get versions
with open("meta.toml", "rb") as f:
versions = tomllib.load(f)["versions"]
html_context = {
"versions": versions,
}
11 changes: 11 additions & 0 deletions docs/developer_guide/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Developer guide
===============

.. admonition:: Work in progress...
:class: attention

Current topics

* briefly describe how to contribute
* contributing to the documentation
* contributing to the code base
Loading

0 comments on commit 14ce469

Please sign in to comment.