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

Clean up for PyPI Upload #187

Merged
merged 12 commits into from
May 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ coverage:
project:
default: false
main:
target: 80%
paths:
- "src/imitation/"
- "!src/imitation/envs/examples/"
Expand Down
32 changes: 22 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[![CircleCI](https://circleci.com/gh/HumanCompatibleAI/imitation.svg?style=svg)](https://circleci.com/gh/HumanCompatibleAI/imitation)
[![Documentation Status](https://readthedocs.org/projects/imitation/badge/?version=latest)](https://imitation.readthedocs.io/en/latest/?badge=latest)
[![codecov](https://codecov.io/gh/HumanCompatibleAI/imitation/branch/master/graph/badge.svg)](https://codecov.io/gh/HumanCompatibleAI/imitation)
[![PyPI version](https://badge.fury.io/py/imitation.svg)](https://badge.fury.io/py/imitation)


# Imitation Learning Baseline Implementations

Expand Down Expand Up @@ -30,13 +32,23 @@ View Tensorboard with `tensorboard --logdir output/`.


# Contributing
* Follow the [Google Python Style Guide](http://google.github.io/styleguide/pyguide.html). Examples of Google-style
docstrings can be found [here](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html).
* Add units tests covering any new features, or bugs that are being fixed.
* PEP8 guidelines with line width 80 and 2-space indents are enforced by `ci/lint.sh`,
which is automatically run by Travis CI.
* Static type checking via `pytype` is automatically run in `ci/type_check.sh`.
* Code coverage is automatically enforced by CodeCov.
The exact coverage required by CodeCov depends on the previous
code coverage %. Files in `imitation/{examples,scripts}/` have no
coverage requirements.

Please follow a coding style of:
* PEP8, with line width 88.
* Use the `black` autoformatter.
* Follow the [Google Python Style Guide](http://google.github.io/styleguide/pyguide.html) unless
it conflicts with the above. Examples of Google-style docstrings can be found
[here](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html).

PRs should include unit tests for any new features, and add type annotations where possible.
It is OK to omit annotations when it would make the code significantly more complex.

We use `pytest` for unit testing: run `pytest tests/` to run the test suite.
We use `pytype` for static type analysis.
You should run `ci/code_checks.sh` to run linting and static type checks, and may wish
to configure this as a Git pre-commit hook.

These checks are run on CircleCI and are required to pass before merging.
Additionally, we track test coverage by CodeCov, and mandate that code coverage
should not decrease. This can be overridden by maintainers in exceptional cases.
Files in `imitation/{examples,scripts}/` have no coverage requirements.
2 changes: 1 addition & 1 deletion ci/build_venv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ fi

virtualenv -p python3.7 ${venv}
source ${venv}/bin/activate
pip install .[cpu,test,docs] gym[mujoco]
pip install .[cpu,docs,parallel,test] gym[mujoco]
6 changes: 1 addition & 5 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,5 @@ if [ "$skipexpensive" != "true" ]; then
popd

echo "Type checking"
# Tell pytype Python path explicitly using -P: otherwise it gets lost
# when the package is installed in editable mode (`pip -e .`). Note CI
# checks still run using full install (`pip .`) which is more robust
# but cumbersome for a Git commit hook.
pytype -P src/:. ${SRC_FILES[@]}
pytype ${SRC_FILES[@]}
fi
25 changes: 16 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
TF_VERSION = ">=1.15.0,<2.0"
TESTS_REQUIRE = [
"seals~=0.1.0",
# remove pin once https://github.com/nedbat/coveragepy/issues/881 fixed
"black",
# remove pin once https://github.com/nedbat/coveragepy/issues/881 fixed
"coverage==4.5.4",
"codecov",
"codespell",
Expand All @@ -24,11 +24,21 @@
"sphinx",
"sphinxcontrib-napoleon",
]
PARALLEL_REQUIRE = ["ray[debug,tune]~=0.8.5"]


def get_readme() -> str:
"""Retrieve content from README."""
with open("README.md", "r") as f:
return f.read()


setup(
name="imitation",
version=src.imitation.__version__,
description=("Implementation of modern IRL and imitation learning algorithms."),
description="Implementation of modern IRL and imitation learning algorithms.",
long_description=get_readme(),
long_description_content_type="text/markdown",
author="Center for Human-Compatible AI and Google",
python_requires=">=3.7.0",
packages=find_packages("src"),
Expand All @@ -40,15 +50,11 @@
"gym[classic_control]",
"matplotlib",
"numpy>=1.15",
"ray[debug]==0.7.4",
"tqdm",
"scikit-learn>=0.21.2",
# TODO(adam): Change to >=2.10.0 once 2.10.0 released
"stable-baselines @ git+https://github.com/hill-a/stable-baselines.git",
# TODO(shwang): Change to PyPI release once >0.1.55 is released.
# Needs https://github.com/google/jax/pull/1931
"jax @ git+https://github.com/google/jax",
"jaxlib~=0.1.20",
"stable-baselines~=2.10.0",
"jax~=0.1.66",
"jaxlib~=0.1.47",
# sacred==0.7.5 build is broken without pymongo
# sacred>0.7.4 have non-picklable config objects (see GH #109)
"sacred==0.7.4",
Expand All @@ -72,6 +78,7 @@
],
"test": TESTS_REQUIRE,
"docs": DOCS_REQUIRE,
"parallel": PARALLEL_REQUIRE,
},
entry_points={
"console_scripts": [
Expand Down
Empty file removed src/__init__.py
Empty file.
3 changes: 2 additions & 1 deletion src/imitation/scripts/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def parallel(
Ray directory name.
base_config_updates: `search_space["config_updates"]` is applied to this
dict before it is passed to the inner experiment's `run()`.
resource_per_trial: Argument to `ray.tune.run()`.
resources_per_trial: Argument to `ray.tune.run()`.
init_kwargs: Arguments to pass to `ray.init`.
local_dir: `local_dir` argument to `ray.tune.run()`.
upload_dir: `upload_dir` argument to `ray.tune.run()`.
"""
Expand Down