Skip to content

Commit

Permalink
Merge pull request #32 from Diapolo10/nightly
Browse files Browse the repository at this point in the history
Version 0.2
  • Loading branch information
Diapolo10 authored Jun 29, 2021
2 parents c6520c8 + 3a3e66e commit fe48f5a
Show file tree
Hide file tree
Showing 16 changed files with 1,071 additions and 710 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Flake8
on: [ push, pull_request ]

jobs:
lint:
flake8:

runs-on: ubuntu-latest

Expand All @@ -16,15 +16,15 @@ jobs:
uses: actions/setup-python@v2.2.2
with:
python-version: 3.9

- name: Install Poetry
uses: Gr1N/setup-poetry@v4

- name: Install library and dependencies
run: |
python3 -m pip install --upgrade pip
poetry install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ name: Pylint
on: [ push, pull_request ]

jobs:
lint:
pylint:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2.3.4

- name: Set up Python 3.9
uses: actions/setup-python@v2.2.2
with:
python-version: 3.9

- name: Install Poetry
uses: Gr1N/setup-poetry@v4

- name: Install library and dependencies
run: |
python -m pip install --upgrade pip
poetry install
- name: Analysing the code with pylint
run: |
poetry run python -m pylint iplib3
20 changes: 3 additions & 17 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This workflow will install Python dependencies,
# run tests with a variety of Python versions,
# and upload a new build to PyPI on master branch.
# and upload a new build to TestPyPI.
#
# For more information see:
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
python -m pip install --upgrade pip
poetry install
poetry run python -m pip install tox tox-gh-actions
- name: Install dependencies (Linux / Mac OS)
if: ${{ startsWith(matrix.os, 'windows') == false }}
run: |
Expand Down Expand Up @@ -102,23 +102,9 @@ jobs:

- name: Publish distribution 📦 to Test PyPI
uses: JRubics/poetry-publish@v1.7
continue-on-error: true
with:
ignore_dev_requirements: 'yes'
pypi_token: ${{ secrets.TEST_PYPI_PASSWORD }}
repository_name: 'testpypi'
repository_url: 'https://test.pypi.org/legacy/'


# build-n-publish:
# name: Build and publish Python 🐍 distributions 📦 to live PyPI
# runs-on: ubuntu-latest
# if: endsWith(github.ref, 'main') # TODO: Find a permanent solution

# steps:
# - uses: actions/checkout@v2.3.4

# - name: Publish distribution 📦 to PyPI
# uses: JRubics/poetry-publish@v1.7
# with:
# ignore_dev_requirements: 'yes'
# pypi_token: ${{ secrets.PYPI_PASSWORD }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,9 @@ cov.xml

# DeepCode/Snyk
.dccache

# Poetry lock file (may be committed at some point)
poetry.lock

# Tox stuff
tests/reports
84 changes: 80 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ TEMPLATE
## [major.minor.patch] - yyyy-mm-dd
A message that notes the main changes in the update.
### Added
### Changed
### Deprecated
### Fixed
### Removed
Expand Down Expand Up @@ -49,6 +49,68 @@ Lorem Ipsum dolor sit amet.

_______________________________________________________________________________

## [0.2.0] - 2021-06-29

This release focuses mostly on back-end changes, but there are a few additions
to functionality as well. Things have moved around, new unit tests have been
added, and the overall structure of the project is now more manageable. Most
importantly, however, the project has now been transitioned to use `poetry` as
its build system and this transition has enabled many of the old config files
to be removed. The entire project now uses `pyproject.toml` for all
configuration, from builds to unit tests. In addition, the GitHub Actions
workflow has been split into multiple workflows, it now uses Tox, and the
project is now additionally linted using `flake8`; previously only `pylint`
was used.

### Added

- `iplib3.constants`, a new sub-package used to store all of the constant
values used by the project.
- `iplib3.subnet`, a new submodule housing new subnet objects. At this
stage they remain unused, though the code has been unit tested.
- `iplib3.validators`, a new submodule for validator functions.

### Changed

- Validator functions from `iplib3.address` and `iplib3.subnet` have been
moved to `iplib3.validators` to keep the codebase more maintainable.
- Constants originally defined in `iplib3.address` and `iplib3.subnet`
have been moved to `iplib3.constants`.
- Some validators, including `port_validator`, `ip_validator`,
`ipv4_validator`, `ipv6_validator`, and `subnet_validator`, have been
added to the public interface. Previously they were considered private.
- Steps have been taken to reduce code duplication and complexity by creating
new, currently private helper functions. This will be a key point in
future development.
- `iplib3.PureAddress` is no longer an abstract base class, as it caused
difficulties in unit testing. It has been reworked into a concrete class.
- Updated localisation files

### Deprecated

- The `requirements.txt`-file is no longer used for anything, it may be removed
in a future version. Then again, it has been kept empty so far as the library
currently lacks non-development dependencies.

### Fixed

- Hundreds of linter errors
- Unit test coverage (previously ~70%, now 100%)
- Bugs related to equality testing of addresses
- Bugs related to initialisation and construction of `iplib3.IPAddress`

### Removed

- `setup.cfg`
- `setup.py`
- Scripts related to running tests (now handled by Makefile and/or Poetry)

### Security

- Added Snyk integration to sniff out vulnerabilities

_______________________________________________________________________________

## [0.1.5] - 2021-05-01

This is the beginning of the changelog. Previously made commits have not been
Expand All @@ -57,7 +119,8 @@ the initial commit.

### Added

- Added project URLs, more classifiers and a minimum Python version requirement to PyPI
- Added project URLs, more classifiers,
and a minimum Python version requirement to PyPI

### Changed

Expand All @@ -68,3 +131,16 @@ the initial commit.
### Fixed

- Fixed the CI/CD build process

<!-- markdownlint-configure-file {
"MD022": false,
"MD024": false,
"MD030": false,
"MD032": false
} -->
<!--
MD022: Blanks around headings
MD024: No duplicate headings
MD030: Spaces after list markers
MD032: Blanks around lists
-->
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.PHONY: all clean lint test tox type

CMD := poetry run
PYMODULE := iplib3
TESTS := tests

# Remember to activate Poetry's virtual environment in the project root folder
#
# Only once (ideally):
# > pip install poetry
# > poetry install
#
# Every time:
# > poetry shell

all: type lint test

lint:
# Configured in pyproject.toml
$(CMD) pflake8
$(CMD) pylint $(PYMODULE)

type:
$(CMD) mypy $(PYMODULE) $(TESTS)

test:
# Configured in pyproject.toml
$(CMD) pytest

tox:
# Configured in pyproject.toml
$(CMD) tox

clean:
git clean -Xdf # Delete all files in .gitignore
Loading

0 comments on commit fe48f5a

Please sign in to comment.