Skip to content

Commit

Permalink
build: switch to setuptools_scm
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanljones committed May 6, 2022
1 parent f61b903 commit f92d2d8
Show file tree
Hide file tree
Showing 14 changed files with 341 additions and 2,570 deletions.
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

10 changes: 8 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,27 @@ jobs:
id: latestrelease
run: |
echo "::set-output name=releasetag::$(curl -s https://api.github.com/repos/dylanljones/lattpy/releases/latest | jq '.tag_name' | sed 's/\"//g')"
- name: confirm release tag
run: |
echo ${{ steps.latestrelease.outputs.releasetag }}
- name: checkout
uses: actions/checkout@v2
with:
ref: ${{ steps.latestrelease.outputs.releasetag }}

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.9"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine build
pip install twine
pip install .[build]
- name: Build and publish distribution 📦 to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/python-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,27 @@ jobs:
id: latestrelease
run: |
echo "::set-output name=releasetag::$(curl -s https://api.github.com/repos/dylanljones/lattpy/releases/latest | jq '.tag_name' | sed 's/\"//g')"
- name: confirm release tag
run: |
echo ${{ steps.latestrelease.outputs.releasetag }}
- name: checkout
uses: actions/checkout@v2
with:
ref: ${{ steps.latestrelease.outputs.releasetag }}

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.9"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine build
pip install twine
pip install .[build]
- name: Build and publish distribution 📦 to Test PyPI
env:
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test

on:
push:
branches: [master, dev]
branches: [master, dev, setuptools_scm]
pull_request:
types: [opened]
workflow_dispatch:
Expand Down Expand Up @@ -50,19 +50,24 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies

- name: Build and install
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov codecov
pip install -r requirements.txt
python setup.py install
pip install .[test]
- name: Get package version
run: python setup.py --version

- name: Run tests
run: |
pytest lattpy/ --cov=lattpy --cov-report=xml -v
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
env_vars: OS,PYTHON
verbose: True

- name: Coverage
run: codecov
232 changes: 230 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
# Specific files

# -- Project gitignore -----------------------------------------------------------------

master.db
.ksy/
dev_*.py
decrypt_database.py
compile_structs.bat
.chglog/

# setuptools_scm version file
# Use this if the project uses pyproject.toml with setuptools_scm instead of setup.py
*/_version.py


# -- Python gitignore ------------------------------------------------------------------

# Byte-compiled / optimized / DLL files
__pycache__/
.idea/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
Expand All @@ -25,6 +44,126 @@ share/python-wheels/
*.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:
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

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
# poetry.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/


# -- LaTeX gitignore -------------------------------------------------------------------

# LaTeX temporary files
*.aux
*.log
Expand All @@ -49,6 +188,95 @@ MANIFEST
*.bbl
*.blg


# -- Sublime gitignore -----------------------------------------------------------------

# Sublime Text Project Files (usually contain absolute paths)
*.sublime-project
*.sublime-workspace


# -- JetBrains gitignore ---------------------------------------------------------------

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion,
# Android Studio, WebStorm and Rider
# Source: https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore

# JetBrains project folder
.idea/

# Uncomment for JetBrains specific template instead of ignoring all of .idea/
## User-specific stuff
#.idea/**/workspace.xml
#.idea/**/tasks.xml
#.idea/**/usage.statistics.xml
#.idea/**/dictionaries
#.idea/**/shelf
#
## AWS User-specific
#.idea/**/aws.xml
#
## Generated files
#.idea/**/contentModel.xml
#
## Sensitive or high-churn files
#.idea/**/dataSources/
#.idea/**/dataSources.ids
#.idea/**/dataSources.local.xml
#.idea/**/sqlDataSources.xml
#.idea/**/dynamic.xml
#.idea/**/uiDesigner.xml
#.idea/**/dbnavigator.xml
#
## Gradle
#.idea/**/gradle.xml
#.idea/**/libraries
#
## Gradle and Maven with auto-import
## When using Gradle or Maven with auto-import, you should exclude module files,
## since they will be recreated, and may cause churn. Uncomment if using
## auto-import.
## .idea/artifacts
## .idea/compiler.xml
## .idea/jarRepositories.xml
## .idea/modules.xml
## .idea/*.iml
## .idea/modules
## *.iml
## *.ipr
#
## CMake
#cmake-build-*/
#
## Mongo Explorer plugin
#.idea/**/mongoSettings.xml
#
## File-based project format
#*.iws
#
## IntelliJ
#out/
#
## mpeltonen/sbt-idea plugin
#.idea_modules/
#
## JIRA plugin
#atlassian-ide-plugin.xml
#
## Cursive Clojure plugin
#.idea/replstate.xml
#
## SonarLint plugin
#.idea/sonarlint/
#
## Crashlytics plugin (for Android Studio and IntelliJ)
#com_crashlytics_export_strings.xml
#crashlytics.properties
#crashlytics-build.properties
#fabric.properties
#
## Editor-based Rest Client
#.idea/httpRequests
#
## Android studio 3.1+ serialized cache file
#.idea/caches/build_file_checksums.ser
9 changes: 0 additions & 9 deletions MANIFEST.in

This file was deleted.

7 changes: 4 additions & 3 deletions lattpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@
from .structure import LatticeStructure
from .lattice import Lattice

from ._version import get_versions
try:
from ._version import version as __version__
except ImportError:
__version__ = "0.0.0"

__version__ = get_versions()["version"]
del get_versions

# =========================================================================
# 1D Lattices
Expand Down
Loading

0 comments on commit f92d2d8

Please sign in to comment.