Skip to content

Commit 9fb2986

Browse files
authored
Merge pull request #8 from quiqueporta/migrate-to-github-actions
Migrate to GitHub actions
2 parents a105cc1 + d6fd61f commit 9fb2986

File tree

14 files changed

+120
-114
lines changed

14 files changed

+120
-114
lines changed

.coveragerc

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/workflows/python-package.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ jobs:
2020
run: |
2121
python -m pip install --upgrade pip
2222
pip install -r requirements-test.txt
23-
pip install coveralls
24-
python setup.py -q develop
2523
- name: Test with mamba
2624
run: |
27-
PYTHONPATH=$PYTHONPATH:. mamba --enable-coverage
25+
PYTHONPATH=$PYTHONPATH:. mamba -f documentation

AUTHORS

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Original Author
2-
---------------
1+
Author
2+
------
33
Quique Porta https://github.com/quiqueporta
44

55

@@ -8,3 +8,4 @@ Contributors
88
William Travis Jones https://github.com/wtjones
99
David Arias http://davidarias.net
1010
Hugo Leonardo Costa e Silva https://github.com/hugoleodev
11+
Jesse Heitler https://github.com/jesseh

CHANGES.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
Changelog
22
=========
33

4+
2.0.0 (2022-10-27)
5+
------------------
6+
7+
- Rename CannotBeChangeException to CannotBeChanged
8+
- Rename InvariantReturnValueException to InvariantMustReturnBool
9+
- Rename NotDeclaredArgsException to ConstructorWithoutArguments
10+
- Rename ViolatedInvariantException to InvariantViolation
11+
- Simplifly invariants now receives `self` attribute only
12+
- Fix replace_mutable_kwargs_with_immutable_types for `set` kwargs
13+
14+
415
1.5.0 (2020-12-07)
516
------------------
617

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM python:3.10-alpine
2+
3+
WORKDIR /app
4+
5+
ENV PYTHONPATH="/app"
6+
7+
COPY ./requirements-test.txt /
8+
9+
RUN pip install --upgrade pip
10+
RUN pip install -r /requirements-test.txt
11+
12+
COPY . /app

README.rst

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Value Object
22
============
33

4-
|Version Number| |Build Status| |Coverage Status| |Python Version| |License MIT|
4+
|Version Number| |Python Version| |License MIT|
55

66

77
Based on Ruby Gem by NoFlopSquad (https://github.com/noflopsquad/value-object)
@@ -43,7 +43,7 @@ Constructor and field readers
4343
# 2
4444
4545
point.x = 5
46-
# CannotBeChangeException: You cannot change values from a Value Object, create a new one
46+
# CannotBeChanged: You cannot change values from a Value Object, create a new one
4747
4848
class Date(ValueObject):
4949
def __init__(self, day, month, year):
@@ -61,7 +61,7 @@ Constructor and field readers
6161
# 2015
6262
6363
date.month = 5
64-
# CannotBeChangeException: You cannot change values from a Value Object, create a new one
64+
# CannotBeChanged: You cannot change values from a Value Object, create a new one
6565
6666
6767
Equality based on field values
@@ -115,6 +115,8 @@ Hash code based on field values
115115
Invariants
116116
~~~~~~~~~~
117117

118+
Invariants **must** return a boolean value.
119+
118120
.. code-block:: python
119121
120122
from simple_value_object import ValueObject, invariant
@@ -125,18 +127,18 @@ Invariants
125127
pass
126128
127129
@invariant
128-
def inside_first_quadrant(cls, instance):
129-
return instance.x > 0 and instance.y > 0
130+
def inside_first_quadrant(self):
131+
return self.x > 0 and self.y > 0
130132
131133
@invariant
132-
def x_less_than_y(cls, instance):
133-
return instance.x < instance.y
134+
def x_less_than_y(self):
135+
return self.x < self.y
134136
135137
Point(-5, 3)
136-
#ViolatedInvariantException: Args violates invariant: inside_first_cuadrant
138+
#InvariantViolation: inside_first_cuadrant
137139
138140
Point(6, 3)
139-
#ViolatedInvariantException: Args violates invariant: x_less_than_y
141+
#InvariantViolation: x_less_than_y
140142
141143
Point(1,3)
142144
#<__main__.Point at 0x7f2bd043c780>
@@ -165,18 +167,11 @@ Test
165167

166168
.. code-block:: sh
167169
168-
> pip install -r requirements-test.txt
169-
> PYTHONPATH=$PYTHONPATH:. mamba
170-
171-
172-
.. |Version Number| image:: https://img.shields.io/badge/version-1.5.0-blue.svg
170+
> $ docker/test
173171
174-
.. |Build Status| image:: https://travis-ci.org/quiqueporta/simple-value-object.svg?branch=master
175-
:target: https://travis-ci.org/quiqueporta/simple-value-object
176172
177-
.. |Coverage Status| image:: https://coveralls.io/repos/quiqueporta/simple-value-object/badge.svg?branch=master&service=github
178-
:target: https://coveralls.io/github/quiqueporta/simple-value-object?branch=master
173+
.. |Version Number| image:: https://img.shields.io/badge/version-2.0.0-blue.svg
179174

180175
.. |License MIT| image:: https://img.shields.io/github/license/quiqueporta/simple-value-object
181176

182-
.. |Python Version| image:: https://img.shields.io/badge/python-3.4,_3.5,_3.6,_3.7-blue.svg
177+
.. |Python Version| image:: https://img.shields.io/badge/python-3.6,_3.7,_3.8,_3.9,_3.10-blue.svg

docker/test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
docker build -t simple-value-object:latest .
4+
docker run --rm -it simple-value-object:latest mamba --f documentation

requirements-test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
expects==0.9.0
2-
mamba==0.11.0
2+
mamba==0.11.2

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
license='MIT/X11',
1010
author='Quique Porta',
1111
author_email='[email protected]',
12-
description='A simple mixin for create Value Objects',
12+
description='A simple mixin to create Value Objects',
1313
long_description=open('README.rst').read(),
1414
url='https://github.com/quiqueporta/value-object',
1515
download_url='https://github.com/quiqueporta/simple-value-object/releases',

simple_value_object/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
# -*- coding: utf-8 -*-
2-
31
from .value_object import ValueObject
42
from .decorators import invariant
53

6-
VERSION = (1, 5, 0, 'final')
4+
VERSION = (2, 0, 0, 'final')
75
__version__ = VERSION
86

97

0 commit comments

Comments
 (0)