Skip to content

Commit bf12bdf

Browse files
Merge pull request #53 from connor-makowski/handle_immutable
Handle immutable
2 parents 51ec526 + 5990c6b commit bf12bdf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+5257
-1644
lines changed

Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# FROM python:3.12-slim
77
FROM python:3.13-slim
88
# FROM python:3.14-rc-slim
9+
# # Temp Fix only needed for 3.14 until a wheel cffi is available
10+
# RUN apt-get update && apt-get install -y gcc libffi-dev
911

1012
# Set the working directory to /app
1113
WORKDIR /app/
@@ -14,11 +16,8 @@ WORKDIR /app/
1416
# This includes egg installing the type_enforced package
1517
COPY type_enforced/__init__.py /app/type_enforced/__init__.py
1618
COPY pyproject.toml /app/pyproject.toml
17-
RUN pip install -e .
18-
19-
COPY ./util_test_helper.sh /app/util_test_helper.sh
20-
COPY ./test/test_fn_01.py /app/test/test_fn_01.py
19+
COPY requirements.txt /app/requirements.txt
20+
RUN pip install -r requirements.txt
2121

22+
# Drop into a shell by default
2223
CMD ["/bin/bash"]
23-
# Comment out ENTRYPOINT to drop into an interactive shell for debugging when using test.sh
24-
ENTRYPOINT ["/app/util_test_helper.sh"]

README.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ Variables without an annotation for type are not enforced.
6666
- Standard typing functions:
6767
- `List`, `Set`, `Dict`, `Tuple`
6868
- `Union`
69-
- `Optional`
69+
- `Optional`
7070
- `Sized`
71-
- Essentially creates a union of:
71+
- Essentially creates a union of:
7272
- `list`, `tuple`, `dict`, `set`, `str`, `bytes`, `bytearray`, `memoryview`, `range`
7373
- Note: Can not have a nested type
7474
- Because this does not always meet the criteria for `Nested types` above
@@ -198,7 +198,7 @@ import type_enforced
198198
class my_class:
199199
def my_fn(self, a: int) -> None:
200200
pass
201-
201+
202202
@type_enforced.Enforcer(enabled=False)
203203
def my_other_fn(self, a: int) -> None:
204204
pass
@@ -309,14 +309,17 @@ my_fn(Baz()) # Raises TypeError as expected
309309
```
310310

311311
# Development
312-
## Running Tests
313-
### Debug and Test using Docker
312+
## Running Tests, Prettifying Code, and Updating Docs
314313

315-
- Creates a docker container and runs all tests in the `test` folder.
316-
- Alternately, you can comment out the `ENTRYPOINT` line in the `Dockerfile` and drop into a shell to run tests individually.
317-
- Runs the tests on the python version specified in the `Dockerfile`.
318-
- Modify this as needed to ensure function across all supported python versions (3.9+)
314+
Make sure Docker is installed and running.
319315

320-
```bash
321-
./run_test.sh
322-
```
316+
- Create a docker container and drop into a shell
317+
- `./run.sh`
318+
- Run all tests (see ./utils/test.sh)
319+
- `./run.sh test`
320+
- Prettify the code (see ./utils/prettify.sh)
321+
- `./run.sh prettify`
322+
- Update the docs (see ./utils/docs.sh)
323+
- `./run.sh docs`
324+
325+
- Note: You can and should modify the `Dockerfile` to test different python versions.
16.1 KB
Binary file not shown.

dist/type_enforced-1.10.2.tar.gz

22.9 KB
Binary file not shown.

docs/0.0.16/search.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/0.0.16/type_enforced.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1">
6-
<meta name="generator" content="pdoc 15.0.0"/>
6+
<meta name="generator" content="pdoc 15.0.1"/>
77
<title>type_enforced API documentation</title>
88

99
<style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style>
@@ -31,7 +31,7 @@ <h2>Submodules</h2>
3131
<footer>
3232
<select id="version-selector">
3333
<option value="latest">latest</option>
34-
<option value="1.10.1">1.10.1</option>
34+
<option value="1.10.2">1.10.2</option>
3535
<option value="1.9.0">1.9.0</option>
3636
<option value="1.8.1">1.8.1</option>
3737
<option value="1.7.0">1.7.0</option>
@@ -89,9 +89,9 @@ <h1 class="modulename">
8989

9090
<label class="view-source-button" for="mod-type_enforced-view-source"><span>View Source</span></label>
9191

92-
<div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos">1</span></a><span class="kn">import</span> <span class="nn">sys</span>
92+
<div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos">1</span></a><span class="kn">import</span><span class="w"> </span><span class="nn">sys</span>
9393
</span><span id="L-2"><a href="#L-2"><span class="linenos">2</span></a>
94-
</span><span id="L-3"><a href="#L-3"><span class="linenos">3</span></a><span class="kn">from</span> <span class="nn">.enforcer</span> <span class="kn">import</span> <span class="n">Enforcer</span><span class="p">,</span> <span class="n">FunctionMethodEnforcer</span>
94+
</span><span id="L-3"><a href="#L-3"><span class="linenos">3</span></a><span class="kn">from</span><span class="w"> </span><span class="nn">.enforcer</span><span class="w"> </span><span class="kn">import</span> <span class="n">Enforcer</span><span class="p">,</span> <span class="n">FunctionMethodEnforcer</span>
9595
</span></pre></div>
9696

9797

0 commit comments

Comments
 (0)