Skip to content

Commit

Permalink
🔧 MAINTAIN: Move to flit for PEP 621 package builds (#608)
Browse files Browse the repository at this point in the history
* MAINT: Move to using flit for build system

* migrate from python setup.py to pip install

* TST: Update conda workflows for testing

* python=3.9,osx seems to need chardet installed

* add ignore on util tests

* fix README conflict

* move publish to conda_ci as future

* update developer install to flit

* remove setup.py

* remove editable mode for pip install with pyproject.toml, migrate numba fix

* remove unecessary dependencies
  • Loading branch information
mmcky committed Apr 7, 2022
1 parent 538bf7c commit df6ad8b
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 102 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/conda_ci.yml
Expand Up @@ -41,8 +41,8 @@ jobs:
- name: Setup QuantEcon
shell: bash -l {0}
run: |
conda activate test
python setup.py build
pip install -U pip
pip install .[testing]
- name: flake8 Tests
shell: bash -l {0}
Expand All @@ -61,3 +61,26 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov

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@v3
- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: 3.8
- 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 }}
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Expand Up @@ -23,15 +23,15 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U numpy scipy pandas numba sympy ipython flake8 pytest coverage
python setup.py install
pip install flit~=3.6
pip install .[testing]
- name: flake8 Tests
run: |
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -52,6 +52,7 @@ An alternative is to download the sourcecode of the `quantecon` package and in

Once you have downloaded the source files then the package can be installed by running

python setup.py install
pip install flit
flit install

(To learn the basics about setting up Git see [this link](https://help.github.com/articles/set-up-git/).)
2 changes: 2 additions & 0 deletions environment.yml
Expand Up @@ -12,4 +12,6 @@ dependencies:
- ipython
- flake8
- requests
- flit
- chardet # python>3.9,osx
- pytest
70 changes: 70 additions & 0 deletions pyproject.toml
@@ -0,0 +1,70 @@
[build-system]
requires = ["flit_core >=3.5,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "quantecon"
authors = [{name = "QuantEcon Project", email = "admin@quantecon.org"}]
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 = [
'numba',
'numpy',
'requests',
'scipy>=1.0.0',
'sympy',
]

[project.optional-dependencies]
testing = [
"pytest",
"coverage",
"flake8",
"numpy",
"scipy",
"pandas",
"numba",
"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"

[tool.flit.sdist]
exclude = [
".*", # Any hidden folders or files
"docs/",
"quantecon/tests/",
"quantecon/util/tests",
"Makefile",
"environment.yml",
"readthedocs.yml",
]
4 changes: 2 additions & 2 deletions quantecon/__init__.py
Expand Up @@ -3,15 +3,15 @@
Import the main names to top level.
"""

__version__ = '0.5.2'

try:
import numba
except:
raise ImportError(
"Cannot import numba from current anaconda distribution. \
Please run `conda install numba` to install the latest version.")

__version__ = '0.5.2'

#-Modules-#
from . import distributions
from . import game_theory
Expand Down
94 changes: 0 additions & 94 deletions setup.py

This file was deleted.

0 comments on commit df6ad8b

Please sign in to comment.