You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/gettingstarted.rst
+20-2Lines changed: 20 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,25 @@ If you believe you have discovered a bug, please review the :ref:`Contributing G
73
73
Using Basilisp in a Project
74
74
---------------------------
75
75
76
+
.. _project_template:
77
+
78
+
Project Template
79
+
^^^^^^^^^^^^^^^^
80
+
81
+
Basilisp has a `Leiningen project template <https://github.com/basilisp-lang/lein-template-basilisp>`_ which can be used to create a new project.
82
+
83
+
.. code-block::
84
+
85
+
lein new org.basilisp/basilisp myproject
86
+
87
+
The template uses ``pip`` as the default dependency management tool.
88
+
This is not meant to be prescriptive, but rather to enable users to get setup with minimum effort since most Python installations ship with ``pip`` by default.
89
+
The generated project works with ``uv`` without any changes.
90
+
91
+
.. note::
92
+
93
+
The template handles :ref:`bootstrapping` for you.
94
+
76
95
.. _project_structure:
77
96
78
97
Project Structure
@@ -89,7 +108,6 @@ Basilisp source files should always have a ``.lpy`` extension.
89
108
90
109
.
91
110
├── README.md
92
-
├── poetry.lock
93
111
├── pyproject.toml
94
112
├── src
95
113
│ └── myproject
@@ -108,7 +126,7 @@ Basilisp source files should always have a ``.lpy`` extension.
108
126
A single ``__init__.py`` file may be required for running tests with Pytest -- see :ref:`testing_path` for more information.
109
127
110
128
Basilisp apps can use any of Python's myriad dependency management options, such as `pip <https://pip.pypa.io/en/stable/>`_, `uv <https://docs.astral.sh/uv/>`_, `Poetry <https://python-poetry.org/>`_, and many others.
111
-
Basilisp itself uses Poetry and that is the recommended dependency management tool for new Basilisp projects.
Copy file name to clipboardExpand all lines: docs/testing.rst
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,7 +86,7 @@ In this case, the test namespace can start at ``myproject``:
86
86
(ns myproject.core-test)
87
87
88
88
89
-
However, the ``test`` directory must be explicitly added to the ``PYTHONPATH`` using the ``--include-path`` (or ``-p``) option when running the tests:
89
+
However, the ``test`` directory must be explicitly added to the ``PYTHONPATH`` using the ``--include-path`` (or ``-p`` or the ``PYTHONPATH`` environment variable) option when running the tests:
90
90
91
91
.. code-block:: shell
92
92
@@ -99,6 +99,14 @@ However, the ``test`` directory must be explicitly added to the ``PYTHONPATH`` u
99
99
In the first example above (``tests``, a Python convention), the top-level directory is already in the ``PYTHONPATH``, allowing ``tests.myproject.core-test`` to be resolvable.
100
100
In the second example (``test``, a Clojure convention), the test directory is explicitly added to the ``PYTHONPATH``, enabling ``myproject.core-test`` to be resolvable.
101
101
102
+
.. warning::
103
+
104
+
In versions of Basilisp prior to v0.5.1, you will also want to specify ``--include-unsafe-path=false`` to disable Python prepending the empty string ``""`` (meaning the current directory) to the path.
105
+
Without this, PyTest will attempt to collect your namespace from ``./test`` first, which will attempt to import your test namespaces as ``test.{namespace}``, which will fail collection.
106
+
107
+
After version v0.5.1, ``basilisp test`` automatically prepends ``tests`` and ``test`` (if either exist) to the ``PYTHONPATH``.
108
+
You can disable this behavior by passing ``--include-default-test-path=false`` or ``-d false``.
0 commit comments