Skip to content

Commit

Permalink
Feature/move towards setup.cfg (#71)
Browse files Browse the repository at this point in the history
* using setup-py-upgrade

- using setup-py-upgrade --help to convert setup.py to setup.cfg

* - updating more workflows. Moving towards pip installl
- added a test matrix to the tests
- updated read me.

* Black

- running black

* Update tests.yml

- adding commands for windows and macos

* Update tests.yml

- fixing the paths for macos and windows

* - naming the coerage.json something else.
  • Loading branch information
carlkidcrypto authored Nov 30, 2023
1 parent 5af797c commit 5da6b1e
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 50 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/behave_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ jobs:
python -m pip install --upgrade setuptools ;
python -m pip install --upgrade pip ;
python -m pip install -r behave_tests/requirements.txt ;
python setup.py install
python -m pip install . --user

linux: cd /home/runner/work/purpleair_data_logger/purpleair_data_logger/ ;
python -m pip install --upgrade wheel ;
python -m pip install --upgrade setuptools ;
python -m pip install --upgrade pip ;
python -m pip install -r behave_tests/requirements.txt ;
python setup.py install
python -m pip install . --user

windows: cd D:\a\purpleair_data_logger\purpleair_data_logger\ ;
python -m pip install --upgrade wheel ;
python -m pip install --upgrade setuptools ;
python -m pip install --upgrade pip ;
python -m pip install -r behave_tests/requirements.txt ;
python setup.py install --user
python -m pip install . --user

- name: Run behave tests...
env:
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/sphinx_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,23 @@ jobs:
with:
python-version: "3.10"

- name: Install python3 requirements and run sphinx...
- name: Install python3 requirements...
uses: knicknic/[email protected]
with:
linux: cd /home/runner/work/purpleair_data_logger/purpleair_data_logger/ &&
python -m pip install --upgrade wheel &&
python -m pip install --upgrade setuptools &&
python -m pip install --upgrade pip &&
python -m pip install -r sphinx_docs_build/requirements.txt &&
python setup.py install --user &&
cd sphinx_docs_build &&
make html
python -m pip install . --user

- name: Run sphinx...
uses: knicknic/[email protected]
with:
linux: cd /home/runner/work/purpleair_data_logger/purpleair_data_logger/sphinx_docs_build ;
make html

- uses: actions/upload-artifact@v3
with:
name: Upload HTML Documentation
name: HTML Documentation
path: docs/
41 changes: 35 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Unit Tests

on:
push:
Expand All @@ -8,17 +8,23 @@ on:
branches: [ main ]

jobs:
tests:
runs-on: ubuntu-latest
Unit_Tests:
name: ${{ matrix.os }} using Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Set up Python 3.10 env for running unittest tests...
- name: Set up Python env for running unit tests...
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: ${{ matrix.python-version }}

- name: Install python3 requirements...
uses: knicknic/[email protected]
Expand All @@ -30,14 +36,37 @@ jobs:
python -m pip install coverage ;
python -m pip install requests_mock ;
python -m pip install purpleair_api ;

macos: cd /Users/runner/work/purpleair_data_logger/purpleair_data_logger/ ;
python -m pip install --upgrade wheel ;
python -m pip install --upgrade setuptools ;
python -m pip install --upgrade pip ;
python -m pip install coverage ;
python -m pip install requests_mock ;
python -m pip install purpleair_api ;

windows: cd D:\a\purpleair_data_logger\purpleair_data_logger\ ;
python -m pip install --upgrade wheel ;
python -m pip install --upgrade setuptools ;
python -m pip install --upgrade pip ;
python -m pip install coverage ;
python -m pip install requests_mock ;
python -m pip install purpleair_api ;

- name: Run unit tests...
uses: knicknic/[email protected]
with:
linux: cd /home/runner/work/purpleair_data_logger/purpleair_data_logger/tests ;
coverage run -m unittest && coverage json ;
coverage run -m unittest && coverage json -o ${{matrix.os}}_${{matrix.python-version}}_coverage.json;

macos: cd /Users/runner/work/purpleair_data_logger/purpleair_data_logger/tests ;
coverage run -m unittest && coverage json -o ${{matrix.os}}_${{matrix.python-version}}_coverage.json;

windows: cd D:\a\purpleair_data_logger\purpleair_data_logger\tests ;
coverage run -m unittest && coverage json -o ${{matrix.os}}_${{matrix.python-version}}_coverage.json;

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
name: ${{matrix.os}}_${{matrix.python-version}}_coverage_report
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ You can install PurpleAir Data Logger by cloning down this repo.
```bash
git clone https://github.com/carlkidcrypto/purpleair_data_logger.git
cd purpleair_data_logger
python3 setup.py install
python3 -m pip install .
```

## Usage PurpleAirPSQLDataLogger.py
Expand Down
29 changes: 26 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
[metadata]
description-file=README.md
license_files=LICENSE
name = purpleair_data_logger
version = 1.3.0a1
license = MIT
author = Carlos Santos
author_email = [email protected]
url = https://github.com/carlkidcrypto/purpleair_data_logger
keywords =
purpleair_data_logger
purple air
purple air data logger
PurpleAirPSQLDataLogger
PurpleAirCSVDataLogger
purple air api
PurpleAirSQLiteDataLogger
platforms =
Windows 32/64
Linux 32/64
MacOS 32/64
description-file = README.md
license_files = LICENSE

[options]
python_requires = >=3.8
packages = purpleair_data_logger
install_requires =
pg8000==1.30.3
requests
purpleair_api==1.1.2
python_requires = >=3.8
33 changes: 1 addition & 32 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,3 @@
#!/usr/bin/env python3
from setuptools import setup
import os


def read_file(filename):
with open(
os.path.join(os.path.dirname(__file__), filename), encoding="utf-8"
) as file:
return file.read()


setup(
name="purpleair_data_logger",
version="1.3.0a1",
license="MIT",
author="Carlos Santos",
author_email="[email protected]",
long_description=read_file("README.md"),
long_description_content_type="text/markdown",
packages=["purpleair_data_logger"],
url="https://github.com/carlkidcrypto/purpleair_data_logger",
keywords=[
"purpleair_data_logger",
"purple air",
"purple air data logger",
"PurpleAirPSQLDataLogger",
"PurpleAirCSVDataLogger",
"purple air api",
"PurpleAirSQLiteDataLogger",
],
install_requires=["pg8000==1.30.3", "requests", "purpleair_api==1.1.2"],
platforms=["Windows 32/64", "Linux 32/64", "MacOS 32/64"],
)
setup()

0 comments on commit 5da6b1e

Please sign in to comment.