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

Setup #61

Merged
merged 32 commits into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
313e9d1
ignore virtual environments
jkbecker Mar 31, 2021
8eec28c
basic refactoring for setup
jkbecker Mar 31, 2021
18e771a
cleaning up imports with isort
jkbecker Mar 31, 2021
560831b
adding [dev] and [test] extras, better isort conf
jkbecker Mar 31, 2021
dfa6fcf
slimming down MANIFEST.in
jkbecker Mar 31, 2021
04d7e22
Update setup.cfg
jkbecker Apr 1, 2021
396a457
sorting test imports
jkbecker Apr 1, 2021
461690c
pyfakefs required for tests
jkbecker Apr 1, 2021
8a69612
Merge branch 'setup' of github.com:jkbecker/plotman into setup
jkbecker Apr 1, 2021
251b36c
sorting test imports
jkbecker Apr 1, 2021
08acd29
Implementing @altendky feedback
jkbecker Apr 4, 2021
5188f86
Merge branch 'development' of github.com:ericaltendorf/plotman into s…
jkbecker Apr 4, 2021
5882b75
adding version command
jkbecker Apr 4, 2021
afcd220
updating README
jkbecker Apr 4, 2021
b181bd5
adding install step to CI
jkbecker Apr 4, 2021
ac53a5d
CI setup
jkbecker Apr 4, 2021
ff11e12
Fixing MANIFEST.in (CI Build complaint)
jkbecker Apr 4, 2021
5686c3e
mock is unhappy
jkbecker Apr 4, 2021
1cb15ff
stop mocking me
jkbecker Apr 4, 2021
542a184
Update src/plotman/plotman.py
jkbecker Apr 5, 2021
1570e2f
Update src/plotman/plotman.py
jkbecker Apr 5, 2021
01d4d3f
Update src/plotman/job.py
jkbecker Apr 5, 2021
7b4f434
Merge branch 'development' of github.com:ericaltendorf/plotman into s…
jkbecker Apr 5, 2021
8255db2
Merge branch 'setup' of github.com:jkbecker/plotman into setup
jkbecker Apr 5, 2021
4f97bec
no author-email
jkbecker Apr 5, 2021
8b06c62
Improved install procedure
jkbecker Apr 5, 2021
ed67015
Merge branch 'setup' of github.com:jkbecker/plotman into setup
jkbecker Apr 5, 2021
9810e34
Update README.md
altendky Apr 6, 2021
ecd9d5b
add trailing EOLs
altendky Apr 6, 2021
65797c0
add a stubby setup.py for compatibility
altendky Apr 6, 2021
34000cf
Update README.md
altendky Apr 6, 2021
fceb2be
Merge branch 'development' into setup
altendky Apr 6, 2021
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
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.

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

This program requires `psutil`, `pyfakefs`, `pyyaml` and `texttable`.
## Installation

Installation for Ubuntu 20.04:
altendky marked this conversation as resolved.
Show resolved Hide resolved

```
# Install Python package system
sudo apt-get install python3-pip
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
`. /path/to/your/chia/install/activate`.
2. Then, clone the plotman repository (*note that these instructions are currently only
valid for the development branch*):

python3 -m pip install psutil pyfakefs pyyaml texttable
```
git clone https://github.com/ericaltendorf/plotman.git -b development
3. Enter the Plotman directory

cd plotman
4. Install plotman using pip:

pip install .
altendky marked this conversation as resolved.
Show resolved Hide resolved
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.
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"
62 changes: 62 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[metadata]
name = plotman
version = file: VERSION
author = Eric Altendorf
author-email = PLACEHOLDER
jkbecker marked this conversation as resolved.
Show resolved Hide resolved
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
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