Skip to content
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
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@ on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.12']
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
pip install -e ".[tests]"

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ If you prefer to avoid conda and use a virtual environment with your favorite py
```
python -m venv tilepy_venv
source tilepy_venv/bin/activate
pip3 install --upgrade pip
python -m pip install -r requirements.txt
pip install --upgrade pip
pip install .
```

Requirements of the installation:

- The current version of the package **only** runs with `python>=3.9`. Python 3.9 is recommended. Be careful as well with the versions of matplotlib and healpy, they should be the ones explicitly given in the requirements.yml, otherwise conflicts between them when plotting skymaps will arise.
- Note that by creating the env from the environment.yml, the libraries and versions needed will be installed automatically.
- Note that every time we made changes to the package, you should update the installation of the package doing ```pip install .``` in the folder where the setup.py is located. The changes will be only applied to the env in which you are working.
- Note that every time we made changes to the package, you should reinstall the package by running ```pip install .``` in the project root directory. The changes will be only applied to the env in which you are working.
- The package relies on 'curl' to download the localisation map of the multi-messenger events.

In the case you are working in CC-Lyon, the easiest solution is to do```ccenv conda ``` and then follow the instructions given above.
Expand Down
35 changes: 18 additions & 17 deletions cite_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

import requests

try:
import tomllib # Python 3.11+
except ImportError:
import tomli as tomllib # Python 3.9, 3.10


def get_authors_from_github(repo_path, title, url):
headers = {
Expand Down Expand Up @@ -63,28 +68,24 @@ def write_bibtex_to_file(data):
file.write(bibtex_entry)


# Parse requirements.txt for package names and versions
# with open('requirements.txt', 'r') as file:
# lines = file.readlines()
# packages_and_versions = [line for line in lines]
def parse_pyproject_dependencies(file_path="pyproject.toml"):
"""Parse dependencies from pyproject.toml"""
packages = []
with open(file_path, "rb") as f:
data = tomllib.load(f)

# Extract main dependencies
dependencies = data.get("project", {}).get("dependencies", [])
for dep in dependencies:
# Remove any version specifiers and whitespace
package_name = dep.split("[")[0].strip()
if package_name and package_name.lower() != "setuptools":
packages.append(dep)

def parse_requirements(file_path):
packages = []
with open(file_path, "r") as file:
for line in file:
# Removing any trailing whitespace and comments
package = line.split("#")[0].strip()
if package: # Only add non-empty lines
packages.append(package)
return packages


# Usage
file_path = "./requirements.txt" # Replace with your file path
packages = parse_requirements(file_path)
print(packages)

packages = parse_pyproject_dependencies("./pyproject.toml")
print("requirements found: ", packages)
# Regex to match GitHub URLs
github_pattern = re.compile(r"https?://github\.com/([\w\-]+/[\w\-]+)")
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies = [
'astropy',
'scipy<1.14.0',
'numpy',
'healpy==1.16.2',
'healpy>=1.16.2,<2',
'ipython',
'matplotlib<3.9.0',
'MOCpy',
Expand Down Expand Up @@ -177,6 +177,6 @@ ignore-words-list = """
package = true

override-dependencies = [
'healpy>=1.17.0',
'healpy>=1.16.2,<2',
"setuptools>=64,<71",
]
23 changes: 0 additions & 23 deletions requirements.txt

This file was deleted.

Loading