Skip to content

Commit

Permalink
Merge pull request #440 from c-martinez/flake8
Browse files Browse the repository at this point in the history
Linting
  • Loading branch information
albertmeronyo authored Nov 1, 2023
2 parents 42fc898 + d99a135 commit e67d37e
Show file tree
Hide file tree
Showing 23 changed files with 1,873 additions and 1,203 deletions.
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='[email protected]',
url='https://github.com/CLARIAH/grlc',
author="Albert Meroño",
author_email="[email protected]",
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

0 comments on commit e67d37e

Please sign in to comment.