Skip to content

Commit

Permalink
Enable Pypi publication
Browse files Browse the repository at this point in the history
  • Loading branch information
Delaunay authored Mar 9, 2022
1 parent 419ed4d commit 5435b7f
Show file tree
Hide file tree
Showing 7 changed files with 179 additions and 17 deletions.
49 changes: 47 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: tests

on: [push, pull_request]
on:
pull_request:
branches:
- master
- develop
release:
types:
[published]
# Allow manual starting of the workflow
workflow_dispatch:

jobs:
test:
Expand All @@ -9,7 +18,7 @@ jobs:
max-parallel: 4
matrix:
platform: [ubuntu-latest]
python-version: [3.7, 3.8, 3.9, '3.10']
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
env:
PLATFORM: ${{ matrix.platform }}
steps:
Expand All @@ -32,3 +41,39 @@ jobs:
env_vars: PLATFORM,PYTHON
name: codecov-umbrella
fail_ci_if_error: false

pypi:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test packaging
run: tox -e packaging

- name: Build
run: tox -e build

- name: Publish distribution 📦 to Test PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/

- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ htmlcov/
.tox/
.coverage
.coverage.*
.coverage_*
.cache
nosetests.xml
coverage.xml
Expand Down
31 changes: 31 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Software License Agreement (BSD License)

Copyright (c) 2017-2022, Epistímio.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of orion nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
23 changes: 23 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
include LICENSE
include *.rst
include requirements.txt

# Exclude development files
exclude tox.ini
exclude *-requirements.txt
exclude .pylintrc
exclude .mypy.ini
exclude codecov.yml
exclude .mailmap
exclude .readthedocs.yml
prune conda
prune .github

# Exclude tests
prune tests
prune docs
prune examples

# Include src
recursive-include *.py *.gitkeep
recursive-include sspace *.py
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
56 changes: 41 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,46 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Installation script for Sample space."""

from setuptools import setup
import os

repo_root = os.path.dirname(os.path.abspath(__file__))


args = dict(
name='sspace',
version='0.0.0',
description='Sample Space Builder',
long_description=open(
os.path.join(repo_root, "README.rst"), "rt", encoding="utf8"
).read(),
author='Pierre Delaunay',
author_email="[email protected]",
url="https://github.com/epistimio/sspace",
packages=[
'sspace',
'sspace.backends'
],
setup_requires=['setuptools'],
install_requires=[
'scipy',
'ConfigSpace'
]
)

args["classifiers"] = [
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Operating System :: POSIX",
"Operating System :: Unix",
"Programming Language :: Python",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
] + [("Programming Language :: Python :: %s" % x) for x in "3 3.7 3.8 3.9 3.10".split()]

if __name__ == '__main__':
setup(
name='sspace',
version='0.0.0',
description='Sample Space Builder',
author='Pierre Delaunay',
packages=[
'sspace',
'sspace.backends'
],
setup_requires=['setuptools'],
install_requires=[
'ConfigSpace',
'orion',
]
)
setup(**args)
31 changes: 31 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,37 @@ commands = codecov --required

# -----------------------------------------------------------------------------

# Packaging
# =============================================================================

[testenv:packaging]
description = Check whether README.rst is reST and missing from MANIFEST.in
basepython = python3
deps =
check-manifest
readme_renderer
commands =
check-manifest
python setup.py check -r -s

[testenv:build]
basepython = python3
skip_install = true
deps =
wheel
setuptools
commands =
python setup.py -q sdist bdist_wheel

[testenv:release]
basepython = python3
skip_install = true
deps =
{[testenv:build]deps}
twine >= 1.5.0
commands =
{[testenv:build]commands}
twine upload --skip-existing dist/*

# Mypy
# =============================================================================
Expand Down

0 comments on commit 5435b7f

Please sign in to comment.