Skip to content

Commit

Permalink
Initial import of CodaMOSA code; updated license info on fully MSFT f…
Browse files Browse the repository at this point in the history
…iles
  • Loading branch information
carolemieux committed Jan 31, 2023
2 parents 0c45efb + b9b642b commit 8d449db
Show file tree
Hide file tree
Showing 390 changed files with 50,279 additions and 7 deletions.
39 changes: 39 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# SPDX-FileCopyrightText: 2019–2022 Pynguin Contributors
#
# SPDX-License-Identifier: CC0-1.0

# Git
.git
.gitignore
.github

# Docker
.dockerignore

# IDE
.idea
.vscode

# Byte-compiled / optimized / DLL files
__pycache__/
**/__pycache__/
*.pyc
*.pyo
*.pyd
.Python
*.py[cod]
*$py.class
.pytest_cache/
..mypy_cache/

# C extensions
*.so

# Virtual environment
.venv
venv

.DS_Store
.AppleDouble
.LSOverride
._*
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-FileCopyrightText: 2019–2022 Pynguin Contributors
#
# SPDX-License-Identifier: CC0-1.0

# Check http://editorconfig.org for more information
# This is the main config file for this project:
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.{py, pyi}]
indent_size = 4

[Makefile]
indent_style = tab

[*.md]
trim_trailing_whitespace = false

[*.{diff,patch}]
trim_trailing_whitespace = false
12 changes: 12 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-FileCopyrightText: 2019–2022 Pynguin Contributors
#
# SPDX-License-Identifier: CC0-1.0

[flake8]
ignore = E203, E266, E501, W503
show-source = true
enable-extensions = G
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4,B9
exclude = docs,.venv,venv
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# SPDX-FileCopyrightText: 2019–2022 Pynguin Contributors
#
# SPDX-License-Identifier: LGPL-3.0-or-later

name: CI
on: [push, pull_request]

jobs:
ci:
strategy:
fail-fast: false
matrix:
python-version: ['3.10']
poetry-version: [1.1.13]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Setup Poetry
uses: abatilo/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}

- name: Install dependencies
run: poetry install

- name: Check imports with isort
run: poetry run isort --check-only . --profile black

- name: Check formatting with black
run: poetry run black --diff --check .

- name: Check typing with mypy
run: poetry run mypy pynguin

- name: Linting with flake8
run: poetry run flake8 .

- name: Linting with pylint
run: poetry run pylint pynguin

- name: Check docstrings with darglint
run: poetry run darglint -v 2 pynguin/**/*.py

- name: Run tests
run: poetry run pytest --cov=pynguin --cov=tests --cov-branch --cov-report=term-missing tests/
116 changes: 116 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,119 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/

# SPDX-FileCopyrightText: 2019–2022 Pynguin Contributors
#
# SPDX-License-Identifier: CC0-1.0

# 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/
*.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/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
coverage.pynguin.import

# Translations
*.mo
*.pot

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

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# 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/
.idea
cov_html/
.dmypy.json
pynguin-report/
docs/_build
.run/
37 changes: 37 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# SPDX-FileCopyrightText: 2019–2022 Pynguin Contributors
#
# SPDX-License-Identifier: LGPL-3.0-or-later

default_language_version:
python: python3.10

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-ast
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
args: [--fix=lf]

- repo: https://github.com/asottile/pyupgrade
rev: v2.31.1
hooks:
- id: pyupgrade
args: [--py310-plus]

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
args: [--profile, black]

- repo: https://github.com/psf/black
rev: 22.1.0
hooks:
- id: black
args: [--config, ./pyproject.toml]
10 changes: 10 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: CodaMOSA
Upstream-Contact: Caroline Lemieux <[email protected]>
Source: https://github.com/microsoft/codamosa

# Sample paragraph, commented out:
#
# Files: src/*
# Copyright: $YEAR $NAME <$CONTACT>
# License: ...
93 changes: 93 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!--
SPDX-FileCopyrightText: 2019–2022 Pynguin Contributors
SPDX-License-Identifier: CC-BY-4.0
-->

# How to contribute

## Dependencies

We use `poetry` to manage the [dependencies](https://github.com/python-poetry/poetry).
If you do not have `poetry` installed, you should run the command below.

```bash
make download-poetry
```

To install dependencies and prepare [`pre-commit`](https://pre-commit.com/) hooks you would need to run `install` command:

```bash
make install
```

To activate your `virtualenv` run `poetry shell`.

## Codestyle

After you run `make install` you can execute the automatic code formatting.

```bash
make codestyle
```

We require the [black](https://github.com/psf/black) code style,
with 88 characters per line maximum width (exceptions are only permitted for imports
and comments that disable, e.g., a `pylint` warning).
Imports are ordered using [isort](https://github.com/timothycrosley/isort).
Docstrings shall conform to the
[Google Python Style Guide](https://google.github.io/styleguide/pyguide.html).
Except for the above-mentioned differences,
we suggest to conform to the Google Python Style Guide as much as possible.

In particular, we want to point to Sec. 2.14 of Google's style guide,
regarding `None` checks.

Imports from `__future__` are not permitted except for the `from __future__ import
annotations` feature that allows more concise type hints.
Pynguin requires at least Python 3.8—there is not need to support older versions!

### Checks

Many checks are configured for this project.
Command `make check-style` will run black diffs,
darglint docstring style and mypy.
The `make check-safety` command will look at the security of your code.

*Note:* darglint on Windows only runs in `git bash` or the Linux subsystem.

You can also use `STRICT=1` flag to make the check be strict.

### Before submitting

Before submitting your code please do the following steps:

1. Add any changes you want
1. Add tests for the new changes
1. Edit documentation if you have changed something significant
1. Run `make codestyle` to format your changes.
1. Run `STRICT=1 make check-style` to ensure that types and docs are correct
1. Run `STRICT=1 make check-safety` to ensure that security of your code is correct

## Unit Tests

`Pynguin` uses [`pytest`](https://pytest.org) to execute the tests.
You can find the tests in the `tests` folder.
The target `make test` executes `pytest` with the appropriate parameters.

To combine all analysis tools and the test execution
we provide the target `make check`,
which executes all of them in a row.

We automatically deploy the coverage report (HTML version) from the CI chain
to [an external server](https://pagedeploy.lukasczyk.me/pynguincoverage/) (only for
the `master` branch).
It is necessary to test code!
Untested code cannot be accepted—or only under rare conditions.

## Other help

You can contribute by spreading a word about this library.
It would also be a huge contribution to write
a short article on how you are using this project.
You can also share your best practices with us.
Loading

0 comments on commit 8d449db

Please sign in to comment.