Skip to content

Commit

Permalink
Converting project from pyk to pykframework
Browse files Browse the repository at this point in the history
  • Loading branch information
F-WRunTime committed Jun 4, 2024
1 parent 8737150 commit 6e23bc1
Show file tree
Hide file tree
Showing 3,374 changed files with 412,054 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
18 changes: 18 additions & 0 deletions pykframework/.cruft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"template": "https://github.com/runtimeverification/python-project-template.git",
"commit": "601d5e2a0e8a98c87dcb1ae694d22d76d0114e01",
"checkout": null,
"context": {
"cookiecutter": {
"project_name": "pykframework",
"project_slug": "pykframework",
"package_name": "pykframework",
"version": "0.1.0",
"description": "",
"author_name": "Runtime Verification, Inc.",
"author_email": "[email protected]",
"_template": "https://github.com/runtimeverification/python-project-template.git"
}
},
"directory": null
}
7 changes: 7 additions & 0 deletions pykframework/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
max-line-length = 120
extend-select = B9, TC1
extend-ignore = B907,B950,E,W1,W2,W3,W4,W5
per-file-ignores =
*/__init__.py: F401
type-checking-strict = true
12 changes: 12 additions & 0 deletions pykframework/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# For modularity, un-ignore everything from the K parent .gitignore...
!*

# ...and reinstate the original pykframework .gitignore.
/dist/
/docs/api/
/docs/build/
__pycache__/
.coverage

.kprove*
*.debug-log
21 changes: 21 additions & 0 deletions pykframework/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ARG K_DISTRO=jammy
ARG K_VERSION
FROM runtimeverificationinc/kframework-k:ubuntu-${K_DISTRO}-${K_VERSION}

ARG PYTHON_VERSION=3.10

RUN apt-get -y update \
&& apt-get -y install \
curl \
graphviz \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-dev \
&& apt-get -y clean

RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/usr python3 - \
&& poetry --version

ARG USER_ID=9876
ARG GROUP_ID=9876
RUN groupadd -g ${GROUP_ID} user \
&& useradd -m -u ${USER_ID} -s /bin/sh -g user user
29 changes: 29 additions & 0 deletions pykframework/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2022, Runtime Verification, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
120 changes: 120 additions & 0 deletions pykframework/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
POETRY := poetry
POETRY_RUN := $(POETRY) run


default: check test-unit

all: check cov

.PHONY: clean
clean: docs-clean
rm -rf dist .coverage cov-* .mypy_cache .pytest_cache
find -type d -name __pycache__ -prune -exec rm -rf {} \;

.PHONY: build
build:
$(POETRY) build

.PHONY: poetry-install
poetry-install:
$(POETRY) install


# Tests

TEST_ARGS :=

test: test-all

test-all: poetry-install
$(POETRY_RUN) pytest src/tests --maxfail=1 --verbose --durations=0 --numprocesses=4 --dist=worksteal $(TEST_ARGS)

test-unit: poetry-install
$(POETRY_RUN) pytest src/tests/unit --maxfail=1 --verbose $(TEST_ARGS)

test-integration: poetry-install
$(POETRY_RUN) pytest src/tests/integration --maxfail=1 --verbose --durations=0 --numprocesses=4 --dist=worksteal $(TEST_ARGS)

test-regression-new: poetry-install
$(MAKE) -C regression-new

# Coverage

COV_ARGS :=

cov: cov-all

cov-%: TEST_ARGS += --cov=pykframework --no-cov-on-fail --cov-branch --cov-report=term

cov-all: TEST_ARGS += --cov-report=html:cov-all-html $(COV_ARGS)
cov-all: test-all

cov-unit: TEST_ARGS += --cov-report=html:cov-unit-html $(COV_ARGS)
cov-unit: test-unit

cov-integration: TEST_ARGS += --cov-report=html:cov-integration-html $(COV_ARGS)
cov-integration: test-integration


# Profiling

PROF_ARGS :=

profile: poetry-install
$(POETRY_RUN) pytest src/tests/profiling --maxfail=1 --verbose --durations=0 --numprocesses=4 --dist=worksteal $(PROF_ARGS)


# Checks and formatting

format: autoflake isort black
check: check-flake8 check-mypy check-autoflake check-isort check-black

check-flake8: poetry-install
$(POETRY_RUN) flake8 src

check-mypy: poetry-install
$(POETRY_RUN) mypy src

autoflake: poetry-install
$(POETRY_RUN) autoflake --quiet --in-place src

check-autoflake: poetry-install
$(POETRY_RUN) autoflake --quiet --check src

isort: poetry-install
$(POETRY_RUN) isort src

check-isort: poetry-install
$(POETRY_RUN) isort --check src

black: poetry-install
$(POETRY_RUN) black src

check-black: poetry-install
$(POETRY_RUN) black --check src


# Optional tools

SRC_FILES := $(shell find src -type f -name '*.py')

pyupgrade: poetry-install
$(POETRY_RUN) pyupgrade --py310-plus $(SRC_FILES)


# Documentation

DOCS_API_DIR := docs/api
DOCS_BUILD_DIR := docs/build

.PHONY: docs-clean
docs-clean:
rm -rf $(DOCS_API_DIR) $(DOCS_BUILD_DIR)

docs-apidoc: poetry-install
$(POETRY_RUN) sphinx-apidoc src/pykframework --output $(DOCS_API_DIR) --force --separate --module-first

docs-build-%: docs-apidoc
$(POETRY_RUN) sphinx-build -b $* docs $(DOCS_BUILD_DIR)/$*

docs: docs-build-html
26 changes: 26 additions & 0 deletions pykframework/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# pykframework
## Python tools for K

[API documentation](https://kframework.org/pykframework/)


## Installation

Prerequsites: `python >= 3.10`, `pip >= 20.0.2`, `poetry >= 1.3.2`.

```bash
make build
pip install dist/*.whl
```


## For Developers

Use `make` to run common tasks (see the [Makefile](Makefile) for a complete list of available targets).

* `make build`: Build wheel
* `make check`: Check code style
* `make format`: Format code
* `make test-unit`: Run unit tests

For interactive use, spawn a shell with `poetry shell` (after `poetry install`), then run an interpreter.
Empty file.
33 changes: 33 additions & 0 deletions pykframework/docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'pykframework'
author = 'Runtime Verification, Inc'
copyright = '2024, Runtime Verification, Inc'
version = '7.0.41'
release = '7.0.41'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
]
templates_path = ['_templates']
exclude_patterns = []

add_module_names = False
autodoc_inherit_docstrings = False
viewcode_line_numbers = True

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'alabaster'
html_static_path = ['_static']
21 changes: 21 additions & 0 deletions pykframework/docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.. pykframework documentation master file, created by
sphinx-quickstart on Fri Jan 12 09:29:35 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to pykframework's documentation!
===============================

.. toctree::
:maxdepth: 2
:caption: Contents:

api/modules


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Loading

0 comments on commit 6e23bc1

Please sign in to comment.