Skip to content

Commit

Permalink
maint: add basic files
Browse files Browse the repository at this point in the history
  • Loading branch information
JSS95 committed Mar 2, 2024
1 parent 08ad129 commit d951dd1
Show file tree
Hide file tree
Showing 18 changed files with 828 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[flake8]
doctests = True
# compatibility with black
max-line-length = 88
extend-ignore =
E203,
exclude =
.venv
# flake-docstrings
per-file-ignores =
tests/**:D
doc/**:D
docstring-convention = google
119 changes: 119 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: CI

on: [push, pull_request]

jobs:

lint:

runs-on: ubuntu-latest

steps:

- name: get repo
uses: actions/checkout@v3

- name: set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"

- name: install dependencies
run: |
pip install flake8 black isort docformatter
- name: lint with flake8
run: |
flake8
- name: lint with black
run: |
black --check .
- name: lint with isort
run: |
isort --check .
- name: lint with docformatter
run: |
docformatter --check .
type-check:

needs: lint

runs-on: ubuntu-latest

steps:

- name: get repo
uses: actions/checkout@v3

- name: set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"

- name: install package
run: |
pip install .[img] mypy types-PyYAML
- name: run mypy check
run: mypy src

unit-test:

needs: type-check

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os : [ubuntu-latest, windows-latest, macos-latest]
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:

- name: get repo
uses: actions/checkout@v3

- name: set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: install package
run: |
pip install .[test]
- run: pytest

doc:

needs: unit-test

runs-on: ubuntu-latest

steps:

- name: get repo
uses: actions/checkout@v3

- name: set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"

- name: install package
run: |
pip install .[doc] doc8
- name: build document
run: |
cd doc
make html SPHINXOPTS="-W --keep-going"
- name: lint with doc8 # doc8 test must be done after building doc once.
run: |
doc8 .
132 changes: 132 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Custom entries
doc/source/help-*.txt

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
15 changes: 15 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.12"

sphinx:
configuration: doc/source/conf.py

python:
install:
- path: .
extra_requirements:
- doc
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include src/finitedepth/samples/*
include src/finitedepth/py.typed
20 changes: 20 additions & 0 deletions doc/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 = source
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)
35 changes: 35 additions & 0 deletions doc/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
24 changes: 24 additions & 0 deletions doc/source/_templates/autoapi/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Reference guides
================

User reference
--------------

.. toctree::
:titlesonly:

../command-reference

.. _module-reference:

Module reference
----------------

.. toctree::
:titlesonly:

{% for page in pages %}
{% if page.top_level_object and page.display %}
{{ page.include_path }}
{% endif %}
{% endfor %}
19 changes: 19 additions & 0 deletions doc/source/command-reference.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.. _command-reference:

Commands
========

.. literalinclude:: help-finitedepth.txt
:language: text

samples
-------

.. literalinclude:: help-finitedepth-samples.txt
:language: text

analyze
-------

.. literalinclude:: help-finitedepth-analyze.txt
:language: text
Loading

0 comments on commit d951dd1

Please sign in to comment.