├── .editorconfig
├── .github
└── FUNDING.yml
├── .gitignore
├── .pre-commit-config.yaml
├── CODE_OF_CONDUCT.md
├── COPYING.txt
├── ChangeLog-spell-corrected.diff
├── Makefile
├── NEWS.md
├── README.rst
├── __pkginfo__.py
├── admin-tools
├── git2cl
├── make-dist.sh
└── pyenv-versions
├── docker-compose-dev.yml
├── docker-compose.yml
├── docker
├── Dockerfile
├── Dockerfile-dev
├── Dockerfile-dev+debug
├── Dockerfile-git
├── Dockerfile-release
├── django-db
│ └── mathics.sqlite
├── entrypoint.sh
├── requirements-mathicsscript.txt
├── requirements.txt
├── src
│ ├── .gitignore
│ ├── doc_html_data.pcl
│ └── version-info.tex
├── tex-images
│ ├── .gitignore
│ ├── logo-heptatom.pdf
│ ├── logo-text-nodrop.pdf
│ └── logo.pdf
├── ubuntu-bin
│ └── gs
└── ubuntu-dpkg
│ └── libgsl25_2.6+dfsg-2_amd64.deb
├── mathics_omnibus
├── .gitignore
├── __init__.py
└── version.py
├── script
├── dmathics
├── dmathics.cmd
├── dmathics3
├── dmathics3-tokens
├── dmathicsdoc
├── dmathicsdoccopy
├── dmathicsscript
├── dmathicsscript.cmd
├── dmathicsserver
└── term-background.sh
├── setup.cfg
└── setup.py
/.editorconfig:
--------------------------------------------------------------------------------
1 | # THis is an EditorConfig file
2 | # https://EditorConfig.org
3 |
4 | root = true
5 |
6 | [*]
7 | end_of_line = lf
8 | insert_final_newline = true
9 | charset = utf-8
10 | indent_style = tab
11 | indent_size = 4
12 | insert_final_newline = true
13 |
14 | [*.yml]
15 | indent_style = space
16 | indent_size = 2
17 | end_of_line = lf
18 | insert_final_newline = true
19 |
20 | [*.py]
21 | indent_style = space
22 | indent_size = 4
23 | end_of_line = lf
24 | insert_final_newline = true
25 |
26 | # Tab indentation (no size specified)
27 | [Makefile]
28 | indent_style = tab
29 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [rocky]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
13 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *~
2 | .coverage
3 | .idea/
4 | .mypy_cache
5 | .project
6 | .pydevproject
7 | .settings
8 | .vscode
9 | /.cache
10 | /.python-version
11 | /ChangeLog-spell-corrected
12 | /Mathics_omnibus.egg-info
13 | /__pycache__
14 | /build
15 | /dist
16 | /mathics_omnibus.egg-info
17 | /node_modules
18 | /package-lock.json
19 | /package.json
20 | ChangeLog
21 | Documents/
22 | Homepage/
23 | Test/
24 | _Copies_/
25 | _Database_/
26 | tmp
27 |
--------------------------------------------------------------------------------
/.pre-commit-config.yaml:
--------------------------------------------------------------------------------
1 | repos:
2 | - repo: https://github.com/pre-commit/pre-commit-hooks
3 | rev: v4.0.1
4 | hooks:
5 | - id: debug-statements
6 | - id: end-of-file-fixer
7 | - id: trailing-whitespace
8 | - repo: https://github.com/psf/black
9 | rev: 22.3.0
10 | hooks:
11 | - id: black
12 | language_version: python3
13 | exclude: 'mathicsscript/version.py'
14 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | We as members, contributors, and leaders pledge to make participation in our
6 | community a harassment-free experience for everyone, regardless of age, body
7 | size, visible or invisible disability, ethnicity, sex characteristics, gender
8 | identity and expression, level of experience, education, socio-economic status,
9 | nationality, personal appearance, race, religion, or sexual identity
10 | and orientation.
11 |
12 | We pledge to act and interact in ways that contribute to an open, welcoming,
13 | diverse, inclusive, and healthy community.
14 |
15 | ## Our Standards
16 |
17 | Examples of behavior that contributes to a positive environment for our
18 | community include:
19 |
20 | * Demonstrating empathy and kindness toward other people
21 | * Being respectful of differing opinions, viewpoints, and experiences
22 | * Giving and gracefully accepting constructive feedback
23 | * Accepting responsibility and apologizing to those affected by our mistakes,
24 | and learning from the experience
25 | * Focusing on what is best not just for us as individuals, but for the
26 | overall community
27 |
28 | Examples of unacceptable behavior include:
29 |
30 | * The use of sexualized language or imagery, and sexual attention or
31 | advances of any kind
32 | * Trolling, insulting or derogatory comments, and personal or political attacks
33 | * Public or private harassment
34 | * Publishing others' private information, such as a physical or email
35 | address, without their explicit permission
36 | * Other conduct which could reasonably be considered inappropriate in a
37 | professional setting
38 |
39 | ## Enforcement Responsibilities
40 |
41 | Community leaders are responsible for clarifying and enforcing our standards of
42 | acceptable behavior and will take appropriate and fair corrective action in
43 | response to any behavior that they deem inappropriate, threatening, offensive,
44 | or harmful.
45 |
46 | Community leaders have the right and responsibility to remove, edit, or reject
47 | comments, commits, code, wiki edits, issues, and other contributions that are
48 | not aligned to this Code of Conduct, and will communicate reasons for moderation
49 | decisions when appropriate.
50 |
51 | ## Scope
52 |
53 | This Code of Conduct applies within all community spaces, and also applies when
54 | an individual is officially representing the community in public spaces.
55 | Examples of representing our community include using an official e-mail address,
56 | posting via an official social media account, or acting as an appointed
57 | representative at an online or offline event.
58 |
59 | ## Enforcement
60 |
61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
62 | reported to the community leaders responsible for enforcement at
63 | .
64 | All complaints will be reviewed and investigated promptly and fairly.
65 |
66 | All community leaders are obligated to respect the privacy and security of the
67 | reporter of any incident.
68 |
69 | ## Enforcement Guidelines
70 |
71 | Community leaders will follow these Community Impact Guidelines in determining
72 | the consequences for any action they deem in violation of this Code of Conduct:
73 |
74 | ### 1. Correction
75 |
76 | **Community Impact**: Use of inappropriate language or other behavior deemed
77 | unprofessional or unwelcome in the community.
78 |
79 | **Consequence**: A private, written warning from community leaders, providing
80 | clarity around the nature of the violation and an explanation of why the
81 | behavior was inappropriate. A public apology may be requested.
82 |
83 | ### 2. Warning
84 |
85 | **Community Impact**: A violation through a single incident or series
86 | of actions.
87 |
88 | **Consequence**: A warning with consequences for continued behavior. No
89 | interaction with the people involved, including unsolicited interaction with
90 | those enforcing the Code of Conduct, for a specified period of time. This
91 | includes avoiding interactions in community spaces as well as external channels
92 | like social media. Violating these terms may lead to a temporary or
93 | permanent ban.
94 |
95 | ### 3. Temporary Ban
96 |
97 | **Community Impact**: A serious violation of community standards, including
98 | sustained inappropriate behavior.
99 |
100 | **Consequence**: A temporary ban from any sort of interaction or public
101 | communication with the community for a specified period of time. No public or
102 | private interaction with the people involved, including unsolicited interaction
103 | with those enforcing the Code of Conduct, is allowed during this period.
104 | Violating these terms may lead to a permanent ban.
105 |
106 | ### 4. Permanent Ban
107 |
108 | **Community Impact**: Demonstrating a pattern of violation of community
109 | standards, including sustained inappropriate behavior, harassment of an
110 | individual, or aggression toward or disparagement of classes of individuals.
111 |
112 | **Consequence**: A permanent ban from any sort of public interaction within
113 | the community.
114 |
115 | ## Attribution
116 |
117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118 | version 2.0, available at
119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120 |
121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct
122 | enforcement ladder](https://github.com/mozilla/diversity).
123 |
124 | [homepage]: https://www.contributor-covenant.org
125 |
126 | For answers to common questions about this code of conduct, see the FAQ at
127 | https://www.contributor-covenant.org/faq. Translations are available at
128 | https://www.contributor-covenant.org/translations.
129 |
--------------------------------------------------------------------------------
/COPYING.txt:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/ChangeLog-spell-corrected.diff:
--------------------------------------------------------------------------------
1 | --- ChangeLog 2025-01-28 08:11:48.318713212 -0500
2 | +++ ChangeLog-spell-corrected 2025-01-28 08:12:51.006747114 -0500
3 | @@ -36,7 +36,7 @@
4 |
5 | 2025-01-17 rocky
6 |
7 | - * docker/entrypoint.sh, script/dmathicsserver: mathicsdoc corretions
8 | + * docker/entrypoint.sh, script/dmathicsserver: mathicsdoc corrections
9 | for USER_HOME=/home/ubuntu
10 |
11 | 2025-01-16 rocky
12 | @@ -76,7 +76,7 @@
13 |
14 | 2024-01-17 rocky
15 |
16 | - * docker/Dockerfile, docker/Dockerfile-dev, docker/Dockerfile-git:
17 | + * docker/Dockerfile, docker/Dockerfile-dev, docker/Dockerfile-git:
18 | Use newer software versions in dev dockerfile
19 |
20 | 2024-01-15 rocky
21 | @@ -163,7 +163,7 @@
22 |
23 | 2022-07-17 rocky
24 |
25 | - * docker/Dockerfile, docker/requirements.txt, script/dmathicsscript:
26 | + * docker/Dockerfile, docker/requirements.txt, script/dmathicsscript:
27 | Everything roughly working again. * dmathicsscript * dmathicsserver * dmathicsdoc * dmathicsdoccopy However there are still some small rough edges
28 |
29 | 2022-07-16 rocky
30 | @@ -251,7 +251,7 @@
31 |
32 | 2021-09-12 rocky
33 |
34 | - * : Add plots to Parital Diff Eqns 2.1
35 | + * : Add plots to Partial Diff Eqns 2.1
36 |
37 | 2021-09-11 rocky
38 |
39 | @@ -300,7 +300,7 @@
40 | 2021-08-08 rocky
41 |
42 | * script/dmathicsscript, script/dmathicsserver,
43 | - script/term-background.sh: Better persistance via setting Env
44 | + script/term-background.sh: Better persistence via setting Env
45 | variables Better help for dmathicsscript and dmathicssserver Fix bug in term-background Revise symja example in mathics.sqlite
46 |
47 | 2021-08-03 rocky
48 | @@ -336,7 +336,7 @@
49 |
50 | * README.rst, __pkginfo__.py, docker/Dockerfile,
51 | docker/Dockerfile-dev, docker/Dockerfile-dev+debug,
52 | - docker/entrypoint.sh, script/dmathicsdoc, script/dmathicsdoccopy:
53 | + docker/entrypoint.sh, script/dmathicsdoc, script/dmathicsdoccopy:
54 | Revise docker to allow PDF viewing and copy New scripts dmathicsdoc and dmathicsdoccopy perform the new
55 | functions Document this in README.rst, and add these scripts in PyPI
56 | packaging. entrypoint.sh needs to multiplex dmathicsdoccpy and
57 | @@ -647,7 +647,7 @@
58 | 2021-02-20 rocky
59 |
60 | * .gitignore, README.rst, admin-tools/git2cl,
61 | - admin-tools/make-dist.sh, admin-tools/pyenv-versions, setup.py:
62 | + admin-tools/make-dist.sh, admin-tools/pyenv-versions, setup.py:
63 | Administrivia
64 |
65 | 2021-02-20 R. Bernstein
66 | @@ -1912,10 +1912,9 @@
67 | mathics/web/templates/base_html.html, mathics/web/urls.py,
68 | mathics/web/views.py, pymathics/natlang/natlang.py, setup.py,
69 | test/test_evaluation.py, test/test_file.py,
70 | - test/test_parser/test_tokeniser.py, tmp/README.rst, travis.py:
71 | + test/test_parser/test_tokeniser.py, tmp/README.rst, travis.py:
72 | Squash unrelated Docker items
73 |
74 | 2020-12-25 rocky
75 |
76 | * Initial
77 | -
78 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | # A GNU Makefile to run various tasks - compatibility for us old-timers.
2 |
3 | # Note: This makefile include remake-style target comments.
4 | # These comments before the targets start with #:
5 | # remake --tasks to shows the targets and the comments
6 |
7 | DOCKER ?= docker
8 | DOCKER_COMPOSE ?= docker-compose
9 | DOCKER_COMPOSE_FILE =
10 | GIT2CL ?= admin-tools/git2cl
11 | RM ?= rm
12 | TAG ?= latest
13 |
14 | .PHONY: all \
15 | check clean \
16 | dist \
17 | docker-image \
18 | docker-image-quick \
19 | push \
20 | rmChangeLog \
21 | test \
22 | upload
23 |
24 | SANDBOX ?=
25 | ifeq ($(OS),Windows_NT)
26 | SANDBOX = t
27 | else
28 | UNAME_S := $(shell uname -s)
29 | ifeq ($(UNAME_S),Darwin)
30 | SANDBOX = t
31 | endif
32 | endif
33 |
34 | #: Default target - same as "develop"
35 | all: docker-image
36 |
37 | #: Make distirbution: wheels, eggs, tarball
38 | dist:
39 | ./admin-tools/make-dist.sh
40 |
41 | #: Pull mathics docker image from dockerhub with tag $(TAG). The default tag is "latest".
42 | docker-pull:
43 | $(DOCKER) pull mathicsorg/mathics:$(TAG)
44 |
45 | #: Push local docker image to dockerhub with tag $(TAG). The default tag is "latest".
46 | install push upload:
47 | $(DOCKER) push mathicsorg/mathics:$(TAG)
48 |
49 | #: Build docker image with cache clearing
50 | docker-image:
51 | $(DOCKER_COMPOSE) $(DOCKER_COMPOSE_FILE) build --no-cache
52 |
53 | #: Build docker image without clearing cache
54 | docker-image-quick:
55 | $(DOCKER_COMPOSE) $(DOCKER_COMPOSE_FILE) build
56 |
57 | # check: pytest gstest
58 |
59 | #: Remove derived files
60 | clean:
61 | rm mathics/*/*.so; \
62 | for dir in mathics/doc ; do \
63 | ($(MAKE) -C "$$dir" clean); \
64 | done;
65 |
66 | #: Remove ChangeLog
67 | rmChangeLog:
68 | $(RM) ChangeLog || true
69 |
70 | #: Create a ChangeLog from git via git log and git2cl
71 | ChangeLog: rmChangeLog
72 | git log --pretty --numstat --summary | $(GIT2CL) >$@
73 | patch ChangeLog < ChangeLog-spell-corrected.diff
74 |
--------------------------------------------------------------------------------
/NEWS.md:
--------------------------------------------------------------------------------
1 | 8.0.0
2 | -----
3 |
4 | Jan 28, 2025
5 |
6 | * Synchronize version number up with major API release in Mathics Kernel
7 | * Add `dmathics3-tokens` interface to `mathics3-tokens` (from mathics-scanner)
8 | * Use newer versions of everything, Ubuntu, Python, SymPy, etc.
9 | * Remove lots of copies of old wheels from source; we can now get everything resonably fast from inside docker
10 |
11 |
12 | 4.0.1
13 | -----
14 |
15 | Front-end Scripts to run docker have been gone over to provide help via `--help`, and set environment variables that allow persistance of session by saving data on the host filesystem.
16 |
17 | Docker images now include a version of Asymptote that will build images used in the manual, especially those that use Plot option `Filling` and `Bottom`.
18 |
19 | Examples from Mark S Gockenbach's Tutorial for Partial Differential quations: Analytical and Numerical Methods have been added to the Mathics-Django worksheet database.
20 |
21 | A bug was fixed in detecting the background use in `dmathicsscript`.
22 |
23 | 4.0.0
24 | -----
25 |
26 | # PyPI
27 |
28 | Revised for Mathics 4.0.0. See the respective changes in Mathics3, Mathics-Django, and mathicsscript for changes there.
29 |
30 | # Docker
31 |
32 |
33 | * we now use `llvm12` and a more recent `gv`
34 | * there is an `--upgrade` command added to all docker scripts to retrieve/updagte to the latest version
35 | * More environment variables can be passed through.
36 | * You can set environment variable `APP_DATADIR` to a directory outside Django to have data persist there. You may want to use this with `MATHIC_DJANGO_PATH` below...
37 | * In `dmathicsscript`, if you set `MATHICS_DJANGO_DB_PATH` and that file doesn't exist, the system database will be copied to that location. This gives a way for persisting sessions outside of docker.
38 |
39 | There is be interaction between `MATHICS_DJANGO_DB_PATH` and `APP_DATADIR` to get the database to persist.
40 |
41 | As a simple example, run:
42 |
43 | ```
44 | $ MATHICS_DJANGO_DB_PATH=/usr/src/app/data/foo.sqlite dmathicsserver
45 | ```
46 |
47 | Above, since by default `APP_DATADIR` maps `/usr/src/app/data` to `/tmp`, on the host filesystem in `/tmp/mathics-django.sqlite` workspace sessions can be saved.
48 |
49 | 3.1.0
50 | -----
51 |
52 | This version builds the PDF and stores that in the docker container. As a result two new
53 | command and front-end shell scripts were added:
54 |
55 | * `dmathicsdoc` will run _evince_ over the Mathics book that was built when the container was built.
56 | * `dmathicsdoccopy` will copy the Mathics book that was built when the container was built.
57 |
58 | The script for going into `mathicsscript` has been enhanced to try to detect the terminal background.
59 |
60 | Set environment variable `COLORFGBG` to force what kind of background you have Use value `15;0` for dark backgrounds and `0;15` for light backgrounds.
61 |
62 | Two new workspaces taken from "Implementing Discrete Mathematics" have been added to Mathics Django:
63 |
64 | * C 3.1 Datastructures for Graphs
65 | * C 3.2 Classifying Simple Graphs
66 |
67 | Section 14: Coordinates and Graphics 3D has been revised now that the efficiency of threejs rendering has been improved. We can now easily compute 10x10 points in a box.
68 |
69 | 3.0.0
70 | -----
71 |
72 | Track changes to Mathics core Django, mathicsscript, and pymathics-graph.
73 | Numerous docker config changes.
74 |
75 |
76 | 2.2.0
77 | -----
78 |
79 | Tracks Mathics 2.2.0 core release and related packages.
80 |
81 | 1.0.0
82 | -----
83 |
84 | First public release.
85 |
86 | Pulls in
87 |
88 | * Mathics3,
89 | * mathicsscript, and
90 | * mathics-django.
91 |
92 | And pymathics modules:
93 |
94 | * pymathics-natlang,
95 | * pymathics-graph,
96 |
--------------------------------------------------------------------------------
/README.rst:
--------------------------------------------------------------------------------
1 | |Pypi Installs| |Latest Version| |Supported Python Versions|
2 |
3 | Mathics3 is a general-purpose computer algebra system (CAS). It is an open-source alternative to Mathematica. It is free both as in "freedom" and as in "free beer".
4 |
5 | `Mathics3 `_ consists of a number of separable components so that those pieces that are desired can be used without the burden of dependencies of the other parts.
6 |
7 | For example if you are interested in just running a command-line interface, you might not be interested in having Django and what that entails and vice versa.
8 | If you are just interested in the computational library, there is no need for either the Web parts or the command-line library parts.
9 |
10 | But what if you want both command-line interface, Web interface, all of the Pymathics libraries and whatever else there is to offer?
11 |
12 | That's what this repository is about. Here we have a PyPI installable package that pull in the various components and offer commands:
13 |
14 | * ``mathics3-tokens`` utility to show how an input stream is tokenized by Mathics3
15 | * ``mathicsscript`` to run the command-line interface,
16 | * ``mathicsserver`` to run the Django-Web server,
17 | * ``dmathicsscript`` and ``dmathicsserver`` which runs the docker version of these,
18 | * ``dmathicssdoc`` which runs a PDF viewer, `evince `_, which can view the generated reference manual in PDF.
19 | * ``dmathicsdoccopy`` which copies the the generated reference PDF manual out of the container and into the host filesystem.
20 |
21 | This repository also contains the Dockerfiles used to create the `mathicsorg/mathics docker images `_.
22 |
23 | That image is a combination of:
24 |
25 | * `Mathics-Scanner `_ (WL Character Tables and Mathics Scanner)
26 | * `mathicsscript `_ (Command-line Mathics Interface)
27 | * `mathics-pygments `_ (WL Syntax Highlighting)
28 | * `Mathics-Django `_ (Django-based HTTP server)
29 | * `mathics-threejs-backend `_ (Graphics3D rendering using threejs)
30 | * `pymathics-natlang `_ (Natural Language Processing add-on)
31 | * `pymathics-graph `_ (Graph add-on based on `NetworkX `_.
32 |
33 | It is likely that in the future more components will be added, so stay tuned...
34 |
35 | .. |Packaging status| image:: https://repology.org/badge/vertical-allrepos/Mathics-omnibus.svg
36 | :target: https://repology.org/project/Mathics-omnibus/versions
37 | .. |Latest Version| image:: https://badge.fury.io/py/Mathics-omnibus.svg
38 | :target: https://badge.fury.io/py/Mathics-omnibus
39 | .. |Pypi Installs| image:: https://pepy.tech/badge/Mathics-omnibus
40 | .. |Supported Python Versions| image:: https://img.shields.io/pypi/pyversions/Mathics-omnibus.svg
41 |
42 |
43 | Docker-specific items
44 | ---------------------
45 |
46 | By default, we use a SQLite database that has examples that you can
47 | load and use. This data comes from
48 | `mathics-omnibus/django-db/mathics.sqlite `_.
49 |
50 | Since this is tied to the docker image, any changes made won't survive
51 | across restarting the docker image.
52 |
53 | If you would like to save your own you can set the environment
54 | variable ``MATHICS_DJANGO_DB_PATH``. Here is an example:
55 |
56 |
57 | .. code:: bash
58 |
59 | $ MATHICS_DJANGO_DB_PATH=/usr/src/app/data/mathics-django/mathics.sqlite ../mathics-omnibus/script/dmathicsserver
60 | MATHICS_DJANGO_DB_PATH=/usr/src/app/data/mathics-django/mathics.sqlite ../mathics-omnibus/script/dmathicsserver^J-(../mathics-omnibus/script/dmathicsserver:5): -[2,0, 0]
61 | DOCKER=docker
62 | -(../mathics-omnibus/script/dmathicsserver:6): -[2,0, 0]
63 | MATHICS_DJANGO_DB=mathics.sqlite
64 | -(../mathics-omnibus/script/dmathicsserver:7): -[2,0, 0]
65 | MATHICS_DJANGO_DB_PATH=/usr/src/app/data/mathics-django/mathics.sqlite
66 | -(../mathics-omnibus/script/dmathicsserver:9): -[2,0, 0]
67 | docker run -it --name mathics-web --rm --env=DISPLAY --env MATHICS_DJANGO_DB_PATH=/usr/src/app/data/mathics-django/mathics.sqlite --workdir=/app --volume=/src/external-vcs/github/Mathics3/mathics-django:/app --volume=/tmp/.X11-unix:/tmp/.X11-unix:rw -p 8000:8000 -v /tmp:/usr/src/app/data mathicsorg/mathics --mode ui
68 |
69 | ~~~~ app/data has been mounted to /usr/src/app/data ~~~~
70 | ~~~~ SQLite data (worksheets, user info) will be stored in /usr/src/app/data/mathics django/mathics.sqlite ~~~~
71 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72 |
73 | warning: database file /usr/src/app/data/mathics-django/mathics.sqlite not found
74 |
75 | Migrating database /usr/src/app/data/mathics-django/mathics.sqlite
76 | Operations to perform:
77 | Apply all migrations: auth, contenttypes, sessions, sites, web
78 | Running migrations:
79 |
80 | In the above when it says ``mathics.sqlite not found`` an empty one is
81 | created. The real location of it outside of the container is in
82 | ``/tmp/mathics-django/mathics.sqlite``.
83 |
--------------------------------------------------------------------------------
/__pkginfo__.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import os.path as osp
3 |
4 | author = "Rocky Bernstein"
5 | author_email = "rb@dustyfeet.com"
6 | scripts = [
7 | "script/dmathics",
8 | "script/dmathics3-tokens",
9 | "script/dmathicsdoc",
10 | "script/dmathicsdoccopy",
11 | "script/dmathicsserver",
12 | "script/dmathicsscript",
13 | "script/term-background.sh",
14 | ]
15 |
16 |
17 | def get_srcdir():
18 | filename = osp.normcase(osp.dirname(osp.abspath(__file__)))
19 | return osp.realpath(filename)
20 |
21 |
22 | def read(*rnames):
23 | return open(osp.join(get_srcdir(), *rnames)).read()
24 |
25 |
26 | # Get/set __version__ and long_description from files.
27 | exec(read("mathics_omnibus/version.py"))
28 | long_description = read("README.rst") + "\n"
29 |
30 | # Setup in EXTRAS_REQUIRE various install options:
31 | # mathicsscript_full, etc.
32 | django_full = {"ujson"}
33 | mathics_core_full = {"psutil", "scikit-image", "lxml", "wordcloud", "cython"}
34 | mathicsscript_full = {"PyYAML", "PyQT5", "cairosvg", "ujson"}
35 | full = mathicsscript_full | django_full
36 |
37 | EXTRAS_REQUIRE = {}
38 | for field in "mathics_core_full mathicsscript_full".split():
39 | EXTRAS_REQUIRE[field] = locals()[field]
40 |
41 | IS_PYPY = "__pypy__" in sys.builtin_module_names
42 |
43 | install_requires = [
44 | "Mathics3 >= 8.0.0",
45 | "mathicsscript >= 8.0.0",
46 | "Mathics-Django >= 8.0.0",
47 | "Mathics3-Trepan >= 1.0.2",
48 | "pymathics-natlang >= 8.0.0",
49 | "pymathics-graph >= 8.0.0",
50 | ]
51 |
52 | packages = ["mathics_omnibus", "script"]
53 | py_modules = None
54 | short_desc = "A Collection Mathics components to provide the full Mathics3 experience"
55 | url = "http://github.com/Mathics3/mathics-omnibus"
56 |
57 | classifiers = [
58 | "Operating System :: OS Independent",
59 | "Programming Language :: Python :: 3.8",
60 | "Programming Language :: Python :: 3.9",
61 | "Programming Language :: Python :: 3.10",
62 | "Programming Language :: Python :: 3.11",
63 | "Programming Language :: Python :: 3.12",
64 | ]
65 |
--------------------------------------------------------------------------------
/admin-tools/git2cl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 |
3 | # Copyright (C) 2007, 2008 Simon Josefsson
4 | # Copyright (C) 2007 Luis Mondesi
5 | # * calls git directly. To use it just:
6 | # cd ~/Project/my_git_repo; git2cl > ChangeLog
7 | # * implements strptime()
8 | # * fixes bugs in $comment parsing
9 | # - copy input before we remove leading spaces
10 | # - skip "merge branch" statements as they don't
11 | # have information about files (i.e. we never
12 | # go into $state 2)
13 | # - behaves like a pipe/filter if input is given from the CLI
14 | # else it calls git log by itself
15 | #
16 | # The functions mywrap, last_line_len, wrap_log_entry are derived from
17 | # the cvs2cl tool, see :
18 | # Copyright (C) 2001,2002,2003,2004 Martyn J. Pearce
19 | # Copyright (C) 1999 Karl Fogel
20 | #
21 | # git2cl is free software; you can redistribute it and/or modify it
22 | # under the terms of the GNU General Public License as published by
23 | # the Free Software Foundation; either version 2, or (at your option)
24 | # any later version.
25 | #
26 | # git2cl is distributed in the hope that it will be useful, but
27 | # WITHOUT ANY WARRANTY; without even the implied warranty of
28 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 | # General Public License for more details.
30 | #
31 | # You should have received a copy of the GNU General Public License
32 | # along with git2cl; see the file COPYING. If not, write to the Free
33 | # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
34 | # 02110-1301 USA.
35 |
36 | =head1 NAME
37 |
38 | git2cl - tool to convert git logs to GNU ChangeLog
39 |
40 | =head1 SYNOPSIS
41 |
42 | git2cl > ChangeLog
43 |
44 | If you don't want git2cl to invoke git log internally, you can use it
45 | as a pipe.
46 | It needs a git log generated with --pretty --numstat and --summary.
47 | You can use it as follows:
48 |
49 | git log --pretty --numstat --summary | git2cl > ChangeLog
50 |
51 | =head1 DESCRIPTION
52 |
53 | This is a quick'n'dirty tool to convert git logs to GNU ChangeLog
54 | format.
55 |
56 | The tool invokes `git log` internally unless you pipe a log to it.
57 | Thus, typically you would use it as follows:
58 |
59 | =head1 SEE ALSO
60 |
61 | Output format specification:
62 |
63 |
64 | =head1 AUTHORS
65 |
66 | git2cl is developed by Simon Josefsson
67 | and Luis Mondesi
68 |
69 | =cut
70 |
71 | use strict;
72 | use POSIX qw(strftime);
73 | use Text::Wrap qw(wrap);
74 | use FileHandle;
75 |
76 | use constant EMPTY_LOG_MESSAGE => '*** empty log message ***';
77 |
78 | # this is a helper hash for stptime.
79 | # Assumes you are calling 'git log ...' with LC_ALL=C
80 | my %month = (
81 | 'Jan'=>0,
82 | 'Feb'=>1,
83 | 'Mar'=>2,
84 | 'Apr'=>3,
85 | 'May'=>4,
86 | 'Jun'=>5,
87 | 'Jul'=>6,
88 | 'Aug'=>7,
89 | 'Sep'=>8,
90 | 'Oct'=>9,
91 | 'Nov'=>10,
92 | 'Dec'=>11,
93 | );
94 |
95 | my $fh = new FileHandle;
96 |
97 | sub key_ready
98 | {
99 | my ($rin, $nfd);
100 | vec($rin, fileno(STDIN), 1) = 1;
101 | return $nfd = select($rin, undef, undef, 0);
102 | }
103 |
104 | sub strptime {
105 | my $str = shift;
106 | return undef if not defined $str;
107 |
108 | # we are parsing this format
109 | # Fri Oct 26 00:42:56 2007 -0400
110 | # to these fields
111 | # sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1
112 | # Luis Mondesi
113 | my @date;
114 | if ($str =~ /([[:alpha:]]{3})\s+([[:alpha:]]{3})\s+([[:digit:]]{1,2})\s+([[:digit:]]{1,2}):([[:digit:]]{1,2}):([[:digit:]]{1,2})\s+([[:digit:]]{4})/){
115 | push(@date,$6,$5,$4,$3,$month{$2},($7 - 1900),-1,-1,-1);
116 | } else {
117 | die ("Cannot parse date '$str'\n'");
118 | }
119 | return @date;
120 | }
121 |
122 | sub mywrap {
123 | my ($indent1, $indent2, @text) = @_;
124 | # If incoming text looks preformatted, don't get clever
125 | my $text = Text::Wrap::wrap($indent1, $indent2, @text);
126 | if ( grep /^\s+/m, @text ) {
127 | return $text;
128 | }
129 | my @lines = split /\n/, $text;
130 | $indent2 =~ s!^((?: {8})+)!"\t" x (length($1)/8)!e;
131 | $lines[0] =~ s/^$indent1\s+/$indent1/;
132 | s/^$indent2\s+/$indent2/
133 | for @lines[1..$#lines];
134 | my $newtext = join "\n", @lines;
135 | $newtext .= "\n"
136 | if substr($text, -1) eq "\n";
137 | return $newtext;
138 | }
139 |
140 | sub last_line_len {
141 | my $files_list = shift;
142 | my @lines = split (/\n/, $files_list);
143 | my $last_line = pop (@lines);
144 | return length ($last_line);
145 | }
146 |
147 | # A custom wrap function, sensitive to some common constructs used in
148 | # log entries.
149 | sub wrap_log_entry {
150 | my $text = shift; # The text to wrap.
151 | my $left_pad_str = shift; # String to pad with on the left.
152 |
153 | # These do NOT take left_pad_str into account:
154 | my $length_remaining = shift; # Amount left on current line.
155 | my $max_line_length = shift; # Amount left for a blank line.
156 |
157 | my $wrapped_text = ''; # The accumulating wrapped entry.
158 | my $user_indent = ''; # Inherited user_indent from prev line.
159 |
160 | my $first_time = 1; # First iteration of the loop?
161 | my $suppress_line_start_match = 0; # Set to disable line start checks.
162 |
163 | my @lines = split (/\n/, $text);
164 | while (@lines) # Don't use `foreach' here, it won't work.
165 | {
166 | my $this_line = shift (@lines);
167 | chomp $this_line;
168 |
169 | if ($this_line =~ /^(\s+)/) {
170 | $user_indent = $1;
171 | }
172 | else {
173 | $user_indent = '';
174 | }
175 |
176 | # If it matches any of the line-start regexps, print a newline now...
177 | if ($suppress_line_start_match)
178 | {
179 | $suppress_line_start_match = 0;
180 | }
181 | elsif (($this_line =~ /^(\s*)\*\s+[a-zA-Z0-9]/)
182 | || ($this_line =~ /^(\s*)\* [a-zA-Z0-9_\.\/\+-]+/)
183 | || ($this_line =~ /^(\s*)\([a-zA-Z0-9_\.\/\+-]+(\)|,\s*)/)
184 | || ($this_line =~ /^(\s+)(\S+)/)
185 | || ($this_line =~ /^(\s*)- +/)
186 | || ($this_line =~ /^()\s*$/)
187 | || ($this_line =~ /^(\s*)\*\) +/)
188 | || ($this_line =~ /^(\s*)[a-zA-Z0-9](\)|\.|\:) +/))
189 | {
190 | $length_remaining = $max_line_length - (length ($user_indent));
191 | }
192 |
193 | # Now that any user_indent has been preserved, strip off leading
194 | # whitespace, so up-folding has no ugly side-effects.
195 | $this_line =~ s/^\s*//;
196 |
197 | # Accumulate the line, and adjust parameters for next line.
198 | my $this_len = length ($this_line);
199 | if ($this_len == 0)
200 | {
201 | # Blank lines should cancel any user_indent level.
202 | $user_indent = '';
203 | $length_remaining = $max_line_length;
204 | }
205 | elsif ($this_len >= $length_remaining) # Line too long, try breaking it.
206 | {
207 | # Walk backwards from the end. At first acceptable spot, break
208 | # a new line.
209 | my $idx = $length_remaining - 1;
210 | if ($idx < 0) { $idx = 0 };
211 | while ($idx > 0)
212 | {
213 | if (substr ($this_line, $idx, 1) =~ /\s/)
214 | {
215 | my $line_now = substr ($this_line, 0, $idx);
216 | my $next_line = substr ($this_line, $idx);
217 | $this_line = $line_now;
218 |
219 | # Clean whitespace off the end.
220 | chomp $this_line;
221 |
222 | # The current line is ready to be printed.
223 | $this_line .= "\n${left_pad_str}";
224 |
225 | # Make sure the next line is allowed full room.
226 | $length_remaining = $max_line_length - (length ($user_indent));
227 |
228 | # Strip next_line, but then preserve any user_indent.
229 | $next_line =~ s/^\s*//;
230 |
231 | # Sneak a peek at the user_indent of the upcoming line, so
232 | # $next_line (which will now precede it) can inherit that
233 | # indent level. Otherwise, use whatever user_indent level
234 | # we currently have, which might be none.
235 | my $next_next_line = shift (@lines);
236 | if ((defined ($next_next_line)) && ($next_next_line =~ /^(\s+)/)) {
237 | $next_line = $1 . $next_line if (defined ($1));
238 | # $length_remaining = $max_line_length - (length ($1));
239 | $next_next_line =~ s/^\s*//;
240 | }
241 | else {
242 | $next_line = $user_indent . $next_line;
243 | }
244 | if (defined ($next_next_line)) {
245 | unshift (@lines, $next_next_line);
246 | }
247 | unshift (@lines, $next_line);
248 |
249 | # Our new next line might, coincidentally, begin with one of
250 | # the line-start regexps, so we temporarily turn off
251 | # sensitivity to that until we're past the line.
252 | $suppress_line_start_match = 1;
253 |
254 | last;
255 | }
256 | else
257 | {
258 | $idx--;
259 | }
260 | }
261 |
262 | if ($idx == 0)
263 | {
264 | # We bottomed out because the line is longer than the
265 | # available space. But that could be because the space is
266 | # small, or because the line is longer than even the maximum
267 | # possible space. Handle both cases below.
268 |
269 | if ($length_remaining == ($max_line_length - (length ($user_indent))))
270 | {
271 | # The line is simply too long -- there is no hope of ever
272 | # breaking it nicely, so just insert it verbatim, with
273 | # appropriate padding.
274 | $this_line = "\n${left_pad_str}${this_line}";
275 | }
276 | else
277 | {
278 | # Can't break it here, but may be able to on the next round...
279 | unshift (@lines, $this_line);
280 | $length_remaining = $max_line_length - (length ($user_indent));
281 | $this_line = "\n${left_pad_str}";
282 | }
283 | }
284 | }
285 | else # $this_len < $length_remaining, so tack on what we can.
286 | {
287 | # Leave a note for the next iteration.
288 | $length_remaining = $length_remaining - $this_len;
289 |
290 | if ($this_line =~ /\.$/)
291 | {
292 | $this_line .= " ";
293 | $length_remaining -= 2;
294 | }
295 | else # not a sentence end
296 | {
297 | $this_line .= " ";
298 | $length_remaining -= 1;
299 | }
300 | }
301 |
302 | # Unconditionally indicate that loop has run at least once.
303 | $first_time = 0;
304 |
305 | $wrapped_text .= "${user_indent}${this_line}";
306 | }
307 |
308 | # One last bit of padding.
309 | $wrapped_text .= "\n";
310 |
311 | return $wrapped_text;
312 | }
313 |
314 | # main
315 |
316 | my @date;
317 | my $author;
318 | my @files;
319 | my $comment;
320 |
321 | my $state; # 0-header 1-comment 2-files
322 | my $done = 0;
323 |
324 | $state = 0;
325 |
326 | # if reading from STDIN, we assume that we are
327 | # getting git log as input
328 | if (key_ready())
329 | {
330 |
331 | #my $dummyfh; # don't care about writing
332 | #($fh,$dummyfh) = FileHandle::pipe;
333 | $fh->fdopen(*STDIN, 'r');
334 | }
335 | else
336 | {
337 | $fh->open("LC_ALL=C git log --pretty --numstat --summary|")
338 | or die("Cannot execute git log...$!\n");
339 | }
340 |
341 | while (my $_l = <$fh>) {
342 | #print STDERR "debug ($state, " . (@date ? (strftime "%Y-%m-%d", @date) : "") . "): `$_'\n";
343 | if ($state == 0) {
344 | if ($_l =~ m,^Author: (.*),) {
345 | $author = $1;
346 | }
347 | if ($_l =~ m,^Date: (.*),) {
348 | @date = strptime($1);
349 | }
350 | $state = 1 if ($_l =~ m,^$, and $author and (@date+0>0));
351 | } elsif ($state == 1) {
352 | # * modifying our input text is a bad choice
353 | # let's make a copy of it first, then we remove spaces
354 | # * if we meet a "merge branch" statement, we need to start
355 | # over and find a real entry
356 | # Luis Mondesi
357 | my $_s = $_l;
358 | $_s =~ s/^ //g;
359 | if ($_s =~ m/^Merge branch/)
360 | {
361 | $state=0;
362 | next;
363 | }
364 | $comment = $comment . $_s;
365 | $state = 2 if ($_l =~ m,^$,);
366 | } elsif ($state == 2) {
367 | if ($_l =~ m,^([0-9]+)\t([0-9]+)\t(.*)$,) {
368 | push @files, $3;
369 | }
370 | $done = 1 if ($_l =~ m,^$,);
371 | }
372 |
373 | if ($done) {
374 | print (strftime "%Y-%m-%d $author\n\n", @date);
375 |
376 | my $files = join (", ", @files);
377 | $files = mywrap ("\t", "\t", "* $files"), ": ";
378 |
379 | if (index($comment, EMPTY_LOG_MESSAGE) > -1 ) {
380 | $comment = "[no log message]\n";
381 | }
382 |
383 | my $files_last_line_len = 0;
384 | $files_last_line_len = last_line_len($files) + 1;
385 | my $msg = wrap_log_entry($comment, "\t", 69-$files_last_line_len, 69);
386 |
387 | $msg =~ s/[ \t]+\n/\n/g;
388 |
389 | print "$files: $msg\n";
390 |
391 | @date = ();
392 | $author = "";
393 | @files = ();
394 | $comment = "";
395 |
396 | $state = 0;
397 | $done = 0;
398 | }
399 | }
400 |
401 | if (@date + 0)
402 | {
403 | print (strftime "%Y-%m-%d $author\n\n", @date);
404 | my $msg = wrap_log_entry($comment, "\t", 69, 69);
405 | $msg =~ s/[ \t]+\n/\n/g;
406 | print "\t* $msg\n";
407 | }
408 |
--------------------------------------------------------------------------------
/admin-tools/make-dist.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | PACKAGE=Mathics-omnibus
3 |
4 | # FIXME put some of the below in a common routine
5 | function finish {
6 | cd $owd
7 | }
8 |
9 | cd $(dirname ${BASH_SOURCE[0]})
10 | owd=$(pwd)
11 | trap finish EXIT
12 |
13 | if ! source ./pyenv-versions ; then
14 | exit $?
15 | fi
16 |
17 |
18 | cd ..
19 | source mathics_omnibus/version.py
20 | echo $__version__
21 |
22 | for pyversion in $PYVERSIONS; do
23 | if ! pyenv local $pyversion ; then
24 | exit $?
25 | fi
26 | # pip bdist_egg create too-general wheels. So
27 | # we narrow that by moving the generated wheel.
28 |
29 | # Pick out first two number of version, e.g. 3.7.9 -> 37
30 | first_two=$(echo $pyversion | cut -d'.' -f 1-2 | sed -e 's/\.//')
31 | rm -fr build
32 | python setup.py bdist_egg
33 | python setup.py bdist_wheel
34 | python setup.py bdist_wheel --universal
35 | done
36 |
37 | python ./setup.py sdist
38 |
--------------------------------------------------------------------------------
/admin-tools/pyenv-versions:
--------------------------------------------------------------------------------
1 | # -*- shell-script -*-
2 | # Sets PYVERSIONS to be pyenv versions that
3 | # we can use in the master branch.
4 | if [[ $0 == ${BASH_SOURCE[0]} ]] ; then
5 | echo "This script should be *sourced* rather than run directly through bash"
6 | exit 1
7 | fi
8 | export PYVERSIONS='3.8 3.9 3.10 3.11 3.12 3.13'
9 |
--------------------------------------------------------------------------------
/docker-compose-dev.yml:
--------------------------------------------------------------------------------
1 | version: '2'
2 |
3 | services:
4 | mathics:
5 | build: ./docker
6 | image: mathicsorg/mathics:latest
7 |
8 | volumes:
9 | - ./app/data:/usr/src/app/data
10 |
11 | ports:
12 | - "8000:8000"
13 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '2'
2 |
3 | services:
4 | mathics:
5 | build: ./docker
6 | image: mathicsorg/mathics:latest
7 |
8 | volumes:
9 | - ./app/data:/usr/src/app/data
10 |
11 | ports:
12 | - "8000:8000"
13 |
--------------------------------------------------------------------------------
/docker/Dockerfile:
--------------------------------------------------------------------------------
1 | Dockerfile-release
--------------------------------------------------------------------------------
/docker/Dockerfile-dev:
--------------------------------------------------------------------------------
1 | FROM ubuntu:24.10
2 |
3 | ENV MATHICS3_HOME=/home/ubuntu
4 |
5 | ENV MATHICS3_MODULE_OPTION="--load-module pymathics.graph,pymathics.natlang,pymathics.trepan"
6 |
7 | ENV ENTRYPOINT_COMMAND="docker run -it {MATHICS3_IMAGE}"
8 | RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
9 | WORKDIR $MATHICS3_HOME
10 |
11 | COPY requirements.txt ./
12 | RUN apt-get update
13 | RUN apt-get install -qq apt-utils
14 |
15 | # we need libsqlite3-dev now if ubuntu doesn't come with that, we'll need
16 | # to build our own Python
17 | # Leave out inkscape for now.
18 |
19 | # inxi and mesa-utils might be optional
20 | # npm pulls in nodejs, but we'll be explicit.
21 |
22 | RUN apt-get update -y && apt-get upgrade -y -qq
23 |
24 | # Install lots of packages
25 | RUN apt-get install -y -qq \
26 | asymptote \
27 | cargo \
28 | evince \
29 | gfortran \
30 | git \
31 | gyp \
32 | latexmk texlive-xetex \
33 | libffi-dev \
34 | liblapack-dev \
35 | libmysqlclient-dev \
36 | libopenblas-dev \
37 | librsvg2-bin \
38 | libxcb-cursor-dev \
39 | libxml2-dev \
40 | libxslt1-dev \
41 | llvm-15 \
42 | llvm-15-dev \
43 | lmodern texlive-latex-extra \
44 | maria \
45 | mesa-utils \
46 | nodejs \
47 | npm \
48 | pkg-config \
49 | pyqt5-dev-tools \
50 | python3-pip \
51 | python3.12-venv \
52 | remake \
53 | rustc \
54 | sqlite3 \
55 | texlive-fonts-recommended \
56 | tk8.6-blt2.5 \
57 | x11-apps \
58 | xserver-xorg-video-all
59 |
60 | # # to make docker layers be more usuable in development
61 | # # defer deletion until close to the end
62 | # # RUN rm -fr /tmp*_amd64.deb
63 |
64 | RUN /usr/bin/python3.12 -m venv /opt/python3.12
65 | ENV PATH=.:/opt/python3.12/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
66 | ENV PYTHON=/opt/python3.12/bin/python3.12
67 | ENV PIP=/opt/python3.12/bin/pip
68 | RUN $PYTHON -m pip install --upgrade pip
69 |
70 | ####################
71 | # Oour hacked stopit
72 | ####################
73 |
74 | RUN git clone --depth 1 https://github.com/Mathics3/stopit.git
75 | RUN (cd stopit && $PIP install -e .)
76 |
77 | # ################
78 | # # Mathics core #
79 | # ################
80 |
81 | RUN git clone --depth 1 https://github.com/Mathics3/mathics-scanner.git
82 | RUN (cd mathics-scanner && $PIP install -e .[full])
83 | RUN $PIP install cython trepan3k
84 | RUN git clone --depth 1 https://github.com/Mathics3/mathics-core.git
85 | # For reasons I don't understand, "submodule init" only adds the first repository.
86 | # We need to add the second repository Rubi, explicitly
87 | RUN (cd mathics-core && git submodule update --init --recursive && \
88 | git submodule add https://github.com/Mathics3/Mathics3-Rubi.git mathics/Packages/Rubi)
89 | RUN (cd mathics-core && git submodule && $PIP install -e .[full])
90 | RUN (cd mathics-core && bash ./admin-tools/make-JSON-tables.sh)
91 |
92 | ##############################################
93 | # Mathics Modules: Trepan, Graph, and Natlang
94 | ##############################################
95 | RUN git clone --depth 1 https://github.com/Mathics3/Mathics3-trepan.git
96 | RUN (cd Mathics3-trepan && $PIP install -e .)
97 |
98 | RUN git clone --depth 1 https://github.com/Mathics3/trepan3k-mathics-debugger/
99 | RUN (cd trepan3k-mathics-debugger && $PIP install -e .)
100 |
101 | RUN $PIP install -e git+https://github.com/Mathics3/pymathics-graph#egg=pymathics-graph
102 | RUN $PIP install -e git+https://github.com/Mathics3/pymathics-natlang#egg=pymathics-natlang
103 | # # RUN $PIP install "pymathics-natlang>=8"
104 |
105 | RUN $PIP install spacy
106 | RUN $PYTHON -m spacy download en_core_web_md
107 | RUN $PIP install nltk
108 | RUN $PYTHON -m nltk.downloader wordnet omw-1.4
109 |
110 | # ENV DATA_DIR=/usr/src/app/mathics-core/mathics/doc/latex/
111 | # ENV DOCTEST_LATEX_DATA_PCL=/usr/src/app/mathics-core/mathics/doc/latex/doctext_latex_data.pcl
112 | # ENV DOCTEST_USER_HTML_DATA_PATH=/usr/src/app/mathics-core/mathics/doc/doc_html_data.pcl
113 |
114 | #######################
115 | # LaTeX/PDF generation
116 | #######################
117 | # This has to appear after core and Mathics3 Modules have been built.
118 | # Making the PDF is very time consuming. For now its is easy to build outside of
119 | # docker and just copy in.
120 |
121 | # RUN (cd mathics-core/mathics/doc/latex && PYTHON=$PYTHON make mathics.pdf) || /bin/true
122 | # COPY tex-images/*.pdf mathics-core/mathics/doc/latex/
123 | # ENV DOC_LATEX_FILE=/usr/src/app/mathics-core/mathics/doc/latex/documentation.tex
124 | # # COPY src/documentation.tex mathics-core/mathics/doc/latex/documentation.tex
125 | # # COPY src/version-info.tex mathics-core/mathics/doc/latex/
126 |
127 | COPY src/mathics.pdf mathics-core/mathics/doc/latex/mathics.pdf
128 |
129 | ##################
130 | # Mathics Django #
131 | ##################
132 | RUN git clone --depth 1 https://github.com/Mathics3/mathics-django.git
133 | RUN (cd mathics-django && $PIP install -e .[full])
134 | # # Get threejs version created
135 | RUN (cd mathics-django && make build)
136 | # # RUN $PYTHON -m pip install -e git+https://github.com/Mathics3/mathics-django#egg=Mathics-Django[full]
137 | # # RUN $PYTHON -m pip install "Mathics-Django[full]>=7.0.0"
138 |
139 | # # RUN (cd src/mathics-django && PIP=$PIP make)
140 | # RUN (cd mathics-django && $PYTHON mathics_django/docpipeline.py -ok) || true
141 | COPY src/doc_html_data.pcl doc_html_data.pcl
142 | RUN mv -v doc_html_data.pcl /home/ubuntu/mathics-django/mathics_django/doc/doc_data_html.pcl
143 |
144 | ##################
145 | # Mathicsscript #
146 | ##################
147 |
148 | RUN git clone https://github.com/Mathics3/mathicsscript.git
149 | RUN (cd mathicsscript && PYTHON=$PYTHON make install)
150 |
151 | RUN ${PYTHON} -m pip install mathicsscript[full]
152 | # RUN ${PYTHON} -m pip install -e git+https://github.com/Mathics3/mathicsscript#egg=mathicsscript[full]
153 | # RUN (cd src/mathicsscript && make)
154 |
155 | # ##################
156 | # # debug stuff #
157 | # ##################
158 | # RUN apt-get install -y -qq emacs
159 | # RUN pip install trepan3k
160 | # # RUN pip install remake
161 |
162 | # ##################
163 | # # Finish up #
164 | # ##################
165 |
166 | # # Cleanup
167 | # RUN rm -fr /tmp*_amd64.deb /tmp/*.whl
168 |
169 | COPY entrypoint.sh /usr/local/bin/mathics-omnibus.sh
170 | RUN chmod +x /usr/local/bin/mathics-omnibus.sh
171 |
172 | EXPOSE 8000
173 |
174 | RUN mkdir -p ${MATHICS3_HOME}/.local
175 | RUN mkdir -p ${MATHICS3_HOME}/.config
176 | RUN mkdir -p ${MATHICS3_HOME}/data
177 | RUN mkdir -p ${MATHICS3_HOME}/.local/var/Mathics3/Packages
178 | COPY django-db/mathics.sqlite ${MATHICS3_HOME}/.local/var/Mathics3/mathics.sqlite
179 | RUN chown -R ubuntu:ubuntu $MATHICS3_HOME ${MATHICS3_HOME}/.local
180 | RUN chown -R ubuntu:ubuntu ${MATHICS3_HOME}/data
181 | USER ubuntu
182 |
183 | ENTRYPOINT ["/usr/local/bin/mathics-omnibus.sh"]
184 |
185 | CMD ["--help"]
186 |
--------------------------------------------------------------------------------
/docker/Dockerfile-dev+debug:
--------------------------------------------------------------------------------
1 | FROM ubuntu:jammy
2 |
3 | ENV MATHICS_HOME=/usr/src/app
4 |
5 | ENV ASY_VERSION=asymptote-2.85
6 | ENV MATHICS3_MODULE_OPTION="--load-module pymathics.graph,pymathics.natlang"
7 |
8 | ENV ENTRYPOINT_COMMAND="docker run -it {MATHICS3_IMAGE}"
9 | RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
10 | WORKDIR $MATHICS_HOME
11 |
12 | COPY requirements.txt ./
13 | RUN apt-get update
14 | RUN apt-get install -qq apt-utils
15 |
16 | # we need libsqlite3-dev now if ubuntu doesn't come with that, we'll need
17 | # to build our own Python
18 | # Leave out inkscape for now.
19 |
20 | # inxi and mesa-utils might be optional
21 | # npm pulls in nodejs, but we'll be explicit.
22 |
23 | RUN apt-get update -y && apt-get upgrade -y -qq
24 |
25 | # Install lots of packages
26 | RUN apt-get install -y -qq \
27 | cargo \
28 | evince \
29 | gfortran \
30 | git x11-apps \
31 | gyp \
32 | latexmk texlive-xetex \
33 | libffi7 \
34 | libgl1-mesa-dri \
35 | libgl1-mesa-glx \
36 | liblapack-dev \
37 | libmysqlclient-dev \
38 | libopenblas-dev \
39 | libxml2-dev \
40 | libxslt1-dev \
41 | llvm-11 \
42 | llvm-11-dev \
43 | llvm-12 \
44 | llvm-12-dev \
45 | lmodern texlive-latex-extra \
46 | maria \
47 | mesa-utils \
48 | nodejs \
49 | npm \
50 | pkg-config \
51 | python3-pip \
52 | rustc \
53 | sqlite3 \
54 | texlive-fonts-recommended \
55 | tk8.6-blt2.5 \
56 | xserver-xorg-video-all
57 |
58 | # Set up Pyston
59 | COPY src/*_amd64.deb /tmp/
60 | RUN dpkg -i /tmp/*_amd64.deb
61 |
62 | # to make docker layers be more usuable in development
63 | # defer deletion until close to the end
64 | # RUN rm -fr /tmp*_amd64.deb
65 |
66 | ENV PYTHON=python3.10
67 | ENV PIP=/usr/bin/pip3.10
68 | RUN $PYTHON -m pip install --upgrade pip
69 | COPY src/*.py3-none-any.whl src/*x86_64*.whl /tmp/
70 | RUN $PIP install wheel /tmp/*.py3-none-any.whl /tmp/*x86_64.whl
71 | RUN $PIP install --no-cache-dir -r requirements.txt
72 |
73 | ################
74 | # Mathics core #
75 | ################
76 | # RUN $PIP install git+https://github.com/Mathics3/mathics-core.git#egg=Mathics3[full]
77 | # RUN pip install "Mathics3[full]>=7.0.0"
78 |
79 | RUN apt-get install -y -qq librsvg2-bin pyqt5-dev-tools
80 |
81 | # We need newer versions of Asymptote and GhostScript for bulding the PDF
82 | RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y -qq freeglut3 libfftw3-double3 libglew2.2 libsigsegv2 ghostscript imagemagick texlive-pstricks
83 | COPY ubuntu-bin/gs /usr/local/bin/
84 |
85 | #--
86 | # build new version of Asymptote for our docs and for inside mathicsscript. The Ubuntu-distributed asymptote has bugs.
87 | #--
88 | RUN apt-get install -y -qq \
89 | autoconf \
90 | bison \
91 | file \
92 | flex \
93 | freeglut3-dev \
94 | libcurl3-gnutls \
95 | libcurl4 \
96 | libcurl4 \
97 | libcurl4-gnutls-dev \
98 | libgc-dev \
99 | libgl-dev \
100 | libglm-dev \
101 | libreadline-dev \
102 | libsigsegv2 \
103 | texinfo
104 |
105 | COPY src/${ASY_VERSION}.src.tgz .
106 | RUN tar -xpf ${ASY_VERSION}.src.tgz
107 | RUN (cd ${ASY_VERSION} && bash ./autogen.sh && ./configure --disable-lsp && make -j3 all && make -j3 install)
108 |
109 | RUN git clone https://github.com/Mathics3/mathics-core.git
110 | ENV DATA_DIR=/usr/src/app/mathics-core/mathics/doc/latex/
111 | ENV DOCTEST_LATEX_DATA_PCL=/usr/src/app/mathics-core/mathics/doc/latex/doctext_latex_data.pcl
112 | ENV DOCTEST_USER_HTML_DATA_PATH=/usr/src/app/mathics-core/mathics/doc/doc_html_data.pcl
113 |
114 | COPY tex-images/*.pdf mathics-core/mathics/doc/latex/
115 | ENV DOC_LATEX_FILE=/usr/src/app/mathics-core/mathics/doc/latex/documentation.tex
116 | COPY src/documentation.tex mathics-core/mathics/doc/latex/documentation.tex
117 | COPY src/version-info.tex mathics-core/mathics/doc/latex/
118 | RUN (cd mathics-core && $PIP install -e .[full])
119 | RUN (cd mathics-core && bash ./admin-tools/make-op-tables.sh)
120 |
121 | ####################################################
122 | # Mathics Pymathics and Pymathics Graph for Django #
123 |
124 | RUN $PIP install -e git+https://github.com/Mathics3/pymathics-graph#egg=pymathics-graph
125 | # RUN $PIP install "pymathics-graph>=6.2.0"
126 |
127 | RUN $PIP install -e git+https://github.com/Mathics3/pymathics-natlang#egg=pymathics-natlang
128 | # RUN $PIP install "pymathics-natlang>=6.2.0"
129 |
130 | RUN $PIP install spacy
131 | RUN $PYTHON -m spacy download en_core_web_sm
132 | RUN $PIP install nltk
133 | RUN $PYTHON -m nltk.downloader wordnet omw-1.4
134 |
135 | RUN (cd mathics-core && PYTHON=$PYTHON make doc) || /bin/true
136 | ##################
137 | # Mathics Django #
138 | ##################
139 | RUN git clone https://github.com/Mathics3/mathics-django.git
140 | RUN (cd mathics-django && $PIP install -e .[full])
141 | # Get threejs version created
142 | RUN (cd mathics-django && make build)
143 |
144 | # RUN $PYTHON -m pip install -e git+https://github.com/Mathics3/mathics-django#egg=Mathics-Django[full]
145 | # RUN $PYTHON -m pip install "Mathics-Django[full]>=6.2.0"
146 |
147 | # RUN (cd src/mathics-django && PIP=$PIP make)
148 | RUN (cd src/mathics-django && $PYTHON mathics_django/docpipeline.py -ok --want-sorting) || true
149 | COPY src/doc_html_data.pcl doc_html_data.pcl
150 | RUN mkdir -p /usr/src/app/.local/var/mathics && mv -v doc_html_data.pcl /usr/src/app/.local/var/mathics/doc_data_html.pcl
151 |
152 | ##################
153 | # Mathicsscript #
154 | ##################
155 |
156 | # Mathicsscript loses functionality with pyston because matplotlib doesn't render
157 | # images with it
158 | # Install python 3.10 packages
159 | RUn apt-get install -qq -y \
160 | python3 \
161 | python3-click \
162 | python3-cryptography \
163 | python3-cson \
164 | python3-dateutil \
165 | python3-matplotlib \
166 | python-matplotlib-data \
167 | python3-numpy \
168 | python3-pip \
169 | python3-psutil \
170 | python3-pyqt5 \
171 | python3-pyqt5.qtsvg \
172 | python3-setuptools \
173 | python3-sympy
174 |
175 | COPY requirements-mathicsscript.txt ./
176 | RUN $PIP install --no-cache-dir -r requirements-mathicsscript.txt
177 | RUN git clone https://github.com/Mathics3/mathicsscript.git
178 | RUN (cd mathicsscript && PYTHON=$PYTHON make install)
179 |
180 | RUN ${PYTHON} -m spacy download en_core_web_md
181 | RUN ${PYTHON} -m nltk.downloader wordnet omw-1.4
182 |
183 | # prompt toolkit needs an IPython that is newer than what got
184 | # implicitly installed above
185 | RUN ${PYTHON} -m pip install 'ipython>=7.23.1'
186 |
187 | # RUN ${PYTHON} -m pip install mathicsscript[full]
188 | RUN ${PYTHON} -m pip install -e git+https://github.com/Mathics3/mathicsscript#egg=mathicsscript[full]
189 | RUN (cd src/mathicsscript && make)
190 |
191 | ##################
192 | # debug stuff #
193 | ##################
194 | RUN apt-get install -y -qq emacs
195 | # RUN pip install trepan3k
196 | RUN pip install remake
197 |
198 | ##################
199 | # Finish up #
200 | ##################
201 |
202 | # Cleanup
203 | RUN rm -fr /tmp*_amd64.deb /tmp/*.whl
204 |
205 | COPY entrypoint.sh /usr/local/bin/mathics-omnibus.sh
206 | RUN chmod +x /usr/local/bin/mathics-omnibus.sh
207 |
208 | EXPOSE 8000
209 |
210 | RUN groupadd mathics && \
211 | useradd -d $MATHICS_HOME -g mathics -m -s /bin/bash mathics && \
212 | mkdir -p $MATHICS_HOME/data && \
213 | chown -R mathics:mathics $MATHICS_HOME
214 |
215 | COPY django-db/mathics.sqlite /usr/src/app/.local/var/mathics/mathics.sqlite
216 | run chown -vR mathics:mathics /usr/src/app/.local/var/mathics/mathics.sqlite
217 | USER mathics
218 |
219 | RUN ${PYTHON} -m spacy download en_core_web_md
220 | RUN ${PYTHON} -m nltk.downloader wordnet omw-1.4
221 | RUN pyston -m spacy download en_core_web_sm
222 | RUN pyston -m nltk.downloader wordnet omw-1.4
223 |
224 | ENTRYPOINT ["/usr/local/bin/mathics-omnibus.sh"]
225 |
226 | CMD ["--help"]
227 |
--------------------------------------------------------------------------------
/docker/Dockerfile-git:
--------------------------------------------------------------------------------
1 | FROM ubuntu:jammy
2 |
3 | ENV MATHICS_HOME=/usr/src/app
4 |
5 | ENV ASY_VERSION=asymptote-2.78
6 | ENV MATHICS3_MODULE_OPTION="--load-module pymathics.graph,pymathics.natlang"
7 |
8 | ENV ENTRYPOINT_COMMAND="docker run -it {MATHICS3_IMAGE}"
9 | RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
10 | WORKDIR $MATHICS_HOME
11 |
12 | COPY requirements.txt ./
13 | RUN apt-get update
14 | RUN apt-get install -qq apt-utils
15 |
16 | # we need libsqlite3-dev now if ubuntu doesn't come with that, we'll need
17 | # to build our own Python
18 | # Leave out inkscape for now.
19 |
20 | # inxi and mesa-utils might be optional
21 | # npm pulls in nodejs, but we'll be explicit.
22 |
23 | RUN apt-get update -y && apt-get upgrade -y -qq
24 |
25 | # Install lots of packages
26 | RUN apt-get install -y -qq \
27 | cargo \
28 | evince \
29 | gfortran \
30 | git x11-apps \
31 | gyp \
32 | latexmk texlive-xetex \
33 | libffi7 \
34 | libgl1-mesa-dri \
35 | libgl1-mesa-glx \
36 | liblapack-dev \
37 | libmysqlclient-dev \
38 | libopenblas-dev \
39 | libxml2-dev \
40 | libxslt1-dev \
41 | llvm-11 \
42 | llvm-11-dev \
43 | llvm-12 \
44 | llvm-12-dev \
45 | lmodern texlive-latex-extra \
46 | maria \
47 | mesa-utils \
48 | nodejs \
49 | npm \
50 | pkg-config \
51 | python3-pip \
52 | rustc \
53 | sqlite3 \
54 | texlive-fonts-recommended \
55 | tk8.6-blt2.5 \
56 | xserver-xorg-video-all
57 |
58 | # Set up Pyston
59 | COPY src/*_amd64.deb /tmp/
60 | RUN dpkg -i /tmp/*_amd64.deb
61 |
62 | # to make docker layers be more usuable in development
63 | # defer deletion until close to the end
64 | # RUN rm -fr /tmp*_amd64.deb
65 |
66 | ENV PYTHON=python3.10
67 | ENV PIP=/usr/bin/pip3.10
68 | RUN $PYTHON -m pip install --upgrade pip
69 | COPY src/*.py3-none-any.whl src/*x86_64*.whl /tmp/
70 | RUN $PIP install wheel /tmp/*.py3-none-any.whl /tmp/*x86_64.whl
71 | RUN $PIP install --no-cache-dir -r requirements.txt
72 |
73 | ################
74 | # Mathics core #
75 | ################
76 | # RUN $PIP install git+https://github.com/Mathics3/mathics-core.git#egg=Mathics3[full]
77 | # RUN pip install "Mathics3[full]>=7.0.0"
78 |
79 | RUN apt-get install -y -qq librsvg2-bin pyqt5-dev-tools
80 |
81 | # We need newer versions of Asymptote and GhostScript for bulding the PDF
82 | RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y -qq freeglut3 libfftw3-double3 libglew2.2 libsigsegv2 ghostscript imagemagick texlive-pstricks
83 | COPY ubuntu-bin/gs /usr/local/bin/
84 |
85 | #--
86 | # build new version of Asymptote for our docs and for inside mathicsscript. The Ubuntu-distributed asymptote has bugs.
87 | #--
88 | RUN apt-get install -y -qq \
89 | autoconf \
90 | asymptote \
91 | bison \
92 | file \
93 | flex \
94 | freeglut3-dev \
95 | libcurl3-gnutls \
96 | libcurl4 \
97 | libcurl4 \
98 | libcurl4-gnutls-dev \
99 | libgc-dev \
100 | libgl-dev \
101 | libglm-dev \
102 | libreadline-dev \
103 | libsigsegv2 \
104 | texinfo
105 |
106 | # COPY src/${ASY_VERSION}.src.tgz .
107 | # RUN tar -xpf ${ASY_VERSION}.src.tgz
108 | # RUN (cd ${ASY_VERSION} && bash ./autogen.sh && ./configure --disable-lsp && make -j3 all && make -j3 install)
109 |
110 | RUN git clone https://github.com/Mathics3/mathics-core.git
111 | ENV DATA_DIR=/usr/src/app/mathics-core/mathics/doc/latex/
112 | ENV DOCTEST_LATEX_DATA_PCL=/usr/src/app/mathics-core/mathics/doc/latex/doctext_latex_data.pcl
113 | ENV DOCTEST_USER_HTML_DATA_PATH=/usr/src/app/mathics-core/mathics/doc/doc_html_data.pcl
114 |
115 | COPY tex-images/*.pdf mathics-core/mathics/doc/latex/
116 | ENV DOC_LATEX_FILE=/usr/src/app/mathics-core/mathics/doc/latex/documentation.tex
117 | RUN (cd mathics-core && $PIP install -e .[full])
118 | RUN (cd mathics-core && bash ./admin-tools/make-op-tables.sh)
119 |
120 | ####################################################
121 | # Mathics Pymathics and Pymathics Graph for Django #
122 |
123 | RUN $PIP install -e git+https://github.com/Mathics3/pymathics-graph#egg=pymathics-graph
124 | # RUN $PIP install "pymathics-graph>=6.2.0"
125 |
126 | RUN $PIP install -e git+https://github.com/Mathics3/pymathics-natlang#egg=pymathics-natlang
127 | # RUN $PIP install "pymathics-natlang>=6.2.0"
128 |
129 | RUN $PIP install spacy
130 | RUN $PYTHON -m spacy download en_core_web_sm
131 | RUN $PIP install nltk
132 | RUN $PYTHON -m nltk.downloader wordnet omw-1.4
133 |
134 | # This is a mess. Figure out how to make doc.
135 | COPY src/mathics.pdf mathics-core/mathics/doc/latex/mathics.pdf
136 | # RUN (cd mathics-core/mathics/doc/latex && PYTHON=$PYTHON make mathics.pdf) || /bin/true
137 | ##################
138 | # Mathics Django #
139 | ##################
140 | RUN git clone https://github.com/Mathics3/mathics-django.git
141 | RUN (cd mathics-django && $PIP install -e .[full])
142 | # Get threejs version created
143 | RUN (cd mathics-django && make build)
144 |
145 | # RUN $PYTHON -m pip install -e git+https://github.com/Mathics3/mathics-django#egg=Mathics-Django[full]
146 | # RUN $PYTHON -m pip install "Mathics-Django[full]>=6.2.0"
147 |
148 | # RUN (cd src/mathics-django && PIP=$PIP make)
149 | RUN (cd src/mathics-django && $PYTHON mathics_django/docpipeline.py -ok --want-sorting) || true
150 | COPY src/doc_html_data.pcl doc_html_data.pcl
151 | RUN mkdir -p /usr/src/app/.local/var/mathics && mv -v doc_html_data.pcl /usr/src/app/.local/var/mathics/doc_data_html.pcl
152 |
153 | ##################
154 | # Mathicsscript #
155 | ##################
156 |
157 | # Mathicsscript loses functionality with pyston because matplotlib doesn't render
158 | # images with it
159 | # Install python 3.10 packages
160 | RUn apt-get install -qq -y \
161 | python3 \
162 | python3-click \
163 | python3-cryptography \
164 | python3-cson \
165 | python3-dateutil \
166 | python3-matplotlib \
167 | python-matplotlib-data \
168 | python3-numpy \
169 | python3-pip \
170 | python3-psutil \
171 | python3-pyqt5 \
172 | python3-pyqt5.qtsvg \
173 | python3-setuptools \
174 | python3-sympy
175 |
176 | COPY requirements-mathicsscript.txt ./
177 | RUN $PIP install --no-cache-dir -r requirements-mathicsscript.txt
178 | RUN git clone https://github.com/Mathics3/mathicsscript.git
179 | RUN (cd mathicsscript && PYTHON=$PYTHON make install)
180 |
181 | RUN ${PYTHON} -m spacy download en_core_web_md
182 | RUN ${PYTHON} -m nltk.downloader wordnet omw-1.4
183 |
184 | # prompt toolkit needs an IPython that is newer than what got
185 | # implicitly installed above
186 | RUN ${PYTHON} -m pip install 'ipython>=7.23.1'
187 |
188 | # RUN ${PYTHON} -m pip install mathicsscript[full]
189 | RUN ${PYTHON} -m pip install -e git+https://github.com/Mathics3/mathicsscript#egg=mathicsscript[full]
190 | RUN (cd src/mathicsscript && make)
191 |
192 | # ##################
193 | # # debug stuff #
194 | # ##################
195 | # RUN apt-get install -y -qq emacs
196 | # RUN pip install trepan3k
197 | # RUN pip install remake
198 |
199 | ##################
200 | # Finish up #
201 | ##################
202 |
203 | # Cleanup
204 | RUN rm -fr /tmp*_amd64.deb /tmp/*.whl
205 |
206 | COPY entrypoint.sh /usr/local/bin/mathics-omnibus.sh
207 | RUN chmod +x /usr/local/bin/mathics-omnibus.sh
208 |
209 | EXPOSE 8000
210 |
211 | RUN groupadd mathics && \
212 | useradd -d $MATHICS_HOME -g mathics -m -s /bin/bash mathics && \
213 | mkdir -p $MATHICS_HOME/data && \
214 | chown -R mathics:mathics $MATHICS_HOME
215 |
216 | COPY django-db/mathics.sqlite /usr/src/app/.local/var/mathics/mathics.sqlite
217 | run chown -vR mathics:mathics /usr/src/app/.local/var/mathics/mathics.sqlite
218 | USER mathics
219 |
220 | RUN ${PYTHON} -m spacy download en_core_web_md
221 | RUN ${PYTHON} -m nltk.downloader wordnet omw-1.4
222 |
223 | ENTRYPOINT ["/usr/local/bin/mathics-omnibus.sh"]
224 |
225 | CMD ["--help"]
226 |
--------------------------------------------------------------------------------
/docker/Dockerfile-release:
--------------------------------------------------------------------------------
1 | FROM ubuntu:24.10
2 |
3 | ENV MATHICS3_HOME=/home/ubuntu
4 | ENV ENTRYPOINT_COMMAND="docker run -it {MATHICS_IMAGE}"
5 | ENV MATHICS3_MODULE_OPTION="--load-module pymathics.graph,pymathics.natlang,pymathics.trepan"
6 |
7 | WORKDIR $MATHICS3_HOME
8 |
9 | COPY entrypoint.sh /
10 | RUN chmod +x /entrypoint.sh
11 | RUN apt-get update
12 | RUN apt-get install -qq apt-utils
13 |
14 | RUN apt-get update -y && apt-get upgrade -y -qq
15 |
16 | # Install lots of packages
17 | RUN apt-get install -y -qq \
18 | asymptote \
19 | cargo \
20 | evince \
21 | gfortran \
22 | git \
23 | gyp \
24 | latexmk texlive-xetex \
25 | libffi-dev \
26 | liblapack-dev \
27 | libmysqlclient-dev \
28 | libopenblas-dev \
29 | librsvg2-bin \
30 | libxcb-cursor-dev \
31 | libxml2-dev \
32 | libxslt1-dev \
33 | llvm-15 \
34 | llvm-15-dev \
35 | lmodern texlive-latex-extra \
36 | maria \
37 | mesa-utils \
38 | nodejs \
39 | npm \
40 | pkg-config \
41 | pyqt5-dev-tools \
42 | python3-pip \
43 | python3.12-venv \
44 | remake \
45 | rustc \
46 | sqlite3 \
47 | texlive-fonts-recommended \
48 | tk8.6-blt2.5 \
49 | x11-apps \
50 | xserver-xorg-video-all
51 |
52 | RUN /usr/bin/python3.12 -m venv /opt/python3.12
53 | ENV PATH=.:/opt/python3.12/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
54 | ENV PYTHON=/opt/python3.12/bin/python3.12
55 | ENV PIP=/opt/python3.12/bin/pip
56 | RUN $PYTHON -m pip install --upgrade pip
57 |
58 | COPY src/doc_html_data.pcl doc_html_data.pcl
59 | RUN mkdir -p ${MATHICS3_HOME}/.local/var/Mathics3
60 | RUN mv -v doc_html_data.pcl ${MATHICS3_HOME}/.local/var/Mathics3/doc_data_html.pcl
61 | RUN mkdir -p ${MATHICS3_HOME}/mathics-core/mathics/doc/latex
62 | COPY src/mathics.pdf mathics-core/mathics/doc/latex/mathics.pdf
63 |
64 | RUN $PIP install Mathics3
65 | RUN $PIP install PyQt6
66 | RUN $PIP install mathicsscript
67 | RUN $PIP install Mathics-Django
68 | RUN $PIP install pymathics-graph
69 | RUN $PIP install Mathics3-trepan
70 |
71 | # RUN git clone --depth 1 https://github.com/Mathics3/Mathics3-trepan.git
72 | # RUN (cd Mathics3-trepan && $PIP install -e .)
73 |
74 | RUN $PIP install trepan3k-mathics3
75 |
76 | RUN $PIP install spacy wordcloud
77 | RUN $PYTHON -m spacy download en_core_web_md
78 | RUN $PIP install nltk
79 | RUN $PYTHON -m nltk.downloader wordnet omw-1.4
80 | RUN $PIP install pymathics-natlang
81 |
82 | COPY entrypoint.sh /usr/local/bin/mathics-omnibus.sh
83 | RUN chmod +x /usr/local/bin/mathics-omnibus.sh
84 |
85 | EXPOSE 8000
86 |
87 | RUN mkdir -p ${MATHICS3_HOME}/.local
88 | RUN mkdir -p ${MATHICS3_HOME}/.config
89 | RUN mkdir -p ${MATHICS3_HOME}/data
90 | RUN mkdir -p ${MATHICS3_HOME}/.local/var/Mathics3/Packages
91 | COPY django-db/mathics.sqlite ${MATHICS3_HOME}/.local/var/Mathics3/mathics.sqlite
92 | RUN chown -R ubuntu:ubuntu $MATHICS3_HOME ${MATHICS3_HOME}/.local
93 | USER ubuntu
94 |
95 | ENTRYPOINT ["/usr/local/bin/mathics-omnibus.sh"]
96 |
97 | CMD ["--help"]
98 |
--------------------------------------------------------------------------------
/docker/django-db/mathics.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Mathics3/mathics-omnibus/031bd8c7e11fd13d4133041b339227731c85fa07/docker/django-db/mathics.sqlite
--------------------------------------------------------------------------------
/docker/entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # This is the docker entry point and gets installed as /usr/local/bin/mathics.sh
3 |
4 | USER_HOME="/home/ubuntu"
5 | MATHICS_DJANGO_SYSTEM_DB_PATH="${USER_HOME}/.local/var/Mathics3/mathics.sqlite"
6 |
7 | export PATH="/opt/python3.12/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${USER_HOME}/.local/bin"
8 | export PYTHONBREAKPOINT=trepan.api.debug
9 |
10 | script_cmd="${ENTRYPOINT_COMMAND:-$(basename $0)}"
11 |
12 | function help {
13 | cat <= 1.0.1
7 | PyYAML # Used for admin-tools/make-tables.sh to build JSON tables
8 | PyQT5 # For interactive display of graphs via matplotlib
9 | cairosvg # For rendering Plots and Graphs as SVGs via matplotlib
10 |
--------------------------------------------------------------------------------
/docker/requirements.txt:
--------------------------------------------------------------------------------
1 | IPython>=7.23.1
2 | colorama
3 | cython
4 | django >= 3.2.0
5 | ipykernel
6 | ipywidgets
7 | langid
8 | llvmlite
9 | lxml
10 | mpmath>=1.2.1
11 | nltk
12 | palettable
13 | psutil
14 | pycountry
15 | pydot
16 | pyenchant
17 | pygments>=2.4.1 # To upgrade. Required very indirectly by jupyterlab-pygments. Old version is in focal
18 | python-dateutil
19 | requests
20 | requests
21 | scikit-image
22 | sympy>=1.8
23 | git+https://github.com/Mathics3/mathics-core.git#egg=Mathics3
24 |
--------------------------------------------------------------------------------
/docker/src/.gitignore:
--------------------------------------------------------------------------------
1 | /mathics.pdf
2 |
--------------------------------------------------------------------------------
/docker/src/doc_html_data.pcl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Mathics3/mathics-omnibus/031bd8c7e11fd13d4133041b339227731c85fa07/docker/src/doc_html_data.pcl
--------------------------------------------------------------------------------
/docker/src/version-info.tex:
--------------------------------------------------------------------------------
1 | %% Mathics core version number created via doc2latex.py
2 |
3 | \newcommand{\MathicsCoreVersion}{5.0.0}
4 | \newcommand{\PythonVersion}{3.9.12 (05fbe3aa5b0845e6c37239768aa455451aa5faba, Mar 29 2022, 08:15:34)
5 | [PyPy 7.3.9 with GCC 10.2.1 20210130 (Red Hat 10.2.1-11)]}
6 | \newcommand{\AsymptoteVersion}{Asymptote version 2.81 [(C) 2004 Andy Hammerlindl, John C. Bowman, Tom Prince]}
7 | \newcommand{\XeTeXVersion}{XeTeX 3.141592653-2.6-0.999993 (TeX Live 2022/dev/Debian)}
8 | \newcommand{\GhostscriptVersion}{9.56.1}
9 |
--------------------------------------------------------------------------------
/docker/tex-images/.gitignore:
--------------------------------------------------------------------------------
1 | /mathics.pdf
2 |
--------------------------------------------------------------------------------
/docker/tex-images/logo-heptatom.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Mathics3/mathics-omnibus/031bd8c7e11fd13d4133041b339227731c85fa07/docker/tex-images/logo-heptatom.pdf
--------------------------------------------------------------------------------
/docker/tex-images/logo-text-nodrop.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Mathics3/mathics-omnibus/031bd8c7e11fd13d4133041b339227731c85fa07/docker/tex-images/logo-text-nodrop.pdf
--------------------------------------------------------------------------------
/docker/tex-images/logo.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Mathics3/mathics-omnibus/031bd8c7e11fd13d4133041b339227731c85fa07/docker/tex-images/logo.pdf
--------------------------------------------------------------------------------
/docker/ubuntu-bin/gs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Mathics3/mathics-omnibus/031bd8c7e11fd13d4133041b339227731c85fa07/docker/ubuntu-bin/gs
--------------------------------------------------------------------------------
/docker/ubuntu-dpkg/libgsl25_2.6+dfsg-2_amd64.deb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Mathics3/mathics-omnibus/031bd8c7e11fd13d4133041b339227731c85fa07/docker/ubuntu-dpkg/libgsl25_2.6+dfsg-2_amd64.deb
--------------------------------------------------------------------------------
/mathics_omnibus/.gitignore:
--------------------------------------------------------------------------------
1 | /__pycache__
2 |
--------------------------------------------------------------------------------
/mathics_omnibus/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """\
3 | Copyright (C) 2011-2021 The Mathics Team.
4 | This program comes with ABSOLUTELY NO WARRANTY.
5 | This is free software, and you are welcome to redistribute it
6 | under certain conditions.
7 | See the documentation for the full license."""
8 |
9 | from mathics_scanner import *
10 | from mathics import *
11 | from mathicsscript import *
12 | from mathics_django import *
13 | from mathics_omnibus.version import __version__
14 |
--------------------------------------------------------------------------------
/mathics_omnibus/version.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # This file is suitable for sourcing inside POSIX shell as
4 | # well as importing into Python. That's why there is no
5 | # space around "=" below.
6 | # fmt: off
7 | __version__="8.0.0" # noqa
8 |
--------------------------------------------------------------------------------
/script/dmathics:
--------------------------------------------------------------------------------
1 | dmathics3
--------------------------------------------------------------------------------
/script/dmathics.cmd:
--------------------------------------------------------------------------------
1 | # Simple Powershell command file to run mathics
2 | # FIXME: add features of bash script
3 | docker run --name dmathics-cli --rm --tty --interactive --network=host mathicsorg/mathics:latest --mode mathics
4 |
--------------------------------------------------------------------------------
/script/dmathics3:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 | if [ -n "$DEBUG" ]; then
4 | set -x
5 | fi
6 |
7 | # The release name we are configured to run under.
8 | typeset dmathics_version='1.0.0'
9 |
10 | # Allow customization using POSIX environment variables:
11 | DOCKER=${DOCKER:-docker}
12 |
13 | TAG=${TAG:-latest}
14 | MATHICS3_IMAGE=${MATHICS3_IMAGE:-mathicsorg/mathics:${TAG}}
15 |
16 | for arg in "$@" ; do
17 | case "$arg" in
18 | -h | --help | help )
19 | cat <<_EOH
20 | usage:
21 | dmathics [options]
22 |
23 | A stripped-down command-line interface to Mathics run in a docker container
24 |
25 | Options specfic to dmathicsdoc:
26 |
27 | -u | -U | --upgrade | upgrade
28 | pull updates to the docker container if there is a new image
29 |
30 | -h| --help | help
31 | show this help and exit
32 |
33 | -V| --version
34 | show the dmathicsdoc version and exit
35 |
36 | _EOH
37 | stripped_args+=("--help")
38 | ;;
39 | -u | -U | --upgrade | upgrade)
40 | $DOCKER pull $MATHICS3_IMAGE
41 | ;;
42 | -v | -V | --version)
43 | echo "dmathicsdoc version ${dmathicsdoc_version}"
44 | exit 100
45 | ;;
46 | default)
47 | stripped_args+=($arg)
48 | esac
49 | done
50 |
51 | # Show environment variables
52 | for env_setting in MATHICS3_IMAGE; do
53 | echo $env_setting = ${!env_setting}
54 | done
55 |
56 |
57 | $DOCKER run \
58 | --rm \
59 | -it \
60 | --env "COLORFGBG=$COLORFGBG" \
61 | --name mathics-cli \
62 | --volume /tmp:/usr/src/app/data \
63 | $MATHICS3_IMAGE \
64 | --mode mathics -- $@
65 |
--------------------------------------------------------------------------------
/script/dmathics3-tokens:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 | if [ -n "$DEBUG" ]; then
4 | set -x
5 | fi
6 |
7 | # The release name we are configured to run under.
8 | typeset dmathics_version='1.0.0'
9 |
10 | # Allow customization using POSIX environment variables:
11 | DOCKER=${DOCKER:-docker}
12 |
13 | TAG=${TAG:-latest}
14 | MATHICS3_IMAGE=${MATHICS3_IMAGE:-mathicsorg/mathics:${TAG}}
15 |
16 | # Show environment variables
17 | for env_setting in MATHICS3_IMAGE; do
18 | echo $env_setting = ${!env_setting}
19 | done
20 |
21 |
22 | $DOCKER run --rm -it \
23 | --name mathics-cli \
24 | --volume /tmp:/usr/src/app/data \
25 | $MATHICS3_IMAGE \
26 | --mode mathics3-tokens -- $@
27 |
--------------------------------------------------------------------------------
/script/dmathicsdoc:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 | if [ -n "$DEBUG" ]; then
4 | set -x
5 | fi
6 |
7 | # The release name we are configured to run under.
8 | typeset dmathicsdoc_version='1.0.0'
9 |
10 | # Allow customization using POSIX environment variables:
11 | DOCKER=${DOCKER:-docker}
12 |
13 | TAG=${TAG:-latest}
14 | MATHICS3_IMAGE=${MATHICS3_IMAGE:-mathicsorg/mathics:${TAG}}
15 |
16 | for arg in "$@" ; do
17 | case "$arg" in
18 | -h | --help | help )
19 | cat <<_EOH
20 | usage:
21 | dmathicsdoc [options]
22 |
23 | Run a PDF vewier on the Mathics Reference contiained in the Mathics docker image.
24 |
25 | Options specfic to dmathicsdoc:
26 |
27 | -u | -U | --upgrade | upgrade
28 | pull updates to the docker container if there is a new image
29 |
30 | -h| --help | help
31 | show this help and exit
32 |
33 | -V| --version
34 | show the dmathicsdoc version and exit
35 |
36 | _EOH
37 | exit 101
38 | ;;
39 | -u | -U | --upgrade | upgrade)
40 | $DOCKER pull $MATHICS3_IMAGE
41 | ;;
42 | -v | -V | --version)
43 | echo "dmathicsdoc version ${dmathicsdoc_version}"
44 | exit 100
45 | ;;
46 | default)
47 | stripped_args+=($arg)
48 | esac
49 | done
50 |
51 | # Show environment variables
52 | for env_setting in MATHICS3_IMAGE DISPLAY; do
53 | echo $env_setting = ${!env_setting}
54 | done
55 |
56 | $DOCKER run -it \
57 | --name mathics-doc \
58 | --rm \
59 | --env="DISPLAY" \
60 | --workdir=/app \
61 | --volume="$PWD":/app \
62 | --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
63 | --volume="/tmp:/usr/src/app/data" \
64 | $MATHICS3_IMAGE \
65 | --mode pdf -- $@
66 |
--------------------------------------------------------------------------------
/script/dmathicsdoccopy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 | if [ -n "$DEBUG" ]; then
4 | set -x
5 | fi
6 |
7 | # Allow customization using POSIX environment variables:
8 | DOCKER=${DOCKER:-docker}
9 | TEMPDIR=${TMPDIR:-/tmp}
10 |
11 | TAG=${TAG:-latest}
12 | MATHICS3_IMAGE=${MATHICS3_IMAGE:-mathicsorg/mathics:${TAG}}
13 |
14 | for arg in "$@" ; do
15 | case "$arg" in
16 | -u | -U | --upgrade | upgrade)
17 | $DOCKER pull $MATHICS3_IMAGE
18 | exit $?
19 | ;;
20 | -h | --help | help )
21 | cat <<_EOH
22 | Usage: dmathicscopy [OPTIONS]
23 |
24 | A command-line routine to extract mathics documentation from a Mathics docker container
25 |
26 | Options specfic to dmathicsscript:
27 |
28 | -u | -U | --upgrade | upgrade
29 | Pull updates to the docker container if there is a new image.
30 |
31 | -h| --help | help
32 | Show this help.
33 |
34 | Useful Environment Variables:
35 |
36 | DOCKER: the name of the docker program to run. The default is: ${DOCKER}
37 | MATHICS3_IMAGE: Mathics image to use. The default is: ${MATHICS3_IMAGE}
38 | TAG: tag used in MATHICS3_IMAGE above. The default is: ${TAG}
39 | XAUTH: .Xauthority file. The default is: ${XAUTH}
40 | _EOH
41 | exit 0 ;;
42 | -u | -U | --upgrade | upgrade)
43 | $DOCKER pull $MATHICS3_IMAGE
44 | ;;
45 | esac
46 | done
47 |
48 | $DOCKER run -it \
49 | --name mathics-copy \
50 | --env "TEMPDIR=$TEMPDIR" \
51 | --rm \
52 | --workdir=/app \
53 | --volume="$PWD":/app \
54 | --volume="${TEMPDIR}:/usr/src/app/data" \
55 | $MATHICS3_IMAGE \
56 | --mode copy -- $@
57 |
--------------------------------------------------------------------------------
/script/dmathicsscript:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 | if [ -n "$DEBUG" ]; then
4 | set -x
5 | fi
6 |
7 |
8 | # The release name we are configured to run under.
9 | # FIXME: get from mathics_omnibus_version
10 | typeset dmathicsserver_version='5.0.0.dev0'
11 |
12 | #########################################################
13 | # Allow customization using POSIX environment variables:
14 | #########################################################
15 |
16 | APP_DATADIR=${APP_DATADIR:-/tmp} #
17 |
18 | CONFIGDIR=${CONFIGDIR:-$HOME/.config/mathicsscript/}
19 |
20 | # Graphics Device that mathicsscript will use to output graphics
21 | if [[ -r /dev/dri ]]; then
22 | DEFAULT_GRAPHICS_DEVICE='--device=/dev/dri:/dev/dri'
23 | fi
24 | GRAPHICS_DEVICE=${DEFAULT_GRAPHICS_DEVICE:-''}
25 |
26 | DOCKER=${DOCKER:-docker}
27 |
28 | # TODO: allow setting:
29 | # MATHICSSCRIPT_HISTSIZE \
30 |
31 | # MPLCONFIGDIR is the workspace and configuration directory for matplotlib
32 | MPLCONFIGDIR=${MPLCONFIGDIR:-/tmp}
33 |
34 | # Docker tag we use by default
35 | TAG=${TAG:-latest}
36 |
37 | XAUTH=${XAUTH:-$HOME/.Xauthority}
38 | touch $XAUTH
39 |
40 | # Docker mathics contianer we use.
41 | # Note: has to come af we set after TAG
42 | MATHICS3_IMAGE=${MATHICS3_IMAGE:-mathicsorg/mathics:${TAG}}
43 |
44 |
45 | # end customization section
46 | #########################################################
47 |
48 | typeset -a stripped_args
49 | stripped_args=()
50 | e_args=()
51 | typeset -a args
52 | typeset -i n=$#
53 | for ((i=1; i<=n; i++)) ; do
54 | arg=$1
55 | shift
56 | case "$arg" in
57 | -e)
58 | # for -e we need to quote its argument
59 | e_args[0]="-e"
60 | e_args[1]=$1
61 | shift
62 | ((i+=1))
63 | ;;
64 | -h | --help | help )
65 | cat <<_EOH
66 | Usage: dmathicsscript [OPTIONS]
67 |
68 | A command-line interface to Mathics run in a docker container
69 |
70 | Options specfic to dmathicsscript:
71 |
72 | -u | -U | --upgrade | upgrade
73 | Pull updates to the docker container if there is a new image.
74 |
75 | -h | --help | help
76 | Show this help.
77 |
78 | -v | -V | --version
79 | Show the dmathicsscript version and exit.
80 |
81 | Useful Environment Variables:
82 |
83 | APP_DATADIR: where application data should be saved. The default is: ${APP_DATADIR}
84 | DOCKER: the name of the docker program to run. The default is: ${DOCKER}
85 | CONFIGDIR: directory where Mathics command history is saved. The default is: ${CONFIGDIR}
86 | MATHICS3_IMAGE: Mathics image to use. The default is: ${MATHICS3_IMAGE}
87 | TAG: tag used in MATHICS3_IMAGE above. The default is: ${TAG}
88 | XAUTH: .Xauthority file. The default is: ${XAUTH}
89 |
90 | We will now pass help along to the docker image. Just a sec...
91 |
92 | _EOH
93 | stripped_args+=("--help")
94 | ;;
95 | -u | -U | --upgrade | upgrade)
96 | $DOCKER pull $MATHICS3_IMAGE
97 | exit $?
98 | ;;
99 | -v | -V | --version)
100 | echo "dmathicsserver version ${dmathicsserver_version}"
101 | exit 100
102 | ;;
103 | * | default)
104 | stripped_args[$i]=$arg
105 | ;;
106 | esac
107 | done
108 |
109 | cd $(dirname ${BASH_SOURCE[0]})
110 | source ./term-background.sh
111 |
112 | [[ -x ./term-background.sh ]] && source ./term-background.sh
113 |
114 | if [[ $COLORFGBG == '15;0' ]] ; then
115 | # Dark background
116 | style="--style inkpot"
117 |
118 | else
119 | # Light background
120 | style="--style colorful"
121 | fi
122 |
123 | # Show environment variables
124 | for env_setting in CONFIGDIR APP_DATADIR MATHICS3_IMAGE DISPLAY; do
125 | echo $env_setting = ${!env_setting}
126 | done
127 |
128 | $DOCKER run \
129 | --rm \
130 | --env "COLORFGBG=$COLORFGBG" \
131 | --env "DISPLAY=$DISPLAY" \
132 | --env "PYTHON=/opt/python3.12/bin/python3.12" \
133 | --env "MPLCONFIGDIR=${MPLCONFIGDIR}" \
134 | --name mathics-cli \
135 | --tty \
136 | --user=$(id -u) \
137 | --interactive \
138 | --network=host \
139 | --volume="$PWD":/app \
140 | --volume "${APP_DATADIR}:/usr/src/app/data" \
141 | --volume "${CONFIGDIR}:/home/ubuntu/.config/mathicsscript" \
142 | $GRAPHICS_DEVICE \
143 | $MATHICS3_IMAGE \
144 | --mode cli -- $style ${stripped_args[@]} ${e_args[0]} "${e_args[1]}"
145 |
--------------------------------------------------------------------------------
/script/dmathicsscript.cmd:
--------------------------------------------------------------------------------
1 | rem Simple Powershell command file to run mathicsscript
2 | rem add features of bash script
3 | docker run --name mathics-cli --rm --tty --interactive --network=host mathicsorg/mathics:latest --mode cli
4 |
--------------------------------------------------------------------------------
/script/dmathicsserver:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 | if [ -n "$DEBUG" ]; then
4 | set -x
5 | fi
6 |
7 | # The release name we are configured to run under.
8 | typeset dmathicsserver_version='2.0.0'
9 |
10 | # Allow customization using POSIX environment variables:
11 | APP_DATADIR=${APP_DATADIR:-/tmp}
12 | DOCKER=${DOCKER:-docker}
13 | ASYMPTOTE_PDFVIEWER=${ASYMPTOTE_PDFVIWER:-/usr/bin/evince}
14 | USER_HOME="/home/ubuntu"
15 | MATHICS_DJANGO_DB=${MATHICS_DJANGO_DB:-"mathics.sqlite"}
16 | MATHICS_DJANGO_DB_PATH=${MATHICS_DJANGO_DB_PATH:-${USER_HOME}/.local/var/Mathics3/${MATHICS_DJANGO_DB}}
17 | TAG=${TAG:-latest}
18 |
19 | MATHICS3_IMAGE=${MATHICS3_IMAGE:-mathicsorg/mathics:${TAG}}
20 |
21 | typeset -a stripped_args
22 | stripped_args=()
23 |
24 | for arg in "$@" ; do
25 | case "$arg" in
26 | -h | --help | help )
27 | cat <<_EOH
28 | usage:
29 | dmathicsserver [options]
30 |
31 | runs the Mathics command-line interface from a docker container.
32 |
33 | Options specfic to dmathicsserver:
34 |
35 | -u | -U | --upgrade | upgrade
36 | pull updates to the docker container if there is a new image
37 |
38 | -h| --help | help
39 | show this help
40 |
41 | -V| --version
42 | show the dmathicserver version and exit
43 |
44 | We will now pass help along to the docker image. Just a sec...
45 |
46 | _EOH
47 | stripped_args+=("--help")
48 | ;;
49 | -u | -U | --upgrade | upgrade)
50 | $DOCKER pull $MATHICS3_IMAGE
51 | ;;
52 | -v | -V | --version)
53 | echo "dmathicsserver version ${dmathicsserver_version}"
54 | exit 100
55 | ;;
56 | default)
57 | stripped_args+=($arg)
58 | esac
59 | done
60 |
61 | # Show environment variables
62 | for env_setting in MATHICS_DJANGO_DB_PATH APP_DATADIR MATHICS3_IMAGE DISPLAY; do
63 | echo $env_setting = ${!env_setting}
64 | done
65 |
66 | $DOCKER run \
67 | -it \
68 | --name mathics-django \
69 | --rm \
70 | --env "COLORFGBG=$COLORFGBG" \
71 | --env="DISPLAY" \
72 | --env="ASYMPTOTE_PDFVIEWER=/usr/bin/evince" \
73 | --env "MATHICS_DJANGO_DB_PATH=$MATHICS_DJANGO_DB_PATH" \
74 | --env "PYTHON=/opt/python3.12/bin/python3.12" \
75 | --user=$(id -u) \
76 | --workdir=/app \
77 | --volume="$PWD":/app \
78 | --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
79 | --volume="${APP_DATADIR}:/usr/src/app/data" \
80 | -p 8000:8000 \
81 | $MATHICS3_IMAGE \
82 | --mode ui -- $stripped_args
83 |
--------------------------------------------------------------------------------
/script/term-background.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # ^^^^^^^^^^^^ Use env rather than assume we've got /bin/bash.
3 | # This works better on OSX where /bin/bash is brain dead.
4 |
5 | # Copyright (C) 2019-2020, Rocky Bernstein
6 | # This program is free software; you can redistribute it and/or
7 | # modify it under the terms of the GNU General Public License as
8 | # published by the Free Software Foundation; either version 2, or
9 | # (at your option) any later version.
10 | #
11 | # This program is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | # General Public License for more details.
15 | #
16 | # You should have received a copy of the GNU General Public License
17 | # along with this program; see the file COPYING. If not, write to
18 | # the Free Software Foundation, 59 Temple Place, Suite 330, Boston,
19 | # MA 02111 USA.
20 |
21 | # Try to determine if we have dark or light terminal background
22 |
23 | typeset -i success=0
24 | typeset method="xterm control"
25 |
26 | # On return, variable is_dark_bg is set
27 | # We follow Emacs logic (at least initially)
28 | get_default_colorfgbg() {
29 | if [[ -n $COLORFGBG ]]; then
30 | method="COLORFGBG"
31 | is_dark_colorfgbg
32 | elif [[ -n $TERM ]]; then
33 | case $TERM in
34 | xterm-256color)
35 | # 382.5 = (* .6 (+ 255 255 255))
36 | TERMINAL_COLOR_MIDPOINT=${TERMINAL_COLOR_MIDPOINT:-383}
37 | ;;
38 | xterm* | dtterm | eterm*)
39 | # 117963 = (* .6 (+ 65535 65535 65535))
40 | TERMINAL_COLOR_MIDPOINT=${TERMINAL_COLOR_MIDPOINT:-117963}
41 | is_dark_bg=0
42 | ;;
43 |
44 | *)
45 | TERMINAL_COLOR_MIDPOINT=${TERMINAL_COLOR_MIDPOINT:-117963}
46 | is_dark_bg=1
47 | ;;
48 | esac
49 | fi
50 | }
51 |
52 | # Pass as parameters R G B values in hex
53 | # Compare FG to BG for light/dark, not just FB and midpoint
54 | # NOTE: We could have FG=#403020 BG=#203040 and tie
55 | # On return, variable is_dark_bg is set
56 | is_dark_rgb() {
57 | typeset fg_r fg_g fg_b
58 | typeset bg_r bg_g bg_b
59 | fg_r=$1
60 | fg_g=$2
61 | fg_b=$3
62 | bg_r=$4
63 | bg_g=$5
64 | bg_b=$6
65 | a_fg=$((16#"$fg_r" + 16#"$fg_g" + 16#"$fg_b"))
66 | a_bg=$((16#"$bg_r" + 16#"$bg_g" + 16#"$bg_b"))
67 | if [[ $a_fg -gt $a_bg ]]; then
68 | is_dark_bg=1
69 | else
70 | is_dark_bg=0
71 | fi
72 | }
73 |
74 | # NOTE: We could have FG=#403020 BG=#203040 and tie
75 | # On return, variable is_dark_bg is set
76 | is_dark_rgb_from_bg() {
77 | midpoint=32767
78 | bg_r=$1
79 | bg_g=$2
80 | bg_b=$3
81 | typeset -i a_bg=$((16#"$bg_r" + 16#"$bg_g" + 16#"$bg_b"))
82 | if (( a_bg < midpoint )); then
83 | is_dark_bg=1
84 | else
85 | is_dark_bg=0
86 | fi
87 | }
88 |
89 | # Consult (environment) variable COLORFGB
90 | # On return, variable is_dark_bg is set
91 | is_dark_colorfgbg() {
92 | case $COLORFGBG in
93 | '15;0' | '15;default;0')
94 | is_dark_bg=1
95 | success=1
96 | ;;
97 | '0;15' | '0;default;15')
98 | is_dark_bg=0
99 | success=1
100 | ;;
101 | *)
102 | is_dark_bg=-1
103 | ;;
104 | esac
105 | }
106 |
107 | is_sourced() {
108 | if [[ $0 == ${BASH_SOURCE[0]} ]]; then
109 | return 1
110 | else
111 | return 0
112 | fi
113 | }
114 |
115 | # Exit if we are not source.
116 | # if sourced, then we just set exitrc
117 | # which was assumed to be declared outside
118 | exit_if_not_sourced() {
119 | exitrc=${1:-0}
120 | if ! is_sourced; then
121 | exit "$exitrc"
122 | fi
123 | }
124 |
125 | # From:
126 | # http://unix.stackexchange.com/questions/245378/common-environment-variable-to-set-dark-or-light-terminal-background/245381#245381
127 | # and:
128 | # https://bugzilla.gnome.org/show_bug.cgi?id=733423#c1
129 | #
130 | # User should set up RGB_fg and RGB_bg arrays
131 | xterm_compatible_fg_bg() {
132 | typeset fg bg
133 | # Turn TTY off
134 | stty -echo 2>/dev/null
135 | # Issue command to get foreground
136 | echo -ne '\e]10;?\a'
137 | # Read back in terminal program reporting its OSC fg values
138 | IFS=: read -t 0.1 -d $'\a' x fg
139 | # Turn TTY back on
140 | stty echo 2>/dev/null
141 | # Remove any escape or control characters
142 | # Note: gnome-terminal tacked \e at end
143 | fg=$(echo "$fg" | sed 's/[^a-zA-Z0-9/]//g')
144 | [[ -z $fg ]] && return 1
145 | # Convert to array
146 | typeset -p fg
147 | IFS='/' read -ra RGB_fg <<<"$fg"
148 | typeset -p RGB_fg
149 |
150 | # Turn TTY off
151 | stty -echo 2>/dev/null
152 | # Issue command to get background
153 | echo -ne '\e]11;?\a'
154 | # Read back in terminal program reporting its OSC bg values
155 | # purposely reading x, then discarding it.
156 | IFS=: read -t 0.1 -d $'\a' x bg
157 | # Turn TTY back on
158 | stty echo 2>/dev/null
159 | # Remove any escape or control characters
160 | # Note: gnome-terminal tacked \e at end
161 | bg=$(echo "$bg" | sed 's/[^a-zA-Z0-9/]//g')
162 | [[ -z $bg ]] && return 1
163 | # Convert to array
164 | typeset -p bg
165 | IFS='/' read -ra RGB_bg <<<"$bg"
166 | typeset -p RGB_bg
167 | xterm_osc_done=1
168 | return 0
169 | }
170 |
171 | # From a comment left by user "duthen" in my StackOverflow answer cited above.
172 | osx_get_terminal_fg_bg() {
173 | if [[ -n $COLORFGBG ]]; then
174 | method="COLORFGBG"
175 | is_dark_colorfgbg
176 | else
177 | RGB_bg=($(osascript -e 'tell application "Terminal" to get the background color of the current settings of the selected tab of front window'))
178 | retsts=$?
179 | # typeset -p RGB_bg
180 | ((retsts != 0)) && return 1
181 | is_dark_rgb_from_bg ${RGB_bg[@]}
182 | method="OSX osascript"
183 | success=1
184 | fi
185 | }
186 |
187 | typeset -i success=0
188 | typeset -i is_dark_bg=0
189 | typeset -i exitrc=0
190 | typeset -i xterm_osc_done=0
191 |
192 | # Pre-analysis for non-COLORFGBG terminals
193 | if (( 3711 < VTE_VERSION )) && [[ -z "$COLORFGBG" ]]; then
194 | # Try Xterm Operating System Command (OSC) (Esc-])
195 | if xterm_compatible_fg_bg; then
196 | is_dark_rgb ${RGB_fg[@]} ${RGB_bg[@]}
197 | if [[ $is_dark_bg == 1 ]]; then
198 | # Even though, we're xterm, assist COLORFGBG
199 | export COLORFGBG='0;15'
200 | else
201 | # Even though, we're xterm, assist COLORFGBG
202 | export COLORFGBG='15;0'
203 | fi
204 | else
205 | echo "xterm/vte Esc-] OSC has empty string"
206 | get_default_colorfgbg
207 | fi
208 | unset x fg bg avg_RGB_fg avg_RGB_bg
209 | fi
210 |
211 | if [[ ${BASH_VERSINFO[5]} == *"darwin"* ]]; then
212 | osx_get_terminal_fg_bg
213 | fi
214 |
215 | if ((!success)) && [[ -n $TERM ]]; then
216 | case $TERM in
217 | xterm* | gnome | rxvt* | linux)
218 | typeset -a RGB_fg RGB_bg
219 | if [[ $xterm_osc_done -eq 1 ]]; then
220 | if xterm_compatible_fg_bg; then
221 | is_dark_rgb ${RGB_fg[@]} ${RGB_bg[@]}
222 | fi
223 | success=1
224 | fi
225 | ;;
226 | *) ;;
227 |
228 | esac
229 | fi
230 |
231 | if ((success)); then
232 | if ((is_dark_bg == 1)); then
233 | echo "Dark background from ${method}"
234 | else
235 | echo "Light background from ${method}"
236 | fi
237 | elif [[ -n $COLORFGBG ]]; then
238 | # Note that this can be wrong if
239 | # COLORFGBG was set prior invoking a terminal
240 | is_dark_colorfgbg
241 | case $is_dark_bg in
242 | 0)
243 | echo "Light background from COLORFGBG"
244 | ;;
245 | 1)
246 | echo "Dark background from COLORFGBG"
247 | ;;
248 | -1 | *)
249 | echo "Can't decide from COLORFGBG"
250 | exit_if_not_sourced 1
251 | ;;
252 | esac
253 | else
254 | echo "Can't decide"
255 | exit_if_not_sourced 1
256 | fi
257 |
258 | # If we were sourced, then set
259 | # some environment variables
260 | if is_sourced; then
261 | if ((exitrc == 0)); then
262 | if ((is_dark_bg == 1)); then
263 | export DARK_BG=1 # deprecated
264 | export LC_DARK_BG=1
265 | if [[ -z "$COLORFGBG" ]]; then
266 | export COLORFGBG='0;15'
267 | fi
268 | else
269 | export DARK_BG=0
270 | export LC_DARK_BG=0
271 | if [[ -z "$COLORFGBG" ]] ; then
272 | export COLORFGBG='15;0'
273 | fi
274 | fi
275 | fi
276 | else
277 | exit 0
278 | fi
279 |
--------------------------------------------------------------------------------
/setup.cfg:
--------------------------------------------------------------------------------
1 | [bdist_wheel]
2 | universal = 1
3 |
4 | [metadata]
5 | description_file = README.rst
6 |
7 | # Recommended flake8 settings while editing zoom, we use Black for the final
8 | # linting/say in how code is formatted
9 | #
10 | # pip install flake8 flake8-bugbear
11 | #
12 | # This will warn/error on things that black does not fix, on purpose.
13 |
14 | # This config file MUST be ASCII to prevent weird flake8 dropouts
15 |
16 | [flake8]
17 | # max-line-length setting: NO we do not want everyone writing 120-character lines!
18 | # We are setting the maximum line length big here because there are longer
19 | # lines allowed by black in some cases that are forbidden by flake8. Since
20 | # black has the final say about code formatting issues, this setting is here to
21 | # make sure that flake8 doesn't fail the build on longer lines allowed by
22 | # black.
23 | max-line-length = 120
24 | max-complexity = 12
25 | select = E,F,W,C,B,B9
26 | ignore =
27 | # E123 closing bracket does not match indentation of opening bracket's line
28 | E123
29 | # E203 whitespace before ':' (Not PEP8 compliant, Python Black)
30 | E203
31 | # E501 line too long (82 > 79 characters) (replaced by B950 from flake8-bugbear,
32 | # https://github.com/PyCQA/flake8-bugbear)
33 | E501
34 | # W503 line break before binary operator (Not PEP8 compliant, Python Black)
35 | W503
36 | # W504 line break after binary operator (Not PEP8 compliant, Python Black)
37 | W504
38 | # C901 function too complex - since many of zz9 functions are too complex with a lot
39 | # of if branching
40 | C901
41 | # module level import not at top of file. This is too restrictive. Can't even have a
42 | # docstring higher.
43 | E402
44 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | """Python Setuptools for installation of a suite of Mathics3 PyPI packages."""
4 |
5 | from setuptools import setup
6 | from __pkginfo__ import (
7 | EXTRAS_REQUIRE,
8 | __version__,
9 | author,
10 | author_email,
11 | classifiers,
12 | install_requires,
13 | long_description,
14 | packages,
15 | scripts,
16 | short_desc,
17 | url,
18 | )
19 |
20 | setup(
21 | name="Mathics-omnibus",
22 | version=__version__,
23 | author=author,
24 | author_email=author_email,
25 | classifiers=classifiers,
26 | description=short_desc,
27 | extras_require=EXTRAS_REQUIRE,
28 | scripts=scripts,
29 | long_description=long_description,
30 | long_description_content_type="text/x-rst",
31 | packages=packages,
32 | install_requires=install_requires,
33 | url=url,
34 | )
35 |
--------------------------------------------------------------------------------