task: metadata: install: pip install -e .[dev]
patch: diff --git a/examples/basic_usage.py b/examples/basic_usage.py
index 4492786..8c70521 100644
--- a/examples/basic_usage.py
+++ b/examples/basic_usage.py
@@ -1,5 +1,3 @@
-import pathlib
-
 from puzzle_generator.create_puzzle import create
 
 _PUZZLE = {
@@ -12,4 +10,4 @@ _PUZZLE = {
     },
 }
 
-create(_PUZZLE, pathlib.Path("example_puzzle.py"))
+print(create(_PUZZLE))
diff --git a/puzzle_generator/create_puzzle.py b/puzzle_generator/create_puzzle.py
index 890ac6c..902f1b6 100644
--- a/puzzle_generator/create_puzzle.py
+++ b/puzzle_generator/create_puzzle.py
@@ -1,4 +1,3 @@
-import pathlib
 import hashlib
 import inspect
 import sys
@@ -155,7 +154,7 @@ def _get_configurator(**kwargs):
     return configurators[encryption](**kwargs)
 
 
-def create(in_puzzle, output_path: pathlib.Path, **kwargs) -> None:
+def create(in_puzzle, **kwargs) -> str:
     configurator = _get_configurator(**kwargs)
 
     encrypted_puzzle = encrypt_data(in_puzzle, configurator.get_encrypt())
@@ -164,7 +163,4 @@ def create(in_puzzle, output_path: pathlib.Path, **kwargs) -> None:
     needed_objects = configurator.get_needed_objects()
     constants_str = configurator.get_constants_str()
 
-    with open(output_path, "w", encoding="utf-8") as res_file:
-        res_file.write(
-            _create_str(needed_modules, needed_objects, encrypted_puzzle, constants_str)
-        )
+    return _create_str(needed_modules, needed_objects, encrypted_puzzle, constants_str)
diff --git a/pyproject.toml b/pyproject.toml
index bd15b58..6914a8d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
 [tool.poetry]
 name = "puzzle-generator"
-version = "0.4.2"
+version = "0.5.0"
 description = "Generates python code representing a puzzle"
 authors = ["piotr.idzik <vil02_puzzle_generator@10g.pl>"]
 readme = "./puzzle_generator/README.md"

problem_statement: `puzzle_generator.create` should return a string
The function [`puzzle_generator.create`](https://github.com/vil02/puzzle_generator/blob/7411abad3b635671bda9dbcde058f38e656aa9a1/puzzle_generator/create_puzzle.py#L44) should return a string. This will also require an update of the [`examples`](https://github.com/vil02/puzzle_generator/tree/master/examples) and [`test_create_puzzle.py`](https://github.com/vil02/puzzle_generator/blob/7411abad3b635671bda9dbcde058f38e656aa9a1/tests/test_create_puzzle.py).
repo: vil02/puzzle_generator
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/tests/test_create_puzzle.py b/tests/test_create_puzzle.py
index 90b36ee..adf5830 100644
--- a/tests/test_create_puzzle.py
+++ b/tests/test_create_puzzle.py
@@ -73,6 +73,14 @@ def _run_puzzle_file(
     )
 
 
+def _run_puzzle_str(
+    in_puzzle_str: str, answers: list[str], in_puzzle_path: pathlib.Path
+) -> subprocess.CompletedProcess[str]:
+    with open(in_puzzle_path, "w", encoding="utf-8") as puzzle_file:
+        puzzle_file.write(in_puzzle_str)
+    return _run_puzzle_file(in_puzzle_path, answers)
+
+
 _CONFIGURATIONS = [
     {},
     {"proc_hasher": hashlib.md5},
@@ -101,8 +109,8 @@ def test_all_good_answers(
     puzzle_path: pathlib.Path,
     configuration,
 ) -> None:
-    cp.create(puzzle_tc.puzzle, puzzle_path, **configuration)
-    res = _run_puzzle_file(puzzle_path, puzzle_tc.correct.input)
+    puzzle_str = cp.create(puzzle_tc.puzzle, **configuration)
+    res = _run_puzzle_str(puzzle_str, puzzle_tc.correct.input, puzzle_path)
 
     assert res.returncode == 0
     assert res.stdout == puzzle_tc.correct.output
@@ -116,8 +124,8 @@ def test_wrong_answers(
     configuration,
 ) -> None:
     for cur_wrong in puzzle_tc.wrong:
-        cp.create(puzzle_tc.puzzle, puzzle_path, **configuration)
-        res = _run_puzzle_file(puzzle_path, cur_wrong.input)
+        puzzle_str = cp.create(puzzle_tc.puzzle, **configuration)
+        res = _run_puzzle_str(puzzle_str, cur_wrong.input, puzzle_path)
         assert res.returncode == 1
         assert res.stdout == cur_wrong.output
         assert not res.stderr