Skip to content

Commit

Permalink
Merge pull request #8 from Ensembl/setup_pyproject
Browse files Browse the repository at this point in the history
toying with setuptools
  • Loading branch information
vsitnik authored Jun 16, 2022
2 parents 020caf4 + 36abe51 commit fb15304
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 83 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
**/__pycache__
**/*.egg-info
**/pip-wheel-metadata
**/build
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,49 @@ A set of ehive pipelines:

The files are in various formats (fasta, gff3, json) following BRC4 specifications.

## Get repo and install

```
git clone [email protected]:Ensembl/ensembl-genomio.git
pip install ./ensembl-genomio
# test
python -c 'import ensembl.brc4.runnable.read_json'
```

Update your perl envs (if you need to)
```
export PERL5LIB=$(pwd)/ensembl-genomio/lib/perl:$PERL5LIB
export PATH=$(pwd)/ensembl-genomio/scripts:$PATH
```

### Optional installation
If you need to install "editable" python package use '-e' option
```
pip install -e ./ensembl-genomio
```

To install additional dependencies (e.g. `[doc]` or `[dev]`) provide `[<tag>]` string. I.e.
```
pip install -e ./ensembl-genomio[dev]
```

For the list of tags see `[project.optional-dependencies]` in [pyproject.toml](./pyproject.toml).

### Docs generation
Install python part with the `[doc]` or `[dev]` tag.
Change into repo dir
Run doc build script.

```
git clone [email protected]:Ensembl/ensembl-genomio.git
pip install -e ./ensembl-genomio[doc]
cd ./ensembl-genomio
# build docs
./scripts/setup/docs/build_sphinx_docs.sh
```



1 change: 0 additions & 1 deletion VERSION

This file was deleted.

95 changes: 95 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# pyproject.toml -- Ensembl GenomIO project configuration

[build-system]
requires = [
"setuptools",
"setuptools-scm",
"wheel"
]
build-backend = "setuptools.build_meta"


## Generic configuration
[project]
name = "ensembl-genomio"
version = "0.1" # should be assigned dynamically in the future
requires-python = ">= 3.7"

description = "Ensembl GenomIO -- pipelines to convert basic genomic data into Ensembl cores and back to flatfile"
readme = "README.md"

authors = [ { name = "Ensembl", email = "[email protected]" } ]
license = { text = "Apache License 2.0" }
# for urls see [project.urls] below

keywords = [
"genome_io",
"ensembl",
"bioinformatics",
"annotation",
"setup",
]
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Software Development :: Libraries :: Python Modules",
]

dependencies = [
"bcbio-gff >= 0.6.6",
"biopython >= 1.79",
"jsonschema >= 4.6.0",
"intervaltree >= 3.1.0",
"mysql-connector-python >= 8.0.29",
"python-redmine >= 2.3.0",
"requests >= 2.28.0",
] # see [project.optional-dependencies] for dev dependencies

[project.optional-dependencies]
dev = [
"mock",
"Sphinx",
"toml-validator",
]

doc = [
"mock",
"Sphinx",
]


[project.urls]
homepage = "https://www.ensembl.org"
repository = "https://github.com/Ensembl/ensembl-genomio"


## `setuptools` related section
[tool.setuptools]
package-dir = {"" = "lib/python"}

[tool.setuptools.packages.find]
where = ["lib/python"] # list of folders that contain the packages (["."] by default)

# For additional information on `setuptools` configuration see
# https://setuptools.pypa.io/en/latest/userguide/quickstart.html
# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
# https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
3 changes: 0 additions & 3 deletions requirements-doc.txt

This file was deleted.

6 changes: 0 additions & 6 deletions requirements.txt

This file was deleted.

Empty file modified scripts/setup/docs/build_sphinx_docs.sh
100644 → 100755
Empty file.
35 changes: 0 additions & 35 deletions scripts/setup/docs/make.bat

This file was deleted.

42 changes: 4 additions & 38 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Build script for setuptools."""
import sys
"""setuptools based stub for the "editable" installations"""

from setuptools import setup, find_namespace_packages
from setuptools import setup

with open('README.md') as f:
readme = f.read()
if __name__ == "__main__":
setup()

with open('VERSION') as f:
version = f.read()

def import_requirements(requirements_path):
"""Import file located at the root of the repository."""
with open(requirements_path) as file:
return [line.rstrip() for line in file.readlines()]
setup(
name='ensembl-genomio',
version=version,
packages=find_namespace_packages(where='lib/python'),
package_dir={"": "lib/python"},
description="Ensembl Genome IO",
include_package_data=True,
install_requires=import_requirements('requirements.txt'),
long_description=readme,
author='Ensembl',
author_email='[email protected]',
url='https://www.ensembl.org',
download_url='https://github.com/Ensembl/ensembl-genomio',
license="Apache License 2.0",
python_requires=">=3.7",
classifiers=[
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Programming Language :: Python :: 3.7",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Software Development :: Libraries :: Python Modules",
]
)

0 comments on commit fb15304

Please sign in to comment.