forked from microsoft/codamosa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial import of CodaMOSA code; updated license info on fully MSFT f…
…iles
- Loading branch information
Showing
390 changed files
with
50,279 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
._* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Oops, something went wrong.