-
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.
- Loading branch information
Showing
7 changed files
with
516 additions
and
0 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,3 @@ | ||
[run] | ||
omit = */tests/* | ||
source = src/pycptcore |
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,6 @@ | ||
[flake8] | ||
# just stop shouting as black decides line lengths. | ||
max-line-length = 180 | ||
# E203, W504: due to black fmt | ||
ignore = E203,W503 | ||
exclude = ["test*"] |
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 |
---|---|---|
@@ -1,2 +1,104 @@ | ||
# py-cptcore | ||
Public python SDK for the CEMS CPTCore web-API | ||
|
||
[](http://mypy-lang.org/) | ||
[](https://github.com/psf/black) | ||
[](https://pycqa.github.io/isort/) | ||
|
||
|
||
This repository is created by [CEMS BV](https://cemsbv.nl/) and is a public python wrapper around the CEMS [CPTCore web-API](https://nuclei.cemsbv.io/#/cptcore/api). | ||
|
||
# Installation | ||
|
||
To install a package in this repository run: | ||
|
||
`$ pip install py-cptcore` | ||
|
||
|
||
## ENV VARS | ||
|
||
To use `py-cptcore` add the follow ENV vars to your environment. Or provide them when asked. | ||
|
||
``` | ||
* NUCLEI_TOKEN | ||
- Your NUCLEI user token | ||
``` | ||
|
||
You can obtain your `NUCLEI_TOKEN` on [NUCLEI](https://nuclei.cemsbv.io/#/). | ||
Go to `personal-access-tokens` and create a new user token. | ||
|
||
# Contribution | ||
|
||
## Environment | ||
|
||
We recommend developing in Python3.9 with a clean virtual environment (using `virtualenv` or `conda`), installing the requirements from the requirements.txt file: | ||
|
||
Example using `virtualenv` and `pip` to install the dependencies in a new environment .env on Linux: | ||
|
||
```bash | ||
python -m venv .env | ||
source .env/bin/activate | ||
python -m pip install --upgrade pip setuptools | ||
pip install -r requirements.txt | ||
pip install -e . | ||
``` | ||
|
||
## Documentation | ||
|
||
Build the docs: | ||
|
||
```bash | ||
python -m pip install --upgrade pip setuptools | ||
pip install -r requirements.txt | ||
pip install . | ||
|
||
sphinx-build -b html docs public | ||
``` | ||
|
||
## Format | ||
|
||
We format our code with black and isort. | ||
|
||
```bash | ||
black --config "pyproject.toml" src/pycptcore tests | ||
isort --settings-path "pyproject.toml" src/pycptcore tests | ||
``` | ||
|
||
## Lint | ||
|
||
To maintain code quality we use the GitHub super-linter. | ||
|
||
To run the linters locally, run the `run_super_linters.sh` bash script from the root directory. | ||
|
||
## UnitTest | ||
|
||
Test the software with the use of coverage: | ||
|
||
```bash | ||
python -m pip install --upgrade pip setuptools | ||
pip install -r requirements.txt | ||
pip install . | ||
coverage run -m pytest | ||
``` | ||
|
||
## Requirements | ||
|
||
Requirements are autogenerated by the `pip-compile` command with python 3.9 | ||
|
||
Install pip-tools with: | ||
|
||
```bash | ||
pip install pip-tools | ||
``` | ||
|
||
Generate requirements.txt file with: | ||
|
||
```bash | ||
pip-compile --extra=test --extra=lint --extra=docs --output-file=requirements.txt pyproject.toml | ||
``` | ||
|
||
Update the requirements within the defined ranges with: | ||
|
||
```bash | ||
pip-compile --upgrade --extra=test --extra=lint --extra=docs --output-file=requirements.txt 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,87 @@ | ||
[build-system] | ||
requires = ["setuptools"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "py-cptcore" | ||
version = "0.0.1" | ||
description = "Public python SDK for the CEMS CPTCore web-API." | ||
requires-python = ">=3.9" | ||
dependencies = [ | ||
"requests>=2.25.1", | ||
"pandas>=1.2,<3.0", | ||
"matplotlib>3,<4", | ||
] | ||
license = { file = "LICENSE" } | ||
readme = "README.md" | ||
keywords = ["API", "CPTCore", "CEMS", "CRUX"] | ||
|
||
[project.urls] | ||
repository = "https://github.com/cemsbv/py-cptcore" | ||
|
||
[project.optional-dependencies] | ||
test = ["coveralls", "pytest"] | ||
docs = [ | ||
"Sphinx==6.1.3", | ||
"sphinx-autodoc-typehints==1.22", | ||
"ipython==8.11.0", | ||
"asteroid-sphinx-theme==0.0.3", | ||
"sphinx_rtd_theme==1.2.0" | ||
] | ||
# lint dependencies from github super-linter v5 | ||
# See https://github.com/super-linter/super-linter/tree/main/dependencies/python | ||
lint = [ | ||
"mypy==1.5.1", | ||
"mypy-extensions==1.0.0", | ||
"tomli==2.0.1", | ||
"typing_extensions==4.7.1", | ||
"black==23.3.0", | ||
"click==8.1.3", | ||
"packaging==23.2", | ||
"pathspec==0.11.1", | ||
"platformdirs==3.5.1", | ||
"tomli==2.0.1,", | ||
"isort==5.12.0", | ||
"flake8==6.0.0", | ||
"mccabe==0.7.0", | ||
"pycodestyle==2.10.0", | ||
"pyflakes==3.0.1", | ||
'pandas-stubs>2,<3', | ||
'types-tqdm>4,<5', | ||
] | ||
|
||
[tool.isort] | ||
profile = "black" | ||
multi_line_output = 3 | ||
include_trailing_comma = true | ||
force_grid_wrap = 0 | ||
use_parentheses = true | ||
ensure_newline_before_comments = true | ||
line_length = 88 | ||
|
||
[tool.mypy] | ||
files = ["pycptcore"] | ||
mypy_path = 'src' | ||
namespace_packages = true | ||
show_error_codes = true | ||
warn_redundant_casts = true | ||
warn_unused_ignores = true | ||
warn_unused_configs = true | ||
disallow_subclassing_any = true | ||
no_implicit_optional = true | ||
disallow_untyped_defs = true | ||
disallow_any_generics = false | ||
disallow_untyped_calls = true | ||
warn_return_any = false | ||
no_implicit_reexport = true | ||
strict_equality = true | ||
install_types = true | ||
|
||
[[tool.mypy.overrides]] | ||
module = ["matplotlib.*", "requests.*", "pytest.*"] | ||
ignore_missing_imports = true | ||
|
||
[[tool.mypy.overrides]] | ||
module = ["tests/*"] | ||
disallow_untyped_defs = false | ||
disallow_untyped_calls = false |
Oops, something went wrong.