Skip to content

Commit 2cf61dc

Browse files
committed
Merge branch 'release/v0.1.0'
2 parents b7aa8fc + a81743d commit 2cf61dc

13 files changed

+315
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.vscode
2+
13
# Byte-compiled / optimized / DLL files
24
__pycache__/
35
*.py[cod]

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
language: python
2+
python:
3+
- "2.7"
4+
- "3.4"
5+
- "3.5"
6+
- "3.6" # current default Python on Travis CI
7+
- "3.7"
8+
- "3.8"
9+
- "3.8-dev" # 3.8 development branch
10+
- "nightly" # nightly build
11+
# command to install dependencies
12+
install:
13+
- pip install -r requirements.txt
14+
# command to run tests
15+
script:
16+
- python tests/units.py

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,50 @@
11
# validium
22
a Python utility library for performing validations flexibly
3+
4+
## Installation
5+
6+
```bash
7+
pip install validium
8+
```
9+
10+
## Quick Start
11+
12+
Here's an example of how to create and use some very simple validators for some numbers:
13+
14+
```py
15+
import validium as V
16+
17+
PI = 3.14
18+
ONE = 1
19+
20+
is_number = V.Validator(lambda x: isinstance(x, Number), 'must be a number')
21+
22+
is_number.validate(PI) # pass
23+
is_number.validate(ONE) # pass
24+
25+
is_positive = V.Validator(lambda x: x > 0, 'must be positive')
26+
27+
is_positive.validate(PI) # pass
28+
is_positive.validate(ONE) # pass
29+
30+
is_not_one = V.Validator(lambda x: not x == 1, 'must not equal 1')
31+
32+
is_not_one.validate(PI) # pass
33+
is_not_one.validate(ONE) # AssertionError: must not equal 1
34+
35+
```
36+
37+
### Building Up
38+
39+
Here's an example of how to parameterize and reuse a common validator pattern:
40+
41+
```py
42+
is_not = lambda y: V.Validator(lambda x: not x == y, 'must not equal {}'.format(x)) # u
43+
44+
is_not(-1).validate(ONE) # pass
45+
is_not(0).validate(ONE) # pass
46+
is_not(1).validate(ONE) # AssertionError: must not equal 1
47+
48+
```
49+
50+
This approach will help keep your code nice and DRY in the event you need handful of validators that behave mostly the same but slightly different.

docker-compose.shell.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: '3'
2+
services:
3+
test-runner:
4+
build:
5+
context: .
6+
dockerfile: python3.Dockerfile
7+
command: python
8+
volumes:
9+
- .:/app
10+
stdin_open: true
11+
tty: true

docker-compose.test-runner.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: '3'
2+
services:
3+
test-runner:
4+
build:
5+
context: .
6+
dockerfile: python3.Dockerfile
7+
command: python tests/units.py
8+
volumes:
9+
- .:/app
10+
stdin_open: true
11+
tty: true
12+
test-runner-2:
13+
build:
14+
context: .
15+
dockerfile: python2.Dockerfile
16+
command: python tests/units.py
17+
volumes:
18+
- .:/app
19+
stdin_open: true
20+
tty: true

python2.Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM python:2.7
2+
3+
WORKDIR /app
4+
5+
COPY requirements.txt ./
6+
RUN pip install --no-cache-dir -r requirements.txt

python3.Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM python:3.8
2+
3+
WORKDIR /app
4+
5+
COPY requirements.txt ./
6+
RUN pip install --no-cache-dir -r requirements.txt

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pandas==1.0.1
2+
ramda==0.5.5

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[metadata]
2+
description-file = README.md

setup.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from distutils.core import setup
2+
setup(
3+
name = 'validium', # How you named your package folder (MyLib)
4+
packages = ['validium'], # Chose the same as "name"
5+
version = '0.1.0', # Start with a small number and increase it with every change you make
6+
license= 'MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
7+
description = 'a utility library for generating chunks of time within a datetime range', # Give a short description about your library
8+
author = 'Jason Yung',
9+
author_email = '[email protected]',
10+
url = 'https://github.com/json2d/validium', # Provide either the link to your github or to your website
11+
download_url = 'https://github.com/json2d/validium/archive/v0.1.0.tar.gz',
12+
keywords = ['datetime', 'interval', 'chunks'], # Keywords that define your package best
13+
install_requires= [],
14+
classifiers=[
15+
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
16+
'Intended Audience :: Developers', # Define your audience
17+
'Topic :: Utilities',
18+
'License :: OSI Approved :: MIT License', # Again, pick a license
19+
'Programming Language :: Python :: 3', # Specify which pyhton versions that you want to support
20+
'Programming Language :: Python :: 3.4',
21+
'Programming Language :: Python :: 3.5',
22+
'Programming Language :: Python :: 3.6',
23+
'Programming Language :: Python :: 3.7',
24+
'Programming Language :: Python :: 3.8',
25+
],
26+
)

0 commit comments

Comments
 (0)