Skip to content

Commit

Permalink
Publish first PyPI project (#1)
Browse files Browse the repository at this point in the history
* Update README and add acknowledgement

* Create .gitignore

* Create setup.py and version function

* Add first test

* Add pytest to extras_require

* Add first CI
  • Loading branch information
kotarot authored Oct 11, 2020
1 parent 1d57a47 commit 2d339d4
Show file tree
Hide file tree
Showing 8 changed files with 236 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 1,26 @@
name: ci

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run tests
run: |
py.test
138 changes: 138 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 1,138 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 1,7 @@
# sawatabi

:warning: **This project is work in progress** :warning:

## Acknowledgement

This work is supported by the MITOU Target program from Information-technology Promotion Agency, Japan (IPA).
3 changes: 3 additions & 0 deletions sawatabi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 1,3 @@
from .version import *

__version__ = '0.0.1.dev0'
12 changes: 12 additions & 0 deletions sawatabi/version.py
Original file line number Diff line number Diff line change
@@ -0,0 1,12 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from codecs import open
from os import path
import re

def version():
this_dir = path.abspath(path.dirname(__file__))
with open(path.join(this_dir, '__init__.py'), encoding='utf8') as f:
version = re.search(r'__version__\s*=\s*[\'\"](. ?)[\'\"]', f.read()).group(1)
return version
41 changes: 41 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 1,41 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from codecs import open
from os import path
import re
from setuptools import setup

package_name = 'sawatabi'
root_dir = path.abspath(path.dirname(__file__))

with open(path.join(root_dir, package_name, '__init__.py'), encoding='utf8') as f:
version = re.search(r'__version__\s*=\s*[\'\"](. ?)[\'\"]', f.read()).group(1)

with open(path.join(root_dir, 'README.md'), encoding='utf-8') as f:
long_description = f.read()

setup(
name=package_name,
packages=[package_name],
version=version,
license='Apache 2.0',
install_requires=[],
extras_require={
'dev': [
'pytest>=6',
],
},
author='Kotaro Terada',
author_email='[email protected]',
url='https://github.com/kotarot/sawatabi',
description='sawatabi.',
long_description=long_description,
long_description_content_type='text/markdown',
keywords='',
classifiers=[
'Development Status :: 1 - Planning',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3.9',
],
)
Empty file added tests/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions tests/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 1,10 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import pytest
import re

from sawatabi import version

def test_version_format():
assert re.match(r'^\d .\d .\d (.(dev|a|b|rc)\d )?$', version())

0 comments on commit 2d339d4

Please sign in to comment.