Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
swelcker committed Sep 26, 2022
0 parents commit 1987f77
Show file tree
Hide file tree
Showing 47 changed files with 2,660 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dist/* linguist-documentation
docs/* linguist-documentation
dist_docs/* linguist-documentation
*.html linguist-detectable=false
*.js linguist-detectable=false
*.css linguist-detectable=false
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/dist/
/dist_docs/

/msaFeature.egg-info/

3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/markdown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/msaFeature.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2022 Stefan Welcker for msaFeature


Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<p align="center">
<img src="http://logos.u2d.ai/msaFeature_logo.png?raw=true" alt="msaFeature Logo"/>
</p>

------
<p align="center">
<em>msaFeature - Feature switch management with conditions or simple decorators</em>
<br>
Optimized for use with Starlette/FastAPI/Pydantic.
<br>
Allows to create feature switches and to setup conditions those switches will be enabled
for. Once configured, switches can then be checked against inputs (requests, user objects, etc) to see if the switches are active/enabled.
<br>
<a href="https://pypi.org/project/msaFeature" target="_blank">
<img src="https://img.shields.io/pypi/v/msaFeature?color=%2334D058&label=pypi%20package" alt="Package version">
</a>
<a href="https://pypi.org/project/msaFeature" target="_blank">
<img src="https://img.shields.io/pypi/pyversions/msaFeature.svg?color=%2334D058" alt="Supported Python versions">
</a>
</p>

------

**Documentation**: <a href="https://msaFeature.u2d.ai/" target="_blank">msaFeature Documentation (https://msaFeature.u2d.ai/)</a>

------

## Features
This library includes two versions for FastAPI Feature Flags Management:

- **Simple**: Just a decorator and configuration with json from a file, dict or via url.
- **Complex with Switch & Conditions**: Complex version with switches and conditions based on your pydantic model and their business logic.


## License Agreement

- `msaFeature`Based on `MIT` open source and free to use, it is free for commercial use, but please show/list the copyright information about msaFeature somewhere.


## How to create the documentation

We use mkdocs and mkdocsstring. The code reference and nav entry get's created virtually by the triggered python script /docs/gen_ref_pages.py while ``mkdocs`` ``serve`` or ``build`` is executed.

### Requirements Install for the PDF creation option:
PDF Export is using mainly weasyprint, if you get some errors here pls. check there documentation. Installation is part of the msaFeature, so this should be fine.

We can now test and view our documentation using:

mkdocs serve

Build static Site:

mkdocs build


## Build and Publish

Build:

python setup.py sdist

Publish to pypi:

twine upload dist/*
106 changes: 106 additions & 0 deletions docs/css/mkdocstrings.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
@page {
size: a4 portrait;
margin: 25mm 15mm 25mm 15mm;
counter-increment: page;
font-family: "Montserrat","Roboto",Montserrat,Roboto,sans-serif;
font-size: 12px;
white-space: pre;
color: grey;
@top-left {
content: '© 2022 u2d.ai';
}
@top-center {
content: string(chapter);
}
@bottom-right {
content: 'Page ' counter(page);
}
}
/* logo. */
.md-header__button.md-logo :-webkit-any(img,svg) {
fill: currentcolor;
display: block;
height: 2.2rem;
width: auto;
}
/* Indentation. */
div.doc-contents:not(.first) {
padding-left: 25px;
border-left: .05rem solid var(--md-typeset-table-color);
}
.md-grid {
margin-left: auto;
margin-right: auto;
max-width: 81rem;
}
/* Mark external links as such. */
a.autorefs-external::after {
/* https://primer.style/octicons/arrow-up-right-24 */
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="rgb(0, 0, 0)" d="M18.25 15.5a.75.75 0 00.75-.75v-9a.75.75 0 00-.75-.75h-9a.75.75 0 000 1.5h7.19L6.22 16.72a.75.75 0 101.06 1.06L17.5 7.56v7.19c0 .414.336.75.75.75z"></path></svg>');
content: ' ';

display: inline-block;
position: relative;
top: 0.1em;
margin-left: 0.2em;
margin-right: 0.1em;

height: 1em;
width: 1em;
border-radius: 100%;
background-color: var(--md-typeset-a-color);
}
a.autorefs-external:hover::after {
background-color: var(--md-accent-fg-color);
}
.md-typeset h1 {
color: rgba(5, 168, 243, 0.99);
font-size: 2em;
line-height: 1.3;
margin: 0 0 1.25em;
}
.md-typeset h2 {
color: rgba(5, 168, 243, 0.95);
}
.md-typeset h5, .md-typeset h6 {
color: var(--md-default-fg-color--light);
font-size: 1.05em;
font-weight: 700;
letter-spacing: -.01em;
margin: 1.25em 0;
}
.md-typeset code {
background-color: rgba(171, 205, 239, 0.125);
border: solid 1px rgba(171, 205, 239, 0.25);
border-radius: 0.15rem;
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
font-size: .85em;
padding: 0 0.2941176471em;
word-break: break-word;
}
.md-header--shadow {
box-shadow: 0 0 0.2rem rgb(5 168 243 / 4%), 0 0.2rem 0.4rem rgb(5 168 243 / 7%);
transition: transform .25s cubic-bezier(.1,.7,.1,1),box-shadow .25s;
}
.doc-label {
border: solid 1px rgba(5, 168, 243, 0.55);
border-radius: 0.15rem;
font-size: 0.60em;
}
.doc-attribute-name {
font-size: 1.10em;
font-weight: 400;
letter-spacing: -.01em;
line-height: 1.5;
margin: 1.6em 0 0.8em;
text-decoration: unset;
}
.doc-class-name {
font-size: 1.15em;
font-weight: 600;
letter-spacing: -.01em;
line-height: 1.5;
margin: 1.6em 0 0.8em;
text-decoration: unset;
}
Loading

0 comments on commit 1987f77

Please sign in to comment.