Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linting #440

Merged
merged 5 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
per-file-ignores = src/__init__.py:F401

23 changes: 23 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint

on:
push:
paths:
- 'src/*.py'
- 'tests/*.py'
jobs:
linter:
runs-on: ubuntu-latest
name: Lint
steps:
- name: Check out source repository
uses: actions/checkout@v3
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: flake8 Lint
uses: py-actions/flake8@v2
with:
max-line-length: "127"
path: "src"
46 changes: 23 additions & 23 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,54 +10,54 @@
import os
from setuptools import setup

grlc_base = 'src'
grlc_base_dir = os.path.join(grlc_base, '')
grlc_base = "src"
grlc_base_dir = os.path.join(grlc_base, "")
grlc_data = []
for root,dirs,files in os.walk(grlc_base):
for root, dirs, files in os.walk(grlc_base):
if root != grlc_base:
root_dir = root.replace(grlc_base_dir, '')
data_files = os.path.join(root_dir, '*')
root_dir = root.replace(grlc_base_dir, "")
data_files = os.path.join(root_dir, "*")
grlc_data.append(data_files)

# To update the package version number, edit CITATION.cff
with open('CITATION.cff', 'r') as cff:
with open("CITATION.cff", "r") as cff:
for line in cff:
if 'version:' in line:
version = line.replace('version:', '').strip().strip('"')
if "version:" in line:
version = line.replace("version:", "").strip().strip('"')

with codecs.open('requirements.txt', mode='r') as f:
with codecs.open("requirements.txt", mode="r") as f:
install_requires = f.read().splitlines()

with codecs.open('requirements-test.txt', mode='r') as f:
with codecs.open("requirements-test.txt", mode="r") as f:
tests_require = f.read().splitlines()

with codecs.open('README.md', mode='r', encoding='utf-8') as f:
with codecs.open("README.md", mode="r", encoding="utf-8") as f:
long_description = f.read()

setup(
name="grlc",
description='grlc, the git repository linked data API constructor',
description="grlc, the git repository linked data API constructor",
long_description=long_description,
long_description_content_type='text/markdown',
long_description_content_type="text/markdown",
license="Copyright 2017 Albert Meroño",
author='Albert Meroño',
author_email='albert.merono@vu.nl',
url='https://github.com/CLARIAH/grlc',
author="Albert Meroño",
author_email="albert.merono@vu.nl",
url="https://github.com/CLARIAH/grlc",
version=version,
py_modules=['grlc'],
packages=['grlc'],
package_dir = {'grlc': grlc_base},
scripts=['bin/grlc-server'],
py_modules=["grlc"],
packages=["grlc"],
package_dir={"grlc": grlc_base},
scripts=["bin/grlc-server"],
install_requires=install_requires,
setup_requires=[
# dependency for `python setup.py test`
'pytest-runner',
"pytest-runner",
# dependencies for `python setup.py build_sphinx`
# 'sphinx',
# 'recommonmark'
],
tests_require=tests_require,
package_data = { 'grlc': grlc_data },
package_data={"grlc": grlc_data},
include_package_data=True,
data_files=[('citation/grlc', ['CITATION.cff'])],
data_files=[("citation/grlc", ["CITATION.cff"])],
)
6 changes: 3 additions & 3 deletions src/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import yaml

# To update the package version number, edit CITATION.cff
citationfile = os.path.join(sys.exec_prefix, 'citation/grlc', 'CITATION.cff')
with open(citationfile, 'r') as f:
citationfile = os.path.join(sys.exec_prefix, "citation/grlc", "CITATION.cff")
with open(citationfile, "r") as f:
data = yaml.safe_load(f)
__version__ = data['version']
__version__ = data["version"]
Loading