Skip to content

Commit fa5da10

Browse files
authored
Change the default user namespace to basilisp.user (#466)
* Change the default user namespace to `basilisp.user` * MyPy and PyLint working against each other ultimately just hurts me
1 parent 91e9437 commit fa5da10

File tree

9 files changed

+228
-212
lines changed

9 files changed

+228
-212
lines changed

.prospector.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,18 @@ pep8:
2020
options:
2121
max-line-length: 120
2222

23+
pyflakes:
24+
disable:
25+
- F821
26+
2327
pylint:
2428
disable:
29+
- import-outside-toplevel
2530
- len-as-condition
31+
- logging-format-interpolation
2632
- logging-fstring-interpolation
33+
- no-else-continue
34+
- no-else-raise
2735
- no-else-return
2836
- protected-access
2937
- unsubscriptable-object

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Changed
9+
* Change the default user namespace to `basilisp.user` (#466)
810

911
## [v0.1.dev12] - 2020-01-26
1012
### Added

Pipfile.lock

Lines changed: 159 additions & 156 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/gettingstarted.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ Once Basilisp is installed, you can enter into the REPL using::
1313
In Basilisp's REPL, you now have the full power of Basilisp at your disposal.
1414
It is customary to write a ``Hello, World!`` when starting out in a new language, so we'll do that here::
1515

16-
user=> (print "Hello, World!")
16+
basilisp.user=> (print "Hello, World!")
1717
Hello, World!
1818
nil
1919

2020
Or perhaps you'd like to try something a little more exciting, like performing some arithmetic::
2121

22-
user=> (+ 1 2 3 4 5)
22+
basilisp.user=> (+ 1 2 3 4 5)
2323
15
2424

2525
Sequences are a little more fun than simple arithmetic::
2626

27-
user=> (filter odd? (map inc (range 1 10)))
27+
basilisp.user=> (filter odd? (map inc (range 1 10)))
2828
(3 5 7 9 11)
2929

3030
There is a ton of great functionality built in to Basilisp, so feel free to poke around.

docs/reader.rst

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ Integers
2424

2525
::
2626

27-
user=> 1
27+
basilisp.user=> 1
2828
1
29-
user=> (builtins/type 1)
29+
basilisp.user=> (builtins/type 1)
3030
<class 'int'>
31-
user=> 1N
31+
basilisp.user=> 1N
3232
1
33-
user=> (builtins/type 1N)
33+
basilisp.user=> (builtins/type 1N)
3434
<class 'int'>
3535

3636
Integers are represented using numeric ``0-9`` and may be prefixed with any number of negative signs ``-``.
@@ -43,13 +43,13 @@ Floating Point
4343

4444
::
4545

46-
user=> 1.0
46+
basilisp.user=> 1.0
4747
1.0
48-
user=> (builtins/type 1.0)
48+
basilisp.user=> (builtins/type 1.0)
4949
<class 'float'>
50-
user=> 1M
50+
basilisp.user=> 1M
5151
1
52-
user=> (builtins/type 1M)
52+
basilisp.user=> (builtins/type 1M)
5353
<class 'decimal.Decimal'>
5454

5555
Floating point values are represented using ``0-9`` and a trailing decimal value, separated by a ``.`` character.
@@ -63,13 +63,13 @@ Complex
6363

6464
::
6565

66-
user=> 1J
66+
basilisp.user=> 1J
6767
1J
68-
user=> (builtins/type 1J)
68+
basilisp.user=> (builtins/type 1J)
6969
<class 'complex'>
70-
user=> 1.0J
70+
basilisp.user=> 1.0J
7171
1J
72-
user=> (builtins/type 1.0J)
72+
basilisp.user=> (builtins/type 1.0J)
7373
<class 'complex'>
7474

7575
Basilisp includes support for complex literals to match the Python VM hosts it.
@@ -83,11 +83,11 @@ Strings
8383

8484
::
8585

86-
user=> ""
86+
basilisp.user=> ""
8787
""
88-
user=> "this is a string"
88+
basilisp.user=> "this is a string"
8989
"this is a string"
90-
user=> (builtins/type "")
90+
basilisp.user=> (builtins/type "")
9191
<class 'str'>
9292

9393
Strings are denoted as a series of characters enclosed by ``"`` quotation marks.
@@ -102,11 +102,11 @@ Character Literals
102102

103103
::
104104

105-
user=> \a
105+
basilisp.user=> \a
106106
"a"
107-
user=> \u03A9
107+
basilisp.user=> \u03A9
108108
"Ω"
109-
user=> \newline
109+
basilisp.user=> \newline
110110
"
111111
"
112112

@@ -126,13 +126,13 @@ Boolean Values
126126

127127
::
128128

129-
user=> true
129+
basilisp.user=> true
130130
true
131-
user=> (builtins/type true)
131+
basilisp.user=> (builtins/type true)
132132
<class 'bool'>
133-
user=> false
133+
basilisp.user=> false
134134
false
135-
user=> (builtins/type false)
135+
basilisp.user=> (builtins/type false)
136136
<class 'bool'>
137137

138138
The special values ``true`` and ``false`` correspond to Python's ``True`` and ``False`` respectively.
@@ -144,9 +144,9 @@ nil
144144

145145
::
146146

147-
user=> nil
147+
basilisp.user=> nil
148148
nil
149-
user=> (builtins/type nil)
149+
basilisp.user=> (builtins/type nil)
150150
<class 'NoneType'>
151151

152152
The special value ``nil`` correspond's to Python's ``None``.
@@ -167,9 +167,9 @@ Symbols
167167

168168
::
169169

170-
user=> 'sym
170+
basilisp.user=> 'sym
171171
sym
172-
user=> 'namespaced/sym
172+
basilisp.user=> 'namespaced/sym
173173
namespaced/sym
174174

175175
Symbolic identifiers, most often used to refer to a Var or value in Basilisp.
@@ -184,9 +184,9 @@ Keywords
184184

185185
::
186186

187-
user=> :keyword
187+
basilisp.user=> :keyword
188188
:keyword
189-
user=> :namespaced/keyword
189+
basilisp.user=> :namespaced/keyword
190190
:namespaced/keyword
191191

192192
Keywords are denoted by the ``:`` prefix character.
@@ -204,9 +204,9 @@ Lists
204204

205205
::
206206

207-
user=> ()
207+
basilisp.user=> ()
208208
()
209-
user=> '(1 "2" :three)
209+
basilisp.user=> '(1 "2" :three)
210210
(1 "2" :three)
211211

212212
Lists are denoted with the ``()`` characters.
@@ -221,9 +221,9 @@ Vectors
221221

222222
::
223223

224-
user=> []
224+
basilisp.user=> []
225225
[]
226-
user=> [1 "2" :three]
226+
basilisp.user=> [1 "2" :three]
227227
[1 "2" :three]
228228

229229
Vectors are denoted with the ``[]`` characters.
@@ -237,9 +237,9 @@ Maps
237237

238238
::
239239

240-
user=> {}
240+
basilisp.user=> {}
241241
{}
242-
user=> {1 "2" :three 3}
242+
basilisp.user=> {1 "2" :three 3}
243243
{1 "2" :three 3}
244244

245245
Maps are denoted with the ``{}`` characters.
@@ -253,9 +253,9 @@ Sets
253253

254254
::
255255

256-
user=> #{}
256+
basilisp.user=> #{}
257257
#{}
258-
user=> #{1 "2" :three}
258+
basilisp.user=> #{1 "2" :three}
259259
#{1 "2" :three}
260260

261261
Sets are denoted with the ``#{}`` characters.
@@ -277,11 +277,11 @@ Metadata
277277

278278
::
279279

280-
user=> (meta '^:macro s)
280+
basilisp.user=> (meta '^:macro s)
281281
{:macro true}
282-
user=> (meta '^str s)
282+
basilisp.user=> (meta '^str s)
283283
{:tag str}
284-
user=> (meta '^{:has-meta true} s)
284+
basilisp.user=> (meta '^{:has-meta true} s)
285285
{:has-meta true}
286286

287287
Metadata can be applied to the following form by specifying metadata before the form as ``^meta form``.

src/basilisp/lang/compiler/analyzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ def _def_ast( # pylint: disable=too-many-branches,too-many-locals
729729
# :file "<REPL Input>"
730730
# :line 1
731731
# :name 'some-name
732-
# :ns ((.- basilisp.lang.runtime/Namespace get) 'user)}
732+
# :ns ((.- basilisp.lang.runtime/Namespace get) 'basilisp.user)}
733733
# some-name
734734
# "some value")
735735
meta_ast = _analyze_form(

src/basilisp/lang/runtime.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
CORE_NS = "basilisp.core"
5858
NS_VAR_NAME = "*ns*"
5959
NS_VAR_NS = CORE_NS
60-
REPL_DEFAULT_NS = "user"
60+
REPL_DEFAULT_NS = "basilisp.user"
6161

6262
# Private string constants
6363
_GENERATED_PYTHON_VAR_NAME = "*generated-python*"
@@ -661,14 +661,15 @@ def is_match(entry: Tuple[sym.Symbol, Any]) -> bool:
661661

662662
return is_match
663663

664+
# pylint: disable=unnecessary-comprehension
664665
def __complete_alias(
665666
self, prefix: str, name_in_ns: Optional[str] = None
666667
) -> Iterable[str]:
667668
"""Return an iterable of possible completions matching the given
668669
prefix from the list of aliased namespaces. If name_in_ns is given,
669670
further attempt to refine the list to matching names in that namespace."""
670671
candidates = filter(
671-
Namespace.__completion_matcher(prefix), [(s, n) for s, n in self.aliases]
672+
Namespace.__completion_matcher(prefix), ((s, n) for s, n in self.aliases)
672673
)
673674
if name_in_ns is not None:
674675
for _, candidate_ns in candidates:
@@ -707,6 +708,7 @@ def __complete_imports_and_aliases(
707708
for candidate_name, _ in candidates:
708709
yield f"{candidate_name}/"
709710

711+
# pylint: disable=unnecessary-comprehension
710712
def __complete_interns(
711713
self, value: str, include_private_vars: bool = True
712714
) -> Iterable[str]:
@@ -722,16 +724,17 @@ def is_match(entry: Tuple[sym.Symbol, Var]) -> bool:
722724

723725
return map(
724726
lambda entry: f"{entry[0].name}",
725-
filter(is_match, [(s, v) for s, v in self.interns]),
727+
filter(is_match, ((s, v) for s, v in self.interns)),
726728
)
727729

730+
# pylint: disable=unnecessary-comprehension
728731
def __complete_refers(self, value: str) -> Iterable[str]:
729732
"""Return an iterable of possible completions matching the given
730733
prefix from the list of referred Vars."""
731734
return map(
732735
lambda entry: f"{entry[0].name}",
733736
filter(
734-
Namespace.__completion_matcher(value), [(s, v) for s, v in self.refers]
737+
Namespace.__completion_matcher(value), ((s, v) for s, v in self.refers)
735738
),
736739
)
737740

tests/basilisp/cli_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@ class TestREPL:
1515
def test_no_input(self):
1616
runner = CliRunner()
1717
result = runner.invoke(cli, ["repl"], input="")
18-
assert "user=> " == result.stdout
18+
assert "basilisp.user=> " == result.stdout
1919

2020
def test_newline(self):
2121
runner = CliRunner()
2222
result = runner.invoke(cli, ["repl"], input="\n")
23-
assert "user=> user=> " == result.stdout
23+
assert "basilisp.user=> basilisp.user=> " == result.stdout
2424

2525
def test_simple_expression(self):
2626
runner = CliRunner()
2727
result = runner.invoke(cli, ["repl"], input="(+ 1 2)")
28-
assert "user=> 3\nuser=> " == result.stdout
28+
assert "basilisp.user=> 3\nbasilisp.user=> " == result.stdout
2929

3030
def test_syntax_error(self):
3131
runner = CliRunner()
3232
result = runner.invoke(cli, ["repl"], input="(+ 1 2")
3333
assert (
34-
"basilisp.lang.reader.SyntaxError: Unexpected EOF in list\nuser=> "
34+
"basilisp.lang.reader.SyntaxError: Unexpected EOF in list\nbasilisp.user=> "
3535
in result.stdout
3636
)
3737

@@ -40,15 +40,15 @@ def test_compiler_error(self):
4040
result = runner.invoke(cli, ["repl"], input="(fn*)")
4141
assert (
4242
"basilisp.lang.compiler.exception.CompilerException: fn form "
43-
"must match: (fn* name? [arg*] body*) or (fn* name? method*)\nuser=> "
43+
"must match: (fn* name? [arg*] body*) or (fn* name? method*)\nbasilisp.user=> "
4444
) in result.stdout
4545

4646
def test_other_exception(self):
4747
runner = CliRunner()
4848
result = runner.invoke(
4949
cli, ["repl"], input='(throw (python/Exception "CLI test"))'
5050
)
51-
assert "Exception: CLI test\nuser=> " in result.stdout
51+
assert "Exception: CLI test\nbasilisp.user=> " in result.stdout
5252

5353

5454
class TestRun:

tox.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ parallel_show_output = {env:TOX_SHOW_OUTPUT:true}
66
setenv =
77
BASILISP_DO_NOT_CACHE_NAMESPACES = true
88
deps =
9-
coverage==4.5.4
9+
coverage
1010
six==1.10.0
1111
commands =
1212
coverage run \
@@ -20,7 +20,7 @@ commands =
2020
depends = py36, py37, py38
2121
deps =
2222
coveralls
23-
coverage==4.5.4
23+
coverage
2424
six==1.10.0
2525
passenv =
2626
COVERALLS_REPO_TOKEN
@@ -63,7 +63,7 @@ commands =
6363
mypy --config-file={toxinidir}/mypy.ini --show-error-codes src/basilisp
6464

6565
[testenv:lint]
66-
deps = prospector==1.1.6.2
66+
deps = prospector==1.2.0
6767
commands =
6868
prospector --profile-path={toxinidir}
6969

0 commit comments

Comments
 (0)