Skip to content

Commit

Permalink
setup wasm library
Browse files Browse the repository at this point in the history
  • Loading branch information
kp992 committed Jan 4, 2025
1 parent 8539152 commit 4c188e3
Show file tree
Hide file tree
Showing 173 changed files with 27,196 additions and 1 deletion.
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: conda-build

on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main

jobs:
tests:
runs-on: ubuntu-latest
strategy:
max-parallel: 5

steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
environment-file: environment.yml
python-version: '3.13'
- name: Conda info
shell: bash -l {0}
run: |
conda info
conda list
- name: Test with pytest
shell: bash -l {0}
run: |
conda install pytest
pytest -n auto
publish:

name: Publish to PyPi
needs: [tests]
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.x"
- name: Install flit
run: |
pip install flit~=3.6
- name: Build and publish
run: |
flit publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI_TOKEN }}
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
*.pyc
*.ipynb_checkpoints*

__pycache__/*
build/
/dist/
quantecon.egg-info/
*.DS_Store
*.TODO
*.noseids
*.coverage
*.h5
*.lcov
.pytest_cache/*

# Numba cache files
*.nbc
*.nbi

# Coverage

coverage.xml
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

Copyright © 2013-2025 Thomas J. Sargent and John Stachurski: MIT
All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include README.md
include LICENSE.txt
recursive-include quantecon/tests/data *
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# QuantEcon.py-wasm
QuantEcon.py package for wasm environments.

QuantEcon's pure python package for WASM based environments. This library is a mirror of [QuantEcon.py](https://github.com/QuantEcon/QuantEcon.py).
We highly recommend to use the original `quantecon` for better performance.

Anything that works with `quantecon_wasm.*` is expected to work with `quantecon.*` with equal or higher performance.

## Installation

You can install `quantecon_wasm` by opening a terminal prompt and typing

```
pip install quantecon_wasm
```
18 changes: 18 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: qe
channels:
- conda-forge
- defaults
dependencies:
- coverage
- numpy>=2
- scipy
- pandas
- sympy
- ipython
- flake8
- requests
- urllib3>=2
- flit
- chardet # python>3.9,osx
- pytest
- pytest-xdist
67 changes: 67 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[build-system]
requires = ["flit_core >=3.5,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "quantecon_wasm"
authors = [{name = "QuantEcon Project", email = "[email protected]"}]
classifiers = [
'Development Status :: 4 - Beta',
'Operating System :: OS Independent',
'Intended Audience :: Science/Research',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Topic :: Scientific/Engineering',
]
keywords = [
'quantitative',
'economics'
]
dynamic = ["description", "version"]
requires-python = ">=3.7"
dependencies = [
'numpy>=1.17.0',
'requests',
'scipy>=1.5.0',
'sympy',
]

[project.optional-dependencies]
testing = [
"pytest",
"coverage",
"flake8",
"numpy",
"scipy",
"pandas",
"sympy",
]


[project.license]
file = "LICENSE"

[project.readme]
file = "README.md"
content-type = "text/markdown"

[project.urls]
Homepage = "https://quantecon.org/quantecon-py/"
Documentation = "http://quanteconpy.readthedocs.org/en/latest/"
Funding = "https://quantecon.org"
Source = "https://github.com/quantecon/QuantEcon.py"
Tracker = "https://github.com/quantecon/QuantEcon.py/issues"

[tool.flit.module]
name = "quantecon_wasm"

[tool.flit.sdist]
exclude = [
".*", # Any hidden folders or files
"quantecon_wasm/tests/",
"quantecon_wasm/util/tests",
"Makefile",
"environment.yml",
"readthedocs.yml",
]
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
48 changes: 48 additions & 0 deletions quantecon_wasm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# flake8: noqa
"""
Import the main names to top level.
"""

__version__ = '0.7.2'

#-Modules-#
from . import distributions
from . import game_theory
from . import quad
from . import random
from . import optimize

#-Objects-#
from ._compute_fp import compute_fixed_point
from ._discrete_rv import DiscreteRV
from ._dle import DLE
from ._ecdf import ECDF
from ._estspec import smooth, periodogram, ar_periodogram
# from .game_theory import <objects-here> #Place Holder if we wish to promote any general objects to the qe namespace.
from ._graph_tools import DiGraph, random_tournament_graph
from ._gridtools import (
cartesian, mlinspace, cartesian_nearest_index, simplex_grid, simplex_index,
num_compositions
)
from ._inequality import lorenz_curve, gini_coefficient, shorrocks_index, \
rank_size
from ._kalman import Kalman
from ._lae import LAE
from ._arma import ARMA
from ._lqcontrol import LQ, LQMarkov
from ._filter import hamilton_filter
from ._lqnash import nnash
from ._ivp import IVP
from ._lss import LinearStateSpace
from ._matrix_eqn import solve_discrete_lyapunov, solve_discrete_riccati
from ._quadsums import var_quadratic_sum, m_quadratic_sum
#->Propose Delete From Top Level
#Promote to keep current examples working
from .markov import MarkovChain, random_markov_chain, random_stochastic_matrix, \
gth_solve, tauchen, rouwenhorst, estimate_mc
#Imports that Should be Deprecated with markov package
from .markov import mc_compute_stationary, mc_sample_path
#<-
from ._rank_nullspace import rank_est, nullspace
from ._robustlq import RBLQ
from .util import searchsorted, fetch_nb_dependencies, tic, tac, toc
Loading

0 comments on commit 4c188e3

Please sign in to comment.