Skip to content

Commit 2a1a05e

Browse files
PyPIに登録する (#36)
* #34 register to pip * #34 script name atcoder-tool -> atcoder-tools to avoid confusion * #34 Add missing __init__.py Co-Authored-By: kyuridenamida <[email protected]> * #34 Modify Manifest to include template files * #34 remove dependency to sympy * #34 Update .travis.yml Co-Authored-By: kyuridenamida <[email protected]> * #34 move templates folder into tools * #34 Add PyPI badge
1 parent 6a84e1b commit 2a1a05e

File tree

15 files changed

+72
-10
lines changed

15 files changed

+72
-10
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ do_format.py
66
debug.py
77
/backup
88
.idea
9-
.coverage
9+
.coverage
10+
atcoder_tools.egg-info/
11+
build/
12+
dist/
13+

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@ python:
55
- "3.6"
66

77
install:
8-
- pip install bs4
8+
- pip install .
99
- pip install flake8 autopep8
1010
- pip install codecov nose
11-
- pip install sympy
1211

1312
script:
1413
- flake8 --ignore=E501, W605
1514
- autopep8 -r . --diff | tee check_autopep8
1615
- test ! -s check_autopep8
17-
- ./atcoder-tool gen arc050 --without-login --no_parallel
16+
- atcoder-tools gen arc050 --without-login --no_parallel
1817
- nosetests --with-coverage --cover-package=atcodertools
1918
- codecov
2019
notifications:

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
recursive-include atcodertools/tools/templates/ *

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[![Build Status](https://travis-ci.org/kyuridenamida/atcoder-tools.svg?branch=master)](https://travis-ci.org/kyuridenamida/atcoder-tools)
22
[![codecov](https://codecov.io/gh/kyuridenamida/atcoder-tools/branch/master/graph/badge.svg)](https://codecov.io/gh/kyuridenamida/atcoder-tools)
3+
[![PyPI](https://img.shields.io/pypi/v/atcoder-tools.svg)](https://pypi.python.org/pypi/atcoder-tools)
34

45
atcoder-tools
56
====
6-
77
Python 3.5 で動作する [AtCoder](http://atcoder.jp/) からサンプル入力をダウンロードしたりする際に便利なツールです。
88

99
このツールには次のような機能があります。
@@ -20,6 +20,8 @@ Python 3.5 で動作する [AtCoder](http://atcoder.jp/) からサンプル入
2020
| 2018-12-03 | ToolsForAtCoder は atcoder-tools に名前を変更した。 |
2121
| 2016-04-01 | 最初のバージョンをリリースした。 |
2222

23+
## How to install
24+
`pip3 install atcoder-tools`
2325

2426
## Demo
2527
※最初期のデモなので今とインターフェイスが異なります
@@ -29,21 +31,26 @@ Python 3.5 で動作する [AtCoder](http://atcoder.jp/) からサンプル入
2931

3032
## Usage
3133

34+
35+
*重要: かつてログイン情報を保持するために`AccountInformation.py`に書き込むことを要求していましたが、セキュリティリスクが高すぎるため、セッション情報のみを保持する方針に切り替えました。
36+
過去のユーザーの方はそのファイルを削除することを推奨します。*
37+
38+
3239
- `atcoder-tools gen {contest_id}` コンテスト環境を用意するコマンド
3340
- `atcoder-tools test` カレント・ディレクトリ上に実行ファイルと入出力(in_\*.txt, out_\*.txt)がある状態で実行するとローカルテストを行う
3441

3542
例:
3643
```
37-
$ atcoder-tool gen agc001
44+
$ atcoder-tools gen agc001
3845
$ cd ~/atcoder-workspace/agc001/A
3946
$ g++ main.cpp
40-
$ atcoder-tool test
47+
$ atcoder-tools test
4148
```
4249

4350
`--without-login` 引数を指定するとログインなしでデータをダウンロードできます(一般公開されているコンテストのみ)。
4451

4552
```
46-
$ atcoder-tool gen [contestid] --without-login
53+
$ atcoder-tool gen [contest_id] --without-login
4754
```
4855

4956

File renamed without changes.

atcodertools/client/atcoder.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import requests
99
from bs4 import BeautifulSoup
10-
from sympy.core.singleton import Singleton
1110

1211
from atcodertools.models.contest import Contest
1312
from atcodertools.models.problem import Problem
@@ -38,6 +37,16 @@ def load_cookie_to(session: requests.Session, cookie_path: Optional[str] = None)
3837
return False
3938

4039

40+
class Singleton(type):
41+
_instances = {}
42+
43+
def __call__(cls, *args, **kwargs):
44+
if cls not in cls._instances:
45+
cls._instances[cls] = super(
46+
Singleton, cls).__call__(*args, **kwargs)
47+
return cls._instances[cls]
48+
49+
4150
class AtCoderClient(metaclass=Singleton):
4251

4352
def __init__(self):

atcodertools/fileutils/__init__.py

Whitespace-only changes.

atcodertools/models/predictor/__init__.py

Whitespace-only changes.

atcodertools/tools/envgen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def prepare_workspace(atcoder_client: AtCoderClient,
162162
expanduser("~"), "atcoder-workspace")
163163

164164
DEFAULT_TEMPLATE_DIR_PATH = os.path.abspath(
165-
os.path.join(script_dir_path, "../../templates/"))
165+
os.path.join(script_dir_path, "./templates/"))
166166

167167

168168
def get_default_template_path(lang):
File renamed without changes.

0 commit comments

Comments
 (0)