Skip to content

Commit

Permalink
Merge pull request #109 from twisted/use-ss
Browse files Browse the repository at this point in the history
Switch to setuptools_scm
  • Loading branch information
mithrandi authored Jan 28, 2020
2 parents a61f6b7 + e21d325 commit 635d6ec
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 41 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ jobs:
strategy:
matrix:
python: [2.7, pypy2]
twisted: [twtrunk, twlatest, tw150]
twisted: [twtrunk, twlatest, twlowest]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Setup Python
uses: actions/setup-python@v1
with:
Expand All @@ -29,3 +33,4 @@ jobs:
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: gh-${{ matrix.python }}-${{ matrix.twisted }}
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 0
- name: Fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '2.7'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ apidocs/
*.egg-info/
.coverage
.hypothesis/
/axiom/_version.py
/coverage.xml
8 changes: 3 additions & 5 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include LICENSE
include NAME.txt
recursive-include axiom/test/historic *.tbz2
include axiom/batch.tac
graft axiom/examples
prune .github
prune benchmark
global-exclude .*
2 changes: 1 addition & 1 deletion axiom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
from twisted.python import versions

def asTwistedVersion(packageName, versionString):
return versions.Version(packageName, *map(int, versionString.split(".")))
return versions.Version(packageName, *map(int, versionString.split(".")[:3]))

version = asTwistedVersion("axiom", __version__)
1 change: 0 additions & 1 deletion axiom/_version.py

This file was deleted.

7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "axiom/_version.py"
write_to_template = "__version__ = \"{version}\""
32 changes: 2 additions & 30 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,15 @@
from setuptools import setup, find_packages
from setuptools.command.install import install as Install
import re

versionPattern = re.compile(r"""^__version__ = ['"](.*?)['"]$""", re.M)
with open("axiom/_version.py", "rt") as f:
version = versionPattern.search(f.read()).group(1)



class InstallAndRegenerate(Install):
def run(self):
"""
Runs the usual install logic, then regenerates the plugin cache.
"""
Install.run(self)
_regenerateCache()



def _regenerateCache():
from twisted import plugin
from axiom import plugins
list(plugin.getPlugins(plugin.IPlugin)) # Twisted
list(plugin.getPlugins(plugin.IPlugin, plugins)) # Axiom


setup(
name="Axiom",
version=version,
description="An in-process object-relational database",
url="https://github.com/twisted/axiom",

maintainer="Divmod, Inc.",
maintainer_email="[email protected]",

use_scm_version=True,
setup_requires=['setuptools_scm'],
install_requires=[
"Twisted>=13.2.0",
"Epsilon>=0.7.0"
Expand All @@ -43,9 +19,6 @@ def _regenerateCache():
},
packages=find_packages() + ['twisted.plugins'],
scripts=['bin/axiomatic'],
cmdclass={
"install": InstallAndRegenerate,
},
include_package_data=True,

license="MIT",
Expand All @@ -58,7 +31,6 @@ def _regenerateCache():
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 2 :: Only",
"Topic :: Database"])
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[tox]
envlist = {py27,pypy}-{twtrunk,twlatest,tw150}
envlist = {py27,pypy}-{twtrunk,twlatest,twlowest
isolated_build = True

[testenv]
extras = test
deps =
.[test]
twlatest: Twisted
twtrunk: https://github.com/twisted/twisted/archive/trunk.zip
tw150: Twisted==15.0
twlowest: Twisted==16.0
coverage
commands =
coverage run --source {envsitepackagesdir}/axiom/ --branch \
Expand Down

0 comments on commit 635d6ec

Please sign in to comment.