Skip to content

Commit

Permalink
Merge pull request #109 from QCoDeS/trmorgan/update-build-setup
Browse files Browse the repository at this point in the history
Modernize setup and build infrastructure
  • Loading branch information
trevormorgan authored Jun 9, 2022
2 parents b73dd8d + b0b194e commit 3ce94cc
Show file tree
Hide file tree
Showing 11 changed files with 249 additions and 54 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,13 @@ jobs:
uses: actions/cache@v3.0.2
with:
path: ${{ steps.prepare-cache-pip.outputs.cache-dir }}
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/test_requirements.txt') }}-${{ hashFiles('**/docs_requirements.txt') }}-${{ hashFiles('**/setup.py') }}
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/setup.cfg') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-
- name: install test_requirements.txt
- name: install requirements.txt
run: |
pip install -r test_requirements.txt
- name: install docs_requirements.txt
run: |
pip install -r docs_requirements.txt
pip install -r requirements.txt
- name: install broadbean
run: pip install .
- name: Build docs on linux
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ jobs:
uses: actions/cache@v3.0.2
with:
path: ${{ steps.prepare-cache-pip.outputs.cache-dir }}
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/test_requirements.txt') }}-${{ hashFiles('**/setup.py') }}
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/setup.cfg') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-
- name: install test_requirements.txt
- name: install requirements.txt
run: |
pip install -r test_requirements.txt
pip install -r requirements.txt
- name: install broadbean
run: |
pip install .
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/upload_to_pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Upload Python Package

on:
push:
tags:
- v*

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3.0.2
- name: Set up Python
uses: actions/setup-python@v3.1.2
with:
python-version: '3.7'
- name: Install build deps
run: pip install --upgrade pip setuptools wheel build
- name: Build
run: |
python -m build
- name: Install Twine
run: pip install twine
- name: Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*
10 changes: 10 additions & 0 deletions broadbean/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def _get_version() -> str:
from pathlib import Path
import versioningit
import broadbean

project_dir = Path(broadbean.__file__).parent.parent
return versioningit.get_version(project_dir=project_dir)


__version__ = _get_version()
2 changes: 2 additions & 0 deletions broadbean/py.typed
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
this file marks broadbean as safe for typechecking
https://mypy.readthedocs.io/en/latest/installed_packages.html#installed-packages
2 changes: 0 additions & 2 deletions docs_requirements.txt

This file was deleted.

28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,35 @@
[build-system]
requires = [
"setuptools >= 56.0",
"wheel >= 0.29.0",
"versioningit ~= 1.1.1",
]
build-backend = 'setuptools.build_meta'

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-ra -q"

[tool.mypy]
ignore_missing_imports = true
show_error_codes = true
enable_error_code = "ignore-without-code"
warn_unused_ignores = true
warn_unused_configs = true
warn_redundant_casts = true

[tool.versioningit]
default-version = "0.0"

[tool.versioningit.format]
distance = "{next_version}.dev{distance}+{branch}.{vcs}{rev}"
dirty = "{next_version}.dev{distance}+{branch}.{vcs}{rev}.dirty"
distance-dirty = "{next_version}.dev{distance}+{branch}.{vcs}{rev}.dirty"

[tool.versioningit.vcs]
method = "git"
match = ["v*"]

[tool.versioningit.onbuild]
source-file = "broadbean/_version.py"
build-file = "broadbean/_version.py"
119 changes: 119 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# pinned depedancies for CI
alabaster~=0.7.12
argon2-cffi~=21.3.0
argon2-cffi-bindings~=21.2.0
asttokens~=2.0.5
atomicwrites~=1.4.0
attrs~=21.4.0
Babel~=2.10.1
backcall~=0.2.0
beautifulsoup4~=4.11.1
bleach~=5.0.0
certifi~=2022.5.18.1
cffi~=1.15.0
cfgv~=3.3.1
charset-normalizer~=2.0.12
colorama~=0.4.4
contextlib2~=21.6.0
coverage~=6.4.1
cycler~=0.11.0
debugpy~=1.6.0
decorator~=5.1.1
defusedxml~=0.7.1
distlib~=0.3.4
docutils~=0.17.1
entrypoints~=0.4
executing~=0.8.3
fastjsonschema~=2.15.3
filelock~=3.7.1
fonttools~=4.33.3
hypothesis==6.46.7
identify~=2.5.1
idna~=3.3
imagesize~=1.3.0
iniconfig~=1.1.1
ipykernel~=6.13.0
ipython==8.4.0; python_version>='3.8'
ipython==7.31.0; python_version<'3.8'
ipython-genutils~=0.2.0
ipywidgets~=7.7.0
jedi~=0.18.1
Jinja2~=3.1.2
jsonschema~=4.6.0
jupyter~=1.0.0
jupyter-client~=7.3.1
jupyter-console~=6.4.3
jupyter-core~=4.10.0
jupyterlab-pygments~=0.2.2
jupyterlab-widgets~=1.1.0
kiwisolver~=1.4.2
MarkupSafe~=2.1.1
matplotlib~=3.5.2
matplotlib-inline~=0.1.3
mistune~=0.8.4
numpy~=1.21.5; python_version<'3.8'
numpy~=1.22.4; python_version>='3.8'
mypy~=0.950
mypy-extensions~=0.4.3
nbclient~=0.6.4
nbconvert~=6.5.0
nbformat~=5.4.0
nest-asyncio~=1.5.5
nodeenv~=1.6.0
notebook~=6.4.11
packaging~=21.3
pandocfilters~=1.5.0
parso~=0.8.3
pickleshare~=0.7.5
Pillow~=9.1.1
platformdirs~=2.5.2
pluggy~=1.0.0
pre-commit~=2.19.0
prometheus-client~=0.14.1
prompt-toolkit~=3.0.29
psutil~=5.9.1
pure-eval~=0.2.2
py~=1.11.0
pycparser~=2.21
Pygments~=2.12.0
pyparsing~=3.0.9
pyrsistent~=0.18.1
pytest~=7.1.2
pytest-cov~=3.0.0
python-dateutil~=2.8.2
pytz~=2022.1
pywin32==304; sys_platform == 'win32'
pywinpty==2.0.5; sys_platform == 'win32'
PyYAML~=6.0
pyzmq~=23.1.0
qtconsole~=5.3.1
QtPy~=2.1.0
requests~=2.27.1
schema~=0.7.5
Send2Trash~=1.8.0
six~=1.16.0
snowballstemmer~=2.2.0
sortedcontainers~=2.4.0
soupsieve~=2.3.2.post1
Sphinx~=5.0.1
sphinx-rtd-theme~=1.0.0
sphinxcontrib-applehelp~=1.0.2
sphinxcontrib-devhelp~=1.0.2
sphinxcontrib-htmlhelp~=2.0.0
sphinxcontrib-jsmath~=1.0.1
sphinxcontrib-qthelp~=1.0.3
sphinxcontrib-serializinghtml~=1.1.5
stack-data~=0.2.0
terminado~=0.15.0
tinycss2~=1.1.1
toml~=0.10.2
tomli~=2.0.1
tornado~=6.1
traitlets~=5.2.2.post1
typing_extensions~=4.2.0
urllib3~=1.26.9
virtualenv~=20.14.1
wcwidth~=0.2.5
webencodings~=0.5.1
widgetsnbextension~=3.6.0
wincertstore~=0.2
49 changes: 49 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[metadata]
name = broadbean
maintainer = QCoDeS Core Developers
maintainer_email = qcodes-support@microsoft.com
description = Package for easily generating and manipulating signal
pulses. Developed for use with qubits in the quantum
computing labs of Copenhagen, Delft, and Sydney, but
should be generally useable.
keywords = Pulsebuilding signal processing arbitrary waveforms
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/QCoDeS/broadbean
classifiers =
Development Status :: 4 - Beta
Intended Audience :: Science/Research
License :: OSI Approved :: MIT License
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Topic :: Scientific/Engineering
license = MIT

[options.package_data]
broadbean =
py.typed

[options]
include_package_data = True
packages=find:
python_requires = >=3.7
install_requires =
numpy>=1.12.1
matplotlib
schema
versioningit>=1.1.1

[options.extras_require]
test =
pytest>=6.2.2
pytest-cov>=3.0.0
coverage[toml]>=6.2
black>=22.3.0
mypy>=0.960
types-pytz>=2021.3.0
jupyter>=1.0.0
hypothesis>=5.49.0

41 changes: 4 additions & 37 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,7 @@
from setuptools import setup
from versioningit import get_cmdclasses

setup(
name='broadbean',
version='0.10.0',

# We might as well require what we know will work
# although older numpy and matplotlib version will probably work too
install_requires=['numpy>=1.12.1',
'matplotlib',
'schema'],

author='William H.P. Nielsen',
author_email='William.Nielsen@microsoft.com',

description=("Package for easily generating and manipulating signal "
"pulses. Developed for use with qubits in the quantum "
"computing labs of Copenhagen, Delft, and Sydney, but "
"should be generally useable."),

license='MIT',

packages=['broadbean'],

classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10'
],

python_requires=">=3.7",

keywords='Pulsebuilding signal processing arbitrary waveforms',

url='https://github.com/QCoDeS/broadbean'
if __name__ == "__main__":
setup(
cmdclass=get_cmdclasses(),
)
6 changes: 0 additions & 6 deletions test_requirements.txt

This file was deleted.

0 comments on commit 3ce94cc

Please sign in to comment.