-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 14aa05f
Showing
24 changed files
with
648 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
**Note: Do not attempt to use this directly unless you | ||
know what you are doing. The happy path is to let `roadie` interact with this | ||
template for you.** | ||
|
||
This is a template repository. It will be used by `roadie` to instantiate | ||
instances. We will make an initial commit on those repos with this boilerplate, | ||
so there is traceability as to the version of this template the repo was created | ||
with. This could be useful in figuring out later upgrades necessary to keep | ||
a repo up-to-date with compliance standards. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"repo_name": "Repository name (use hyphens)", | ||
"description": "Project summary description", | ||
"package": "package? (y/n)", | ||
"type": "dash/package/service/task", | ||
"yapf": "yapf configuration", | ||
"flake8": "flake8 configuration", | ||
"cli": "cli? (y/n)", | ||
"python_name": "{{cookiecutter.repo_name|replace('-', '_')|lower}}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
import shutil | ||
|
||
|
||
def move_files(files_to_move): | ||
for f in files_to_move: | ||
shutil.move(f['src'], f['dest']) | ||
|
||
|
||
def main(): | ||
have_cli = {{cookiecutter.cli == 'y'}} | ||
python_name = '{{cookiecutter.python_name}}' | ||
|
||
|
||
files_to_delete = set() | ||
dirs_to_delete = set() | ||
|
||
if not have_cli: | ||
files_to_delete = files_to_delete.union({f'{python_name}/cli.py'}) | ||
|
||
for f in files_to_delete: | ||
os.remove(f) | ||
|
||
for d in dirs_to_delete: | ||
shutil.rmtree(d) | ||
|
||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test-package/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--index-url https://${PYPI_DOWNLOAD_USERNAME}:${PYPI_DOWNLOAD_PASSWORD}@nexus.rxrx.io/repository/pypi-all/simple | ||
bandit | ||
cookiecutter | ||
flake8 | ||
mypy | ||
roadie[cli]>=2.3.9 | ||
safety | ||
yapf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -x | ||
|
||
python3.9 -m pip install -r requirements.txt | ||
|
||
################################################################################ | ||
#### Test Case: Package With CLI | ||
rm -rf test-package || true | ||
python3.9 test_generate.py y | ||
|
||
pushd test-package | ||
|
||
python3.9 -m roadie.cli.main yapf dump -o ./style.yapf | ||
python3.9 -m roadie.cli.main lock -u ${PYPI_DOWNLOAD_USERNAME} -p ${PYPI_DOWNLOAD_PASSWORD} --all | ||
python3.9 -m roadie.cli.main venv -u ${PYPI_DOWNLOAD_USERNAME} -p ${PYPI_DOWNLOAD_PASSWORD} --use-venv | ||
source venv/bin/activate | ||
|
||
flake8 | ||
yapf --style ./style.yapf --parallel --diff -r . | ||
mypy | ||
bandit -r . -x /tests/,/venv/ | ||
safety check $(ls requirements/*.txt | xargs -i echo -n ' -r {}') | ||
CONFIGOME_ENV=test pytest | ||
pip install --upgrade tox | ||
tox --parallel | ||
|
||
popd | ||
|
||
################################################################################ | ||
#### Test Case: Package Without a CLI | ||
rm -rf test-package || true | ||
python3.9 test_generate.py n | ||
|
||
pushd test-package | ||
|
||
python3.9 -m roadie.cli.main yapf dump -o ./style.yapf | ||
python3.9 -m roadie.cli.main lock -u ${PYPI_DOWNLOAD_USERNAME} -p ${PYPI_DOWNLOAD_PASSWORD} --all | ||
python3.9 -m roadie.cli.main venv -u ${PYPI_DOWNLOAD_USERNAME} -p ${PYPI_DOWNLOAD_PASSWORD} --use-venv | ||
source venv/bin/activate | ||
|
||
flake8 | ||
yapf --style ./style.yapf --parallel --diff -r . | ||
mypy | ||
bandit -r . -x /tests/,/venv/ | ||
safety check $(ls requirements/*.txt | xargs -i echo -n ' -r {}') | ||
CONFIGOME_ENV=test pytest | ||
pip install --upgrade tox | ||
tox --parallel | ||
|
||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from cookiecutter.main import cookiecutter | ||
from roadie.constants import FLAKE8_STYLE, YAPF_STYLE | ||
import sys | ||
|
||
|
||
def main(): | ||
|
||
yapf_configuration = '' | ||
for k, v in YAPF_STYLE.items(): | ||
yapf_configuration += f'{k.lower()} = {str(v).lower()}\n' | ||
flake8_configuration = '' | ||
for k, v in FLAKE8_STYLE.items(): | ||
flake8_configuration += f'{k.lower()} = {str(v).lower()}\n' | ||
|
||
cookiecutter_context = { | ||
'repo_name': "test-package", | ||
'description': "words go here", | ||
'type': 'package', | ||
'yapf': yapf_configuration, | ||
'flake8': flake8_configuration, | ||
'cli': sys.argv[1], | ||
} | ||
cookiecutter('..', no_input=True, extra_context=cookiecutter_context) | ||
|
||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
venv*/ | ||
build/ | ||
dist/ | ||
.tox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM gcr.io/eng-infrastructure/rxrx-pyenv as test | ||
ENV LC_ALL=C.UTF-8 | ||
ENV LANG=C.UTF-8 | ||
|
||
ENV CONFIGOME_ENV=test | ||
ENTRYPOINT [ "tox", "--parallel" ] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# {{cookiecutter.repo_name}} | ||
|
||
{{cookiecutter.description}} | ||
|
||
## Installation | ||
|
||
### PIP | ||
|
||
This package is installable via [Nexus](nexus.rxrx.io). You should configure your PIP using the instructions listed at | ||
[roadie: PIP Configuration](https://github.com/recursionpharma/roadie#pip-configuration). Then, execute the following: | ||
|
||
```bash | ||
pip install {{cookiecutter.python_name}} | ||
``` | ||
|
||
### Conda | ||
|
||
You will need [anaconda cloud setup](https://github.com/recursionpharma/drug-discovery/wiki/Anaconda-Setup#setup-anaconda-cloud-locally) | ||
in order to access the Recursion conda packages. Once that is setup you can install this library like so: | ||
|
||
``` | ||
conda config --add channels conda-forge | ||
conda config --add channels defaults | ||
conda config --add channels recursion | ||
conda install {{cookiecutter.python_name}} | ||
``` | ||
|
||
## Developing | ||
|
||
Please refer to [Developing Python at Recursion](https://github.com/recursionpharma/roadie/blob/trunk/Developing.md) | ||
for all tasks related to development of this codebase. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
MAJOR="0" | ||
MINOR="0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{# raw is for ignoring templating with cookiecutter, leaving it for use with conda-build #} | ||
{% raw -%} | ||
{% set data = load_setup_py_data() %} | ||
{%- endraw %} | ||
|
||
package: | ||
name: {{cookiecutter.python_name}} | ||
{# raw is for ignoring templating with cookiecutter, leaving it for use with conda-build #} | ||
{% raw -%} | ||
version: {{ data['version'] }} | ||
{%- endraw %} | ||
|
||
source: | ||
path: .. | ||
|
||
build: | ||
# If the installation is complex, or different between Unix and Windows, use | ||
# separate bld.bat and build.sh files instead of this key. Add the line | ||
# "skip: True # [py<35]" (for example) to limit to Python 3.5 and newer, or | ||
# "skip: True # [not win]" to limit to Windows. | ||
script: python setup.py install --single-version-externally-managed --record=record.txt | ||
noarch: python | ||
{%- if cookiecutter.cli == 'y' %} | ||
entry_points: | ||
- {{cookiecutter.python_name}} = {{cookiecutter.python_name}}.cli:cli | ||
{%- endif %} | ||
|
||
requirements: | ||
build: | ||
- python>=3.6 | ||
- setuptools | ||
- roadie | ||
run: | ||
- python>=3.6 | ||
{% raw -%} | ||
# dependencies are defined in setup.py | ||
{% for dep in data['install_requires'] %} | ||
- {{ dep.lower() }} | ||
{% endfor %} | ||
{# raw is for ignoring templating with cookiecutter, leaving it for use with conda-build #} | ||
{%- endraw %} | ||
|
||
test: | ||
source_files: | ||
- tests | ||
requires: | ||
- pytest | ||
commands: | ||
- pytest tests | ||
|
||
about: | ||
home: https://github.com/recursionpharma/{{cookiecutter.repo_name}} | ||
summary: {{cookiecutter.description}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# These are the minimum specifications required to set up a development | ||
# environment and includes things like depedencies required for testing, tools | ||
# for ensuring security, formatting, and static checking compliance. Feel free | ||
# to add anything that improves your developer experience. | ||
# | ||
# Do you like to test things in a notebook? Then, add `notebook` here. Do you | ||
# find yourself inspecting objects a lot in the REPL? May I suggest `pdir2`. Do | ||
# you like lots of colors and formatting options in your REPL, then get `rich`. | ||
# Remember, it doesn't pay to be too specific here, roadie can be used to | ||
# resolve your environment and make it reproducible for others. | ||
|
||
-c main | ||
|
||
bandit | ||
flake8<4; python_version<'3.8' | ||
flake8; python_version>='3.8' | ||
mypy | ||
pytest | ||
pytest-cov | ||
roadie | ||
safety | ||
types-pkg_resources | ||
yapf |
Oops, something went wrong.