diff options
| author | Adam Janovsky | 2022-04-26 08:21:14 +0200 |
|---|---|---|
| committer | Adam Janovsky | 2022-04-26 08:21:14 +0200 |
| commit | 2ada5810445ff7122c585752c8d01e712a395394 (patch) | |
| tree | b783b17d963ae82a6f3ce6498712aeee822468a2 | |
| parent | 51f3120a9b33a8e4d303c76a6e39bed13f679f71 (diff) | |
| download | sec-certs-2ada5810445ff7122c585752c8d01e712a395394.tar.gz sec-certs-2ada5810445ff7122c585752c8d01e712a395394.tar.zst sec-certs-2ada5810445ff7122c585752c8d01e712a395394.zip | |
.
| -rw-r--r-- | .github/workflows/docs.yml | 16 | ||||
| -rw-r--r-- | .github/workflows/draft_release.yml | 21 | ||||
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | CONTRIBUTING.md | 23 | ||||
| -rw-r--r-- | VERSION | 1 | ||||
| -rw-r--r-- | docs/conf.py | 8 | ||||
| -rw-r--r-- | pyproject.toml | 26 | ||||
| -rw-r--r-- | requirements/requirements.in | 1 | ||||
| -rw-r--r-- | requirements/requirements.txt | 8 | ||||
| -rw-r--r-- | setup.py | 2 |
10 files changed, 65 insertions, 43 deletions
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4971a49d..056153c8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -6,8 +6,16 @@ jobs: docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: ammaraskar/sphinx-action@master + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 with: - pre-build-command: python -m pip install -r requirements/dev_requirements.txt - docs-folder: "docs/" + python-version: 3.8 + - name: Install sec-certs and deps + run: | + pip install -r requirements/requirements.txt + pip install -r requirements/dev_requirements.txt + pip install -e . + - name: Build docs + run: | + cd docs + make html diff --git a/.github/workflows/draft_release.yml b/.github/workflows/draft_release.yml index 4490c0d0..95e2cadc 100644 --- a/.github/workflows/draft_release.yml +++ b/.github/workflows/draft_release.yml @@ -2,25 +2,12 @@ name: Create release draft on: push: - # branches: - # - "main" - # tags: - # - "*.*.*" + branches: + - "main" + tags: + - "*.*.*" jobs: - check-version: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Read VERSION file - run: echo "ACTUAL_VERSION=$(cat VERSION)" >> $GITHUB_ENV - - name: Check versions - run: | - if ((${{env.PACKAGE_NUMBER}} != ${{github.ref_name}})) ; then - echo "Tag does not match version number in VERSION file" - exit 1 - fi draft-release: runs-on: ubuntu-latest steps: @@ -5,6 +5,8 @@ # results folder results*/ +# version file by setuptools-scm +sec_certs/_version.py # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index afefc20b..80585c2d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,11 +25,26 @@ Requirements are maintained with [pip-tools](https://github.com/jazzband/pip-too - Additionally, [compile.sh](https://github.com/crocs-muni/sec-certs/blob/main/requirements/compile.sh) script is used to compile pinned versions of requirements that reside in `.txt` files in the same folder. - Tests, linting and Docker all run against this reproducible environment of pinned requirements. -## Branches and releases +## Branches + +`main` is the default branch against which all pull requests are to be made. This branch is not neccessarily stable, only the releases are. + +## Releases and version strings + +- On each revision pushed onto `main` that has `*.*.*` tag, a draft release is created with prepared changelog (this step can be skipped and the Release created right from the GitHub GUI). +- This draft release is to be published manually by the maintainer. +- Version string is not indexed in `git` but can be retreived maintained by `setuptools-scm` from git tags instead. +- `setuptools-scm` will automatically, upon editable/real install of a package, infer its version and write it to `sec_certs/_version.py`. This file is not indexed as well. See more at [setuptools-scm GitHub](https://github.com/pypa/setuptools_scm) +- On publishing a release, the tool is automatically published to [PyPi](https://pypi.org/project/sec-certs/) and [DockerHub](https://hub.docker.com/repository/docker/seccerts/sec-certs). + +Note on single-sourcing the package version: More can be read [here](https://packaging.python.org/en/latest/guides/single-sourcing-package-version/). The downside of our approach is that `.git` folder and editable/real install is needed to infer the version of the package. Releases can be infered without installing the project. + +### Currently, the release process is as follows + +1. (skip this optionally) Tag a revision with `*.*.*` tag -- this will create a draft release in GitHub. +2. Modify changelog and publish the release (or create it from scratch with new tag). +3. This will automatically update PyPi and DockerHub packages. -- `main` is the default branch against which all pull requests are to be made. This branch is not neccessarily stable, only the releases are. -- [Releases](https://github.com/crocs-muni/sec-certs/releases) are prepared manually by tagging revisions of `main` branch with `x.y.z` according to [semantic versioning](https://semver.org). -- Upon each release, the tool is automatically published to [PyPi](https://pypi.org/project/sec-certs/) and [DockerHub](https://hub.docker.com/repository/docker/seccerts/sec-certs). ## Quality assurance diff --git a/VERSION b/VERSION deleted file mode 100644 index 1750564f..00000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.0.6 diff --git a/docs/conf.py b/docs/conf.py index 092fe3c4..6eb14738 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,8 +12,8 @@ # # import os # import sys -# sys.path.insert(0, os.path.abspath('.')) - +# sys.path.insert(0, os.path.abspath(".")) +from importlib.metadata import version # -- Project information ----------------------------------------------------- @@ -22,8 +22,8 @@ copyright = "2022, Adam Janovsky, Petr Svenda, Jan Jancar, Jiri Michalik, Stanis author = "Adam Janovsky, Petr Svenda, Jan Jancar, Jiri Michalik, Stanislav Bobon" # The full version, including alpha/beta/rc tags -release = "0.0.4" - +# Note thas this inference won't work from Docker: https://github.com/pypa/setuptools_scm/#usage-from-docker +release = version("sec-certs") # -- General configuration --------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index 7ac509d6..6bae9df8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,9 @@ +[build-system] +requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] + +[tool.setuptools_scm] +write_to = "sec_certs/_version.py" + [tool.black] line-length = 120 exclude = ''' @@ -16,21 +22,19 @@ exclude = ''' ''' [tool.isort] -multi_line_output=3 -include_trailing_comma=true -force_grid_wrap=0 -use_parentheses=true -ensure_newline_before_comments=true -line_length=120 -skip=["certsvenv", "build"] +multi_line_output = 3 +include_trailing_comma = true +force_grid_wrap = 0 +use_parentheses = true +ensure_newline_before_comments = true +line_length = 120 +skip = ["certsvenv", "build"] [tool.mypy] plugins = ["numpy.typing.mypy_plugin"] ignore_missing_imports = true -exclude="build/" +exclude = "build/" [tool.pytest.ini_options] -markers = [ - "slow: marks tests as slow (deselect with '-m \"not slow\"')" -] +markers = ["slow: marks tests as slow (deselect with '-m \"not slow\"')"] addopts = "--cov sec_certs" diff --git a/requirements/requirements.in b/requirements/requirements.in index f7fc03a3..4b67a179 100644 --- a/requirements/requirements.in +++ b/requirements/requirements.in @@ -19,3 +19,4 @@ requests scikit-learn tabula-py tqdm +setuptools-scm diff --git a/requirements/requirements.txt b/requirements/requirements.txt index f72cd3f3..a66833ac 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -50,6 +50,7 @@ packaging==21.3 # via # matplotlib # pikepdf + # setuptools-scm pandas==1.4.2 # via # -r requirements.in @@ -88,6 +89,8 @@ scikit-learn==1.0.2 # via -r requirements.in scipy==1.8.0 # via scikit-learn +setuptools-scm==6.4.2 + # via -r requirements.in six==1.16.0 # via # html5lib @@ -98,6 +101,8 @@ tabula-py==2.3.0 # via -r requirements.in threadpoolctl==3.1.0 # via scikit-learn +tomli==2.0.1 + # via setuptools-scm tqdm==4.64.0 # via -r requirements.in urllib3==1.26.9 @@ -106,3 +111,6 @@ webencodings==0.5.1 # via html5lib zipp==3.8.0 # via importlib-resources + +# The following packages are considered to be unsafe in a requirements file: +# setuptools @@ -5,8 +5,6 @@ setup( name="sec-certs", author="Petr Svenda, Stanislav Bobon, Jan Jancar, Adam Janovsky, Jiri Michalik", author_email="svenda@fi.muni.cz", - version_config=True, - setup_requires=["setuptools-git-versioning"], packages=find_packages(), license="MIT", description="Tool for analysis of security certificates", |
