Skip to content

Commit

Permalink
Merge pull request #61 from jkbecker/setup
Browse files Browse the repository at this point in the history
  • Loading branch information
altendky authored Apr 7, 2021
2 parents 3e1f950 + fceb2be commit 5630f9c
Show file tree
Hide file tree
Showing 24 changed files with 237 additions and 144 deletions.
134 changes: 65 additions & 69 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,68 +12,68 @@ defaults:
shell: bash

jobs:
# build:
# name: ${{ matrix.task.name}} - ${{ matrix.os.name }} ${{ matrix.python.name }}
# runs-on: ${{ matrix.os.runs-on }}
# strategy:
# fail-fast: false
# matrix:
# os:
# - name: Linux
# runs-on: ubuntu-latest
# python:
# - name: CPython 3.8
# tox: py38
# action: 3.8
# task:
# - name: Build
# tox: build
#
# steps:
# - uses: actions/checkout@v2
# with:
# ref: ${{ github.event.pull_request.head.sha }}
# - name: Set up ${{ matrix.python.name }}
# uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.python.action }}
#
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip setuptools wheel
# python -m pip install build check-manifest twine
#
# - uses: twisted/python-info-action@v1
#
# - name: Build
# run: |
# check-manifest --verbose .
#
# python -m build --sdist --outdir dist/ .
#
# mkdir empty/
# cd empty
#
# tar -xvf ../dist/*
# cd *
#
# # build the wheel from the sdist
# python -m build --wheel --outdir ../../dist/ .
# cd ../../
#
# twine check dist/*
#
# - name: Publish
# uses: actions/upload-artifact@v2
# with:
# name: dist
# path: dist/
build:
name: ${{ matrix.task.name}} - ${{ matrix.os.name }} ${{ matrix.python.name }}
runs-on: ${{ matrix.os.runs-on }}
strategy:
fail-fast: false
matrix:
os:
- name: Linux
runs-on: ubuntu-latest
python:
- name: CPython 3.8
tox: py38
action: 3.8
task:
- name: Build
tox: build

steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up ${{ matrix.python.name }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python.action }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install build check-manifest twine
- uses: twisted/python-info-action@v1

- name: Build
run: |
check-manifest --verbose .
python -m build --sdist --outdir dist/ .
mkdir empty/
cd empty
tar -xvf ../dist/*
cd *
# build the wheel from the sdist
python -m build --wheel --outdir ../../dist/ .
cd ../../
twine check dist/*
- name: Publish
uses: actions/upload-artifact@v2
with:
name: dist
path: dist/

test:
name: ${{ matrix.task.name}} - ${{ matrix.os.name }} ${{ matrix.python.name }}
runs-on: ${{ matrix.os.runs-on }}
# needs:
# - build
needs:
- build
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -111,11 +111,11 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

# - name: Download package files
# uses: actions/download-artifact@v2
# with:
# name: dist
# path: dist/
- name: Download package files
uses: actions/download-artifact@v2
with:
name: dist
path: dist/

- name: Set up ${{ matrix.python.name }}
uses: actions/setup-python@v2
Expand All @@ -129,11 +129,7 @@ jobs:
- name: Prepare tox environment
run: |
tox --notest
# - name: Prepare tox environment
# run: |
# tox --notest --installpkg dist/*.whl
tox --notest --installpkg dist/*.whl
- name: Runner info
uses: twisted/python-info-action@v1
Expand All @@ -151,7 +147,7 @@ jobs:
name: All
runs-on: ubuntu-latest
needs:
# - build
- build
- test
steps:
- name: This
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__pycache__
venv
7 changes: 7 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include CHANGELOG.md
include LICENSE
include README.md
include *.md
include VERSION
include tox.ini
recursive-include src *.py
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,25 @@ mode or the command line mode.

There are many bugs and TODOs.

Plotman will always look in the current directory for the `config.yaml` file
([see also](https://github.com/ericaltendorf/plotman/pull/61#issuecomment-812967363)).

## Installation

This program requires `psutil`, `pyfakefs`, `pyyaml` and `texttable`.
Installation for Linux:

Installation for Ubuntu 20.04:
1. Plotman assumes that a functioning [Chia](https://github.com/Chia-Network/chia-blockchain)
installation is present on the system. Activate your `chia` environment by typing
`source /path/to/your/chia/install/activate`.
2. Then, install Plotman using the following command:

```
# Install Python package system
sudo apt-get install python3-pip
pip install git+https://github.com/ericaltendorf/plotman@development
3. Plotman will look for `config.yaml` in your current working directory when you run it.
You can find [an example configuration file](./config.yaml) in the project source that can be used
as a starting point.
5. That's it! You can now run Plotman by typing `plotman version` to verify its version.
Run `plotman --help` to learn about the available commands.

python3 -m pip install psutil pyfakefs pyyaml texttable
```
### Development note:

If you are forking Plotman, simply replace the installation step with `pip install --editable .[dev]` from the project root directory to install *your* version of plotman with test and development extras.
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.1
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
61 changes: 61 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[metadata]
name = plotman
version = file: VERSION
author = Eric Altendorf
home-page = https://github.com/ericaltendorf/plotman
description = Chia plotting manager
long-description = file: README.md
long_description_content_type = text/markdown
license = Apache 2.0
license-file = LICENSE
keywords = chia, blockchain, automation, process management
classifiers =
Development Status :: 3 - Alpha
Environment :: Console :: Curses
Intended Audience :: Developers
Intended Audience :: System Administrators
Intended Audience :: Information Technology
License :: OSI Approved :: Apache Software License
Natural Language :: English
Operating System :: POSIX
Programming Language :: Python :: 3
Topic :: System :: Monitoring
Topic :: System :: Systems Administration
Topic :: Utilities
project_urls =
Bug Tracker = https://github.com/ericaltendorf/plotman/issues
Changelog = https://github.com/ericaltendorf/plotman/blob/main/CHANGELOG.md

[options]
package_dir=
=src
packages=find:
install_requires =
psutil
pyyaml
texttable

[options.packages.find]
where=src

[options.entry_points]
console_scripts =
plotman = plotman.plotman:main

[options.extras_require]
dev =
%(test)s
isort
test =
pytest
pyfakefs

[options.data_files]
config = config.yaml
bin = util/listlogs

[isort]
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
line_length=88
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import setuptools


setuptools.setup()
Empty file added src/plotman/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions src/plotman/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

from plotman import plotman


"""Plotman module launcher.
This is a shim that allows you to run plotman via
python3 -m plotman
"""
plotman.main()
4 changes: 2 additions & 2 deletions archive_test.py → src/plotman/_tests/archive_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import archive
import manager
from plotman import archive, manager


def test_compute_priority():
assert (archive.compute_priority( (3, 1), 1000, 10) >
Expand Down
9 changes: 5 additions & 4 deletions manager_test.py → src/plotman/_tests/manager_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
from unittest.mock import patch

import pytest
import manager
import job

from plotman import job, manager


@pytest.fixture
def sched_cfg():
Expand Down Expand Up @@ -44,14 +45,14 @@ def test_permit_new_job_override_tmp_dir(sched_cfg, dir_cfg):
[ (3, 1), (3, 2), (3, 3), (3, 6) ], '/mnt/tmp/04', sched_cfg,
dir_cfg)

@patch('job.Job')
@patch('plotman.job.Job')
def job_w_tmpdir_phase(tmpdir, phase, MockJob):
j = MockJob()
j.progress.return_value = phase
j.tmpdir = tmpdir
return j

@patch('job.Job')
@patch('plotman.job.Job')
def job_w_dstdir_phase(dstdir, phase, MockJob):
j = MockJob()
j.progress.return_value = phase
Expand Down
7 changes: 4 additions & 3 deletions plot_util_test.py → src/plotman/_tests/plot_util_test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from plot_util import GB

import os

import pyfakefs

import plot_util
from plotman import plot_util
from plotman.plot_util import GB


def test_human_format():
assert (plot_util.human_format(3442000000, 0) == '3G')
Expand Down
6 changes: 3 additions & 3 deletions reporting_test.py → src/plotman/_tests/reporting_test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# TODO: migrate away from unittest patch
import os
from unittest.mock import patch

import os
from plotman import reporting

import reporting

def test_phases_str_basic():
assert(reporting.phases_str([(1,2), (2,3), (3,4), (4,0)]) ==
Expand All @@ -24,7 +24,7 @@ def test_phases_str_none():
def test_job_viz_empty():
assert(reporting.job_viz([]) == '1 2 3 4 ')

@patch('job.Job')
@patch('plotman.job.Job')
def job_w_phase(ph, MockJob):
j = MockJob()
j.progress.return_value = ph
Expand Down
4 changes: 3 additions & 1 deletion analyzer.py → src/plotman/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
import re
import statistics
import sys

import texttable as tt

import plot_util
from plotman import plot_util


class LogAnalyzer:
def analyze(self, logfilenames, bytmp, bybitfield):
Expand Down
Loading

0 comments on commit 5630f9c

Please sign in to comment.