Skip to content

Commit aed943e

Browse files
committed
Forward general documentation to the wiki
1 parent 9d6fa23 commit aed943e

File tree

7 files changed

+7
-897
lines changed

7 files changed

+7
-897
lines changed

docs/building.md

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1 @@
1-
# Building IronPython3
2-
3-
To build IronPython3 you will need the [.NET SDK (minimum v6.0.100)](https://dotnet.microsoft.com/download/visual-studio-sdks).
4-
5-
See [Getting the Sources](getting-the-sources.md) for information on getting the source for IronPython3.
6-
7-
## Building from Visual Studio
8-
9-
Visual Studio 2022 v17.0 or above is required to build IronPython3.
10-
11-
* Open the `IronPython.sln` solution file
12-
* Select the configuration options (Release, Debug, etc.)
13-
* Press Ctrl+Shift+B or F6 to build the solution
14-
15-
## Building from the command line
16-
17-
IronPython3 uses PowerShell to run the build and testing from the command line. You can either use a PowerShell directly, or prefix the commands below with `powershell` on Windows, or `pwsh` on Linux/macOS.
18-
19-
On Linux/macOS you will need to install [PowerShell](https://github.com/PowerShell/PowerShell/releases)
20-
21-
Change the working directory to the path where you cloned the sources and run `./make.ps1`
22-
23-
By default, with no options, `make.ps1` will build the `Release` mode binaries. If you would like to build `Debug` binaries, you can run `./make.ps1 debug`
24-
25-
Other options available for `make.ps1` are
26-
27-
```
28-
-configuration (debug/release) The configuration to build for
29-
-platform (x86/x64) The platform to use in running tests
30-
-runIgnored Run tests that are marked as ignored in the .ini manifests
31-
-frameworks A comma separated list of frameworks to run tests for
32-
(use nomenclature as is used in msbuild files for TargetFrameworks)
33-
```
34-
35-
There are also other targets available for use with packaging and testing, most come in debug and release (default) versions, such as `package-debug` and `package`
36-
37-
```
38-
package Creates packages supported by the current platform
39-
stage Stages files ready for packaging
40-
test-* Runs tests from `all` categories, `ironpython` specific tests,
41-
`cpython` tests from the CPython stdlib test suite
42-
```
43-
44-
If the build is successful the binaries are stored in `ironpython3/bin/{Configuration}/{TargetFramework}`.
45-
46-
## Running
47-
48-
The standard library is not copied over to the `bin` folder during the build process, it lives in `src/core/IronPython.StdLib/lib`.
49-
- When running the `Release` configuration executable, you should set the environment variable `IRONPYTHONPATH` to this folder.
50-
- When running the `Debug` configuration executable, this folder is automatically added to `sys.path`.
1+
This document has been moved to the IronPython wiki: [Building](https://github.com/IronLanguages/ironpython3/wiki/Building)

docs/differences-from-c-python.md

Lines changed: 1 addition & 269 deletions
Original file line numberDiff line numberDiff line change
@@ -1,269 +1 @@
1-
This page documents various differences between IronPython and CPython. Since IronPython is under active development, any of the differences described here may change or disappear in the future:
2-
3-
- [Environment Variables](#environment-variables)
4-
- [COM Interaction](#com-interaction)
5-
- [Strings](#strings)
6-
- [Interaction with the Operating System](#interaction-with-the-operating-system)
7-
- [Codecs](#codecs)
8-
- [Source File Encoding](#source-file-encoding)
9-
- [Recursion](#recursion)
10-
11-
# Environment Variables
12-
13-
* `IRONPYTHONSTARTUP` is used instead of `PYTHONSTARTUP`
14-
15-
* `IRONPYTHONPATH` is used instead of `PYTHONPATH`
16-
17-
# COM Interaction
18-
19-
* Interaction with COM objects is handled by the CLR rather than a python library binding to the native COM dlls.
20-
21-
# Strings
22-
23-
* `str` objects are represented in UTF-16 (like all .NET strings) rather than UTF-32 used by CPython.
24-
25-
This has a few visible consequences if characters ouside of the Basic Multilingual Plane (BMP) are used (that is, characters with Unicode code points above `U+FFFF`). A few examples below illustrate the differences.
26-
27-
Let's take a Unicode character U+1F70B, '🜋'. In CPython, it is represented by a single character:
28-
29-
_CPython_
30-
```
31-
>>> len('\U0001f70b')
32-
1
33-
>>> str('\U0001f70b')
34-
'🜋'
35-
```
36-
37-
In IronPython, it is represented by a pair of surrogate characters U+D83D and U+DF0B:
38-
39-
_IronPython_
40-
```
41-
>>> len('\U0001f70b')
42-
2
43-
>>> str('\U0001f70b')
44-
'\ud83d\udf0b'
45-
```
46-
47-
In **both** cases, however, the string containing such character is printed out correctly, since `print` will transcode the string from its internal representation to whichever encoding is used by the console or file (usually UTF-8):
48-
49-
_CPython_ and _IronPython_
50-
```
51-
print('\U0001f70b')
52-
'🜋'
53-
```
54-
55-
Any surrogate pair in IronPython strings represents one logical character. CPython, however, sees a surrogate pair as two invalid characters.
56-
57-
_IronPython_
58-
```
59-
>>> '\ud83d\udf0b'
60-
'\ud83d\udf0b'
61-
>>> print('\ud83d\udf0b')
62-
🜋
63-
>>> '\ud83d\udf0b'.encode('utf-8')
64-
b'\xf0\x9f\x9c\x8b'
65-
>>> '\U0001f70b'.encode('utf-8')
66-
b'\xf0\x9f\x9c\x8b'
67-
```
68-
69-
_CPython_
70-
```
71-
>>> '\ud83d\udf0b'
72-
'\ud83d\udf0b'
73-
>>> print('\ud83d\udf0b')
74-
Traceback (most recent call last):
75-
File "<stdin>", line 1, in <module>
76-
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 0-1: surrogates not allowed
77-
'\ud83d\udf0b'.encode('utf-8')
78-
Traceback (most recent call last):
79-
File "<stdin>", line 1, in <module>
80-
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 0-1: surrogates not allowed
81-
```
82-
83-
CPython requires use of `'surrogatepass'` error handler to let those pairs through. Note however, that they are still being treated as two separate characters. IronPython encodes the pair as if it were one character.
84-
85-
_CPython_
86-
```
87-
>>> '\ud83d\udf0b'.encode('utf-8','surrogatepass')
88-
b'\xed\xa0\xbd\xed\xbc\x8b'
89-
>>> '\U0001f70b'.encode('utf-8')
90-
b'\xf0\x9f\x9c\x8b'
91-
```
92-
93-
The `'surrogatepass'` error handler is still needed in IronPython to handle surrogate characters that do not form a valid surrogate pair:
94-
95-
_IronPython_
96-
```
97-
print('\ud83d\udf0b')
98-
🜋
99-
>>> print('\ud83d\udf0b'[::-1])
100-
Traceback (most recent call last):
101-
File "<stdin>", line 1, in <module>
102-
UnicodeEncodeError: 'cp65001' codec can't encode character '\udf0b' in position 0: Unable to translate Unicode character \\uDF0B at index 0 to specified code page.
103-
>>> print('\ud83d\udf0b'[::-1].encode('utf-8','surrogatepass'))
104-
b'\xed\xbc\x8b\xed\xa0\xbd'
105-
```
106-
107-
_CPython_
108-
```
109-
>>> print('\ud83d\udf0b')
110-
Traceback (most recent call last):
111-
File "<stdin>", line 1, in <module>
112-
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 0-1: surrogates not allowed
113-
>>> print('\ud83d\udf0b'[::-1])
114-
Traceback (most recent call last):
115-
File "<stdin>", line 1, in <module>
116-
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 0-1: surrogates not allowed
117-
>>> print('\ud83d\udf0b'[::-1].encode('utf-8','surrogatepass'))
118-
b'\xed\xbc\x8b\xed\xa0\xbd'
119-
```
120-
121-
# Interaction with the Operating System
122-
123-
* Environment variables are decoded using the `'replace'` error handler, rather than the `'surrogateescape'` error handler used by CPython.
124-
125-
This is how .NET libraries handle encoding errors in the system. The difference is only visible on Posix systems that have environment variables defined using a different encoding than the encoding used by the system (Windows environment variables are always in UTF-16, so no conversion takes place when accessed as Python `str` objects).
126-
127-
Assume that a Linux system is configured to use UTF-8. Under bash:
128-
129-
```
130-
$ python -c 'f=open("test.sh","w",encoding="latin-1");print("NAME=\"André\"",file=f)'
131-
$ source test.sh
132-
$ export NAME
133-
```
134-
135-
This creates an environment variable that is encoded using Latin-1 encoding, rather than the system encoding. CPython will escape the invalid byte 0xe9 (letter 'é' in Latin-1) in a lone surrogate 0xdce9, which is still an invalid Unicode character.
136-
137-
_CPython_
138-
```
139-
>>> import os
140-
>>> os.environ["NAME"]
141-
'Andr\udce9'
142-
>>> print(os.environ["NAME"])
143-
Traceback (most recent call last):
144-
File "<stdin>", line 1, in <module>
145-
UnicodeEncodeError: 'utf-8' codec can't encode character '\udce9' in position 4: surrogates not allowed
146-
```
147-
148-
IronPython will replace the invalid byte with U+FFFD, the Unicode replacement character, which is a valid and printable character.
149-
150-
_IronPython_
151-
```
152-
>>> import os
153-
>>> os.environ["NAME"]
154-
'Andr�'
155-
>>> print(os.environ["NAME"])
156-
Andr�
157-
>>> hex(ord(os.environ["NAME"][-1]))
158-
'0xfffd'
159-
```
160-
161-
The CPython representation is not printable, but can be safely encoded back to the original form using `'surrogateescape'` (default when dealing with the OS environment):
162-
163-
_CPython_
164-
```
165-
>>> os.environ["PATH"] = os.environ["PATH"] + ":/home/" + os.environ["NAME"] + "/bin"
166-
>>> import posix
167-
>>> posix.environ[b"PATH"]
168-
b'/bin:/usr/bin:/usr/local/bin:/home/Andr\xe9/bin'
169-
>>> os.environ["NAME"].encode("utf-8","surrogateescape")
170-
b'Andr\xe9'
171-
```
172-
173-
The IronPython representation is printable, but the original byte value is lost:
174-
175-
_IronPython_
176-
```
177-
>>> os.environ["NAME"].encode("utf-8","surrogateescape")
178-
b'Andr\xef\xbf\xbd'
179-
```
180-
181-
# Codecs
182-
183-
* Some single-byte codecs may have unused positions in their codepage. There are differences between how CPython and IronPython (and .NET) handle such cases.
184-
185-
A simple example is encoding Windows-1252. According to the information on Microsoft's and the Unicode Consortium's websites, positions 81, 8D, 8F, 90, and 9D are unused; however, the Windows API `MultiByteToWideChar` maps these to the corresponding C1 control codes. The Unicode "best fit" mapping [documents this behavior](https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit1252.txt). CPython will treat those bytes as invalid, while IronPython will map them to the "best fit" Unicode character:
186-
187-
_CPython_
188-
```
189-
>>> b'\x81'.decode('windows-1252')
190-
Traceback (most recent call last):
191-
File "<stdin>", line 1, in <module>
192-
File "/opt/anaconda3/envs/py34/lib/python3.4/encodings/cp1252.py", line 15, in decode
193-
return codecs.charmap_decode(input,errors,decoding_table)
194-
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 0: character maps to <undefined>
195-
>>> b'\x81'.decode('windows-1252','surrogateescape')
196-
'\udc81'
197-
```
198-
199-
_IronPython_
200-
```
201-
>>> b'\x81'.decode('windows-1252')
202-
'\x81'
203-
>>> b'\x81'.decode('windows-1252','surrogateescape')
204-
'\x81'
205-
```
206-
207-
The same difference in behavior can be observed during encoding:
208-
209-
_CPython_
210-
```
211-
>>> '\x81'.encode('windows-1252')
212-
Traceback (most recent call last):
213-
File "<stdin>", line 1, in <module>
214-
File "/opt/anaconda3/envs/py34/lib/python3.4/encodings/cp1252.py", line 12, in encode
215-
return codecs.charmap_encode(input,errors,encoding_table)
216-
UnicodeEncodeError: 'charmap' codec can't encode character '\x81' in position 0: character maps to <undefined>
217-
```
218-
219-
_IronPython_
220-
```
221-
>>> '\x81'.encode('windows-1252')
222-
b'\x81'
223-
```
224-
225-
* When using the UTF-7 encoding, IronPython (and .NET) always terminates the modified Base64 encoded blocks with a '-' while CPython omits the '-' if allowed.
226-
227-
The UTF-7 standard allows encoders for some freedom of implementation. One optionality allowed in UTF-7 is how to end a sequence encoded in the modified Base64 code. In principle, `+` marks the start of the sequence, and `-` is the terminator. However, it is allowed to omit the terminating `-` if the next character unambiguously does not belong to the encoded Base64 block. CPython chooses to drop the terminating `-` in such cases, while IronPython will always terminate Base64-encoded blocks with a `-`:
228-
229-
_CPython_
230-
```
231-
>>> 'abc:~~:zyz'.encode('utf-7')
232-
b'abc:+AH4Afg:zyz'
233-
```
234-
235-
_IronPython_
236-
```
237-
>>> 'abc:~~:zyz'.encode('utf-7')
238-
b'abc:+AH4Afg-:zyz'
239-
```
240-
241-
Note that both forms are fully interchangeable; IronPython will correctly decode what CPython encoded and vice versa.
242-
243-
# Source File Encoding
244-
245-
* Widechar Unicode encodings are supported as source file encoding, in addition to standard Python encodings.
246-
247-
The default source file encoding is UTF-8. This also applies to bytestrings used within the program (processed by `compile`, `eval`, or `exec`). The source file encoding can be explicitly specified, and possibly changed, in one of the two ways:
248-
249-
1. By declaring the encoding in a Python comment in one of the first two lines — in accordance with [PEP-263](https://www.python.org/dev/peps/pep-0263/).
250-
2. By a byte-order-mark (BOM) — only for Unicode encodings.
251-
252-
CPython recognizes only UTF-8 BOM. IronPython recognizes BOM in UTF-8, UTF-16LE, UTF-16BE, UTF-32LE, and UTF-32BE.
253-
254-
If both BOM and PEP-263 methods are used simultaneously in the same file, they should be specifying the same encoding. If the PEP-263 encoding does not match the BOM, then:
255-
256-
* In case of UTF-8 BOM, an error will be reported (by both CPython and IronPython).
257-
* In case of other BOMs, the encoding specified in the PEP-263 comment is silently ignored.
258-
259-
# Recursion
260-
261-
By default, instead of raising a `RecursionError` when the maximum recursion depth is reached, IronPython will terminate with a `StackOverflowException`. You can enable the recursion limit in IronPython in a number of ways:
262-
263-
1. From the command line: `ipy -X MaxRecursion=100`.
264-
2. In hosted scenarios: `Python.CreateEngine(new Dictionary<string, object>() { { "RecursionLimit", 100 } });`.
265-
3. From Python: `sys.setrecursionlimit(100)`.
266-
267-
*There is a significant performance cost when the recursion limit is enabled*.
268-
269-
Note that IronPython 3.4 adopts the CPython 3.5 behavior and throws a `RecursionError` instead of a `RuntimeError`.
1+
This document has been moved to the IronPython wiki: [Differences from CPython](https://github.com/IronLanguages/ironpython3/wiki/Differences-from-CPython)

docs/getting-the-sources.md

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1 @@
1-
The main IronPython3 git repository is at [http://github.com/IronLanguages/ironpython3](http://github.com/IronLanguages/ironpython3).
2-
3-
## Downloading the sources
4-
5-
You can [download a zipped copy](http://github.com/IronLanguages/ironpython3/zipball/main) of the latest IronPython3 sources as well.
6-
7-
### Installing GIT
8-
9-
The following links include resources for installing and using GIT:
10-
* [GitHub guides](http://help.github.com/)
11-
* [GIT documentation](http://www.kernel.org/pub/software/scm/git/docs/git.html) - If you have never used GIT, reading the [tutorial](http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html) first will be a big help to finding your way around.
12-
* [Cheat sheet](http://cheat.errtheblog.com/s/git) - Quick reference for commonly used commands
13-
* [Collaborative Github Workflow](http://www.eqqon.com/index.php/Collaborative_Github_Workflow) - very good description of the workflow and tips and tricks when contributing to a project hosted on GitHub.
14-
* [Jimmy's Cheatsheet](http://tinyurl.com/jimmygitcheat)
15-
16-
### Creating a local GIT repository
17-
18-
You will first need to fork the IronPython3 project. [Creating a fork](https://help.github.com/fork-a-repo/) is recommended as it will allow you to contribute patches back easily. Click the "Fork" button on [https://github.com/IronLanguages/ironpython3/](https://github.com/IronLanguages/ironpython3/). This should create your personal fork, with a web URL like http://github.com/janedoe/ironpython3 (where janedoe is your github username).
19-
20-
You can now use the git command-line client with many Linux distributions, Mac OS, Cygwin, and Windows (msysgit) to get the sources onto your local computer using the following commands:
21-
22-
```
23-
git config --global branch.autosetupmerge true
24-
git config --global user.name "Jane Doe"
25-
git config --global user.email [email protected]
26-
27-
git clone [email protected]:janedoe/ironpython3.git
28-
cd ironpython3
29-
git remote add ironpython3 git://github.com/IronLanguages/ironpython3.git
30-
git pull ironpython3 main
31-
```
32-
33-
At a later date, to get the latest updates from the IronPython3 project, run the following command in the ironpython3 directory created above:
34-
35-
```
36-
git pull ironpython3 main
37-
```
38-
39-
If there is a merge conflict, edit the unmerged files to remove the conflict markers, and then run the following command:
40-
41-
```
42-
git commit -a
43-
```
44-
45-
To push your changes back to your fork and make them public, use `git push`.
46-
47-
### Working without a fork
48-
49-
You can skip creating a fork if you only want to browse the sources. In that case, you can clone the project directly as such:
50-
```
51-
git clone git://github.com/IronLanguages/ironpython3.git
52-
git pull
53-
```
54-
55-
### Initialize submodules
56-
57-
The DLR (Dynamic Language Runtime) is a submodule of the ironpython3 repository, you need to initialize after cloning the repository.
58-
```
59-
git submodule update --init
60-
```
61-
62-
For more information there is an excellent tutorial on [getting started with git](http://kylecordes.com/2008/04/30/git-windows-go/)
1+
This document has been moved to the IronPython wiki: [Getting the sources](https://github.com/IronLanguages/ironpython3/wiki/Getting-the-sources)

0 commit comments

Comments
 (0)