Skip to content

Commit 57aee0a

Browse files
committed
copy code from pydantic, tests
1 parent 35a6006 commit 57aee0a

File tree

16 files changed

+1977
-6
lines changed

16 files changed

+1977
-6
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: samuelcolvin

.github/workflows/ci.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- '**'
9+
pull_request: {}
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: set up python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.10'
22+
23+
- run: pip install -r requirements/linting.txt -r requirements/pyproject.txt
24+
25+
- uses: pre-commit/[email protected]
26+
with:
27+
extra_args: --all-files
28+
29+
test:
30+
name: test py${{ matrix.python }} on ${{ matrix.os }}
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
os: [ubuntu, macos, windows]
35+
python: ['3.7', '3.8', '3.9', '3.10', '3.11-dev']
36+
37+
env:
38+
PYTHON: ${{ matrix.python }}
39+
OS: ${{ matrix.os }}
40+
41+
runs-on: ${{ matrix.os }}-latest
42+
43+
steps:
44+
- uses: actions/checkout@v2
45+
46+
- name: set up python
47+
uses: actions/setup-python@v4
48+
with:
49+
python-version: ${{ matrix.python }}
50+
51+
- run: pip install -r requirements/testing.txt -r requirements/pyproject.txt
52+
53+
- run: make test
54+
55+
- run: coverage xml
56+
57+
- uses: codecov/codecov-action@v2
58+
with:
59+
file: ./coverage.xml
60+
env_vars: PYTHON,OS
61+
62+
deploy:
63+
name: Deploy
64+
needs: [lint, test]
65+
if: "success() && startsWith(github.ref, 'refs/tags/')"
66+
runs-on: ubuntu-latest
67+
68+
steps:
69+
- uses: actions/checkout@v2
70+
71+
- name: set up python
72+
uses: actions/setup-python@v4
73+
with:
74+
python-version: '3.10'
75+
76+
- name: install
77+
run: pip install -U twine build packaging
78+
79+
- name: check version
80+
id: check-version
81+
run: python <(curl -Ls https://gist.githubusercontent.com/samuelcolvin/4e1ad439c5489e8d6478cdee3eb952ef/raw/check_version.py)
82+
env:
83+
VERSION_PATH: 'pydantic_settings/version.py'
84+
85+
- name: build
86+
run: python -m build
87+
88+
- run: twine check dist/*
89+
90+
- name: upload to pypi
91+
run: twine upload dist/*
92+
env:
93+
TWINE_USERNAME: __token__
94+
TWINE_PASSWORD: ${{ secrets.pypi_token }}

.pre-commit-config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.3.0
4+
hooks:
5+
- id: check-yaml
6+
- id: check-toml
7+
- id: end-of-file-fixer
8+
- id: trailing-whitespace
9+
10+
- repo: local
11+
hooks:
12+
- id: lint
13+
name: Lint
14+
entry: make lint
15+
types: [python]
16+
language: system
17+
pass_filenames: false
18+
- id: mypy
19+
name: Mypy
20+
entry: make mypy
21+
types: [python]
22+
language: system
23+
pass_filenames: false
24+
- id: pyupgrade
25+
name: Pyupgrade
26+
entry: pyupgrade --py37-plus
27+
types: [python]
28+
language: system

Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.DEFAULT_GOAL := all
2+
sources = pydantic_settings tests
3+
4+
.PHONY: install
5+
install:
6+
python -m pip install -U pip
7+
pip install -r requirements/all.txt
8+
pip install -e .
9+
10+
.PHONY: format
11+
format:
12+
pyupgrade --py37-plus --exit-zero-even-if-changed `find $(sources) -name "*.py" -type f`
13+
isort $(sources)
14+
black $(sources)
15+
16+
.PHONY: lint
17+
lint:
18+
flake8 $(sources)
19+
isort $(sources) --check-only --df
20+
black $(sources) --check --diff
21+
22+
.PHONY: mypy
23+
mypy:
24+
mypy pydantic_settings
25+
26+
.PHONY: test
27+
test:
28+
coverage run -m pytest --durations=10
29+
30+
.PHONY: testcov
31+
testcov: test
32+
@echo "building coverage html"
33+
@coverage html
34+
35+
.PHONY: all
36+
all: lint mypy testcov

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# pydantic-settings
22

3+
[![CI](https://github.com/pydantic/pydantic-settings/workflows/CI/badge.svg?event=push)](https://github.com/pydantic/pydantic-settings/actions?query=event%3Apush+branch%3Amain+workflow%3ACI)
4+
[![Coverage](https://codecov.io/gh/pydantic/pydantic-settings/branch/main/graph/badge.svg)](https://codecov.io/gh/pydantic/pydantic-settings)
5+
[![license](https://img.shields.io/github/license/pydantic/pydantic-settings.svg)](https://github.com/pydantic/pydantic-settings/blob/main/LICENSE)
6+
37
**Work in Progress**, see https://github.com/pydantic/pydantic/pull/4492

pydantic_settings/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import warnings
2+
3+
from .main import BaseSettings
24
from .version import VERSION
35

6+
__all__ = ('BaseSettings',)
7+
48
__version__ = VERSION
59
warnings.warn(
6-
'This is a placeholder until pydantic-settings is released, '
7-
'see https://github.com/pydantic/pydantic/pull/4492'
10+
'This is a placeholder until pydantic-settings is released, ' 'see https://github.com/pydantic/pydantic/pull/4492'
811
)

0 commit comments

Comments
 (0)