This repository contains a set of standard dotfiles and configuration files to ensure a minimum level of software standards for Anaconda packaging tooling in all new Python projects going forward.
These tools and standards have been proven and used in a number of our open source Python projects:
black
- Standard rule set, with modifications for
isort
compatibility and support for 120-column line lengths.
- Standard rule set, with modifications for
pylint
- An Anaconda-developer friendly variant of the Google Python Style Guide
mypy
make
pre-commit
pytest
docconvert
Most of the config files provided by this repository will have a TODO
where a project name should be.
Project names generally should start with anaconda-
and use -
's to represent spaces. Underscores will need to
be used in any corresponding package names.
Roughly, the project should look like:
/
|-- <dotfiles>
|-- <project_name_with_underscores>
|-- __init__.py # An empty file
|-- py.typed # An empty file
|-- <Other source files and module folders>
|-- tests/
|-- <pytest config files, `test_*.py`>
|-- <test utility files>
|-- test_aux_files/
|-- <Auxiliary test files used in tests>
- Move the project into its own repository, if applicable. If not, incorporate the tool into an existing project
- Many package builder scripts may fall into the
perseverance-scripts
umbrella
- Many package builder scripts may fall into the
- Establish which version(s) of Python we need to target. For now, new tools are targeting
3.11+
- Copy the dotfiles and configurations from this repository over. The following bullet points go into specific detail.
- Update the
pyproject.toml
as needed. - Setup an
environment.yaml
file to ensure dependencies are installable byconda
- Setup the standard
Makefile
to ensure a consistent set ofmake
targets across our projects.- Not all of these will work until the following steps are configured.
- Setup
pre-commit
- Our projects use
pre-commit
andmake
to enforce our code and test requirements. If done properly,make dev
will create an environment withpre-commit
automatically installed. Developers should be able to blow away and start over from scratch by just runningmake dev
- Our projects use
- Setup and enforce some amount of unit test coverage with
pytest
. Eventually the goal should be at to require at least 80% coverage for your project. - Setup and enforce our standard
pylint
rules - Setup and enforce our standard
mypy
rules - Setup GitHub Actions that run the
pre-commit
checks and unit tests on all supported versions of Python. Enforce that all PRs must pass these checks as merge requirements through the repository's GitHub settings. This requires the Actions to run on a PR at least once before they will show up in the GitHub settings page. - If this is a library, configure the project to publish to the
distro-tooling
channel as a "typed" project and create an appropriate feedstock inaggregate
. - If this is CLI-based tool, consider using the
click
library to build a modular command line interface and Python's built-inlogging
module for logging errors, debug information, etc.
- GitHub Workflows should use this shared configuration and set of minimum actions. This should be pulled in by new
new projects, in one of the following ways (TBD):
- Each repository's GitHub Workflow can pull and execute the GitHub Workflow found in this project, configuring environment variables as needed.
- Repositories that can access GitHub Enterprise features can be configured to automatically run a common GitHub Workflow.
- Find a way to share/pull-in the dotfiles without copying-and-pasting files
- Some projects may need to modify the base file.
- This might add some breakage risk but should simplify the process of improving all projects at once.